Giter Site home page Giter Site logo

prototype-rails's Introduction

prototype-rails provides Prototype, Scriptaculous, and RJS on Rails 3.1 and later.

Prototype and Scriptaculous are pulled in by the asset pipeline, so you don't need to copy the source files into your app. You may reference them in your s app/assets/javascripts/application.js:

//= require prototype
//= require prototype_ujs
//= require effects
//= require dragdrop
//= require controls

prototype-rails supports RJS debugging. RJS responses are wrapped to catch exceptions, alert() them, and re-raise the exception. Debugging is disabled by default. To enable in development, set config.action_view.debug_rjs = true in config/environments/development.rb.


Support for Rails 4.1 and above

Unfortunately, due to limited manpower and resources, the Rails core team has not been able to confirm if this gem currently works with Rails 4.1 and above. If you have found any problems while upgrading your application, please report them at the issue tracker, or better yet, submit patches by sending a pull request.

In any case, this gem will NOT be officially supported on Rails 5.0 and above.

prototype-rails's People

Contributors

chancancode avatar dhh avatar fxn avatar grosser avatar guiman avatar jeremy avatar jordimassaguerpla avatar josevalim avatar korny avatar rafaelfranca avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

prototype-rails's Issues

Add License information to Gemspec

This will make it show up on rubygems.org. I'm doing due diligence on our gems and need to find out the licenses for all the gems. Having it show up on rubygems.org cuts out the step of having to go to the github repo.

Does not looks compatible with Rails 3.1.0rc2

When trying to start Rails I am getting the following error:

https://gist.github.com/1014249

I am on Mac OS X Snow Leo with ruby 1.9.2p274 (2011-06-06 revision 31932) [x86_64-darwin10.7.0]. The versions in my Gemfile:

[andrey-mbp ~/projects/rails/alt12-site rails3]$ bundle show rails
/Users/akhkharu/.rvm/gems/ruby-1.9.2-head@alt12/gems/rails-3.1.0.rc2
[andrey-mbp ~/projects/rails/alt12-site rails3]$ bundle show prototype-rails
/Users/akhkharu/.rvm/gems/ruby-1.9.2-head@alt12/gems/prototype-rails-0.3.1

flash message not displaying while using the rcs

Hi,
rcs file is loaded,but the flash message is not loaded properly.
The content of the rcs file is below

#page['ajax-indicator'].set_style :display => ''
data = @DaTa || :data
output = @output || :output
#page.alert(page[:subject_form])
#page[:subject_form].reset()
if @successful
page[data].replace_html :partial => @partial_render
page[output].replace_html flash_messages
else
if(flash[:notice] or flash[:error])
page[output].replace_html flash_messages
else
page[output].replace_html error_messages_for @model
end
end

#page.visual_effect :fade, 'ajax-indicator'
#page['ajax-indicator'].set_style :display => 'none'

The output for adding I got as follow

$("data").update("\n\u003cp class='info'\u003eNo data to display\u003c/p\u003e\n\n");
$("output").update("\u003cp class='success'\u003eNew activity is added successfully\u003c/p\u003e\u003cbr\u003e");
new Effect.Fade("ajax-indicator",{});

But I want this output with flash with appropriate image.

Kindly help me to resolve this issue.

cannot load such file -- action_view/vendor/html-scanner (LoadError)

Hello,
I am upgrading rails application to 4.2 and i am facing html-scanner issue when attempting to start the webrick server.
I found that the issue is causing with prototype-rails gem from other blogs and I tried updating my Gemfile with below line.
gem 'prototype-rails', github: 'rails/prototype-rails', branch: '4.2'
After I add this line, bundle install and restart the server, server starts fine but none of the assets are loading in the UI when I navigate to localhost:3000.
Any suggestions on this issue would be appreciated!!

Below is some more details of the error
=> Booting WEBrick
=> Rails 4.2.0 application starting in development on http://localhost:3000
=> Run rails server -h for more startup options
=> Ctrl-C to shutdown server
Exiting
/Users/user123/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in require': cannot load such file -- action_view/vendor/**html-scanner** (LoadError) from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in block in require'
from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in load_dependency' from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in require'
from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/prototype-rails-4.0.0/lib/prototype-rails/selector_assertions.rb:2:in <top (required)>' from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in require'
from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in block in require' from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in load_dependency'
from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in require' from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/prototype-rails-4.0.0/lib/prototype-rails/on_load_action_controller.rb:1:in <top (required)>'
from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in require' from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in block in require'
from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in load_dependency' from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in require'
from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/prototype-rails-4.0.0/lib/prototype-rails.rb:8:in block (2 levels) in <class:Engine>' from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:38:in instance_eval'
from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:38:in execute_hook' from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:28:in block in on_load'
from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:27:in each' from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:27:in on_load'
from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/prototype-rails-4.0.0/lib/prototype-rails.rb:7:in block in <class:Engine>' from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/initializable.rb:30:in instance_exec'
from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/initializable.rb:30:in run' from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/initializable.rb:55:in block in run_initializers'
from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/2.1.0/tsort.rb:226:in block in tsort_each' from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/2.1.0/tsort.rb:348:in block (2 levels) in each_strongly_connected_component'
from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/2.1.0/tsort.rb:427:in each_strongly_connected_component_from' from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/2.1.0/tsort.rb:347:in block in each_strongly_connected_component'
from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/2.1.0/tsort.rb:345:in each' from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/2.1.0/tsort.rb:345:in call'
from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/2.1.0/tsort.rb:345:in each_strongly_connected_component' from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/2.1.0/tsort.rb:224:in tsort_each'
from /Users/user123/.rbenv/versions/2.1.5/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
........

undefined method `debug_rjs=' for ActionView::Base:Class

When I add this to the Gemfile of a fresh Rails 3.1.0.beta1 app and add config.action_view.debug_rjs = true to environments/development.rb I get the following exception:

/gems/actionpack-3.1.0.beta1/lib/action_view/railtie.rb:34:in `send': undefined method `debug_rjs=' for ActionView::Base:Class (NoMethodError)

Not running with 3.1.1

I'm trying to transform a Rails 2.3.14 to 3.1.1 application.
Prototype rails should provide all the lost remote_foo..
But it doesn't work at all for me. It's like if the gem was not enable anymore.
I installed it, reinstalled it, bundle install/update, add/remove/add gem into Gemfile, test it as a plugin, everything, but I still have got this error "undefined method `remote_function' ".

The function seams to be there, into the prototype-rails gem into prototype helpers file, but my application don't see it, why ? Do you have an idea ?

uninitialized constant AbstractController::Rendering in Rails 4.2

I'm trying to migrate an app that still uses prototype from Rails 4.1 to 4.2.

I'm using Rails 4.2.rc2.

Steps to reproduce:

rails new testapp -j prototype
cd testapp
rails s

Throws this error:

ruby/gems/2.1.0/gems/actionpack-4.2.0.rc2/lib/action_controller/base.rb:204:in `<class:Base>': uninitialized constant AbstractController::Rendering (NameError)

Conflict With ActionMailer?

While setting up actionmailer and testing it, I have been running into an error. It appears to be caused by prototype-rails, since my example works when I use jquery. I don't know enough about the internals to track the source of the bug down.

UserMailer.welcome_email.deliver
NoMethodError: undefined method `protected_instance_variables=' for ActionController::Base:Class
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.2.1/lib/action_controller/metal/compatibility.rb:22:in `block in <module:Compatibility>'
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.2.1/lib/active_support/concern.rb:117:in `class_eval'
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.2.1/lib/active_support/concern.rb:117:in `append_features'
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.2.1/lib/action_controller/base.rb:232:in `include'
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.2.1/lib/action_controller/base.rb:232:in `<class:Base>'
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.2.1/lib/action_controller/base.rb:171:in `<module:ActionController>'
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.2.1/lib/action_controller/base.rb:3:in `<top (required)>'
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.2.1/lib/action_view/test_case.rb:11:in `<class:TestCase>'
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.2.1/lib/action_view/test_case.rb:10:in `<module:ActionView>'
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.2.1/lib/action_view/test_case.rb:8:in `<top (required)>'
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/prototype-rails-3.2.1/lib/prototype-rails/on_load_action_view.rb:17:in `<top (required)>'
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:234:in `block in load_dependency'
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:639:in `new_constants_in'
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:234:in `load_dependency'
... 23 levels...
    from /users/user/Documents/element/app/mailers/user_mailer.rb:1:in `<top (required)>'
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:469:in `load'
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:469:in `block in load_file'
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:639:in `new_constants_in'
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:468:in `load_file'
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:353:in `require_or_load'
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:502:in `load_missing_constant'
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:192:in `block in const_missing'
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:190:in `each'
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:190:in `const_missing'
    from (irb):1
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.2.1/lib/rails/commands/console.rb:47:in `start'
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.2.1/lib/rails/commands/console.rb:8:in `start'
    from /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.2.1/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'ruby-1.9.2-p0 > 

Generated page_update javascript is incorrectly escaped.

The javascript being generated by update_page is incorrectly marked as html_safe. This causes a problem when you include an update_page fragment as an option on an HTML tag.

For example:

<%= submit_tag('Save', :disable_with => 'Please wait...', :onclick => update_page {|p| p.hide("cancel-update")}) %>

The onclick option is passed through to the tag helpers and eventually the text is processed by ERB::Util.html_escape. However, the html_escape method does not escape the string if it is marked as html_safe. All output from update_page is marked as html_safe, even though it isn't.

The output from update_page in the above example is

"Element.hide(\"cancel-update\");"

Clearly, the output has not been escaped as the " characters have not been converted -

"Element.hide(&quot;cancel-update&quot;);"

The solution is to remove the html_safe method from the output of update_page -

def update_page(&block)
  JavaScriptGenerator.new(self, &block).to_s
end

I realize that it's pretty futile raising an issue here in the hope that the official gem might be updated. However, for any other users out there with large amounts of Prototype code that can't afford to instantly convert everything to JQuery, then this might help you.

It would be nice if the Rails developers sometimes recognized that in the real world, we don't necessarily have all the resources to instantly jump on the latest bandwagon. Sadly Prototype has fallen out of favour and has now been neglected to the point where nobody bothers to fix any errors.

config.action_view.debug_rjs

I'm trying to move an app from 3.0 to 3.2. When I do so, I have to comment out the config.action_view.debug_rjs = true line otherwise I get this error:

~/.rvm/gems/ruby-1.9.3-p125@rigse/gems/actionpack-3.2.2/lib/action_view/railtie.rb:34:in block (3 levels) in <class:Railtie>': undefined methoddebug_rjs=' for ActionView::Base:Class (NoMethodError)

looking at the prototype-rails code I don't see how the config.action_view.debug_rjs = true line could work because prototype-rails doesn't seem to create the debug_rjs method anywhere.

Add minitest to gemspec

Hi,
I think you should add minitest or test/unit to the gemspec. When using with Fedora Ruby with unbundled minitest, I get
cannot load such file -- minitest/unit
...
/home/bkabrda/.gem/ruby/1.9.1/gems/prototype-rails-3.2.1/lib/prototype-rails/on_load_action_view.rb:17:in `<top (required)>'
...
Thanks!

rjs file content displaying in UI

Hi,
I am migrating rails 2.3.8 to rails 4.2.7,on that we have used the rjs file for loading ajax,flash,etc as the common.rjs
In rails 4.2.7 rjs format is not supported,to support those I have use the gem in Gemfile as follow
gem 'prototype-rails', github: 'rails/prototype-rails', branch: '4.2'
I use bundle install to install the gem.
Add I have included the following line in app/assets/javascript/application.js
//= require prototype
//= require prototype_ujs
//= require effects
//= require dragdrop
//= require controls

After I tried to load the application,but it shows the content of common.rjs file in UI. The content is below

#page['ajax-indicator'].set_style :display => ''
data = @DaTa || :data
output = @output || :output
#page.alert(page[:subject_form])
#page[:subject_form].reset()
if @successful
page[data].replace_html :partial => @partial_render
page[output].replace_html flash_messages
else
if(flash[:notice] or flash[:error])
page[output].replace_html flash_messages
else
page[output].replace_html error_messages_for @model
end
end

page.visual_effect :fade, 'ajax-indicator'
#page['ajax-indicator'].set_style :display => 'none'

Kindly help to fix this issue

Release 4.0.0 gem

The gemspec has been bumped to 4.0.0 but the gem hasn't been released. Could you please release it :). @jeremy

Warning message when bundling (4.2 branch)

prototype-rails at /Users/murphy/.rvm/gems/ruby-2.1.5@schatten/bundler/gems/prototype-rails-d7c004222485 did not have a valid gemspec.
This prevents bundler from installing bins or native extensions, but that may not affect its functionality.
The validation message from Rubygems was:
  ["README"] are not files
Using prototype-rails 4.0.0 from git://github.com/rails/prototype-rails.git (at 4.2)

I guess README is now named README.md?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.