Simple-Ujs is a plugin that turns all of your view into Unobstrusive Javascripts views.
You don't need to learn any new syntax or a whole bunch of new helpers, you have just to call 1 helper () at the bottom of your master templates as close to the closing tag.
is the url path to the controller/action that will serve the javascript stored in the session with id of session_id.
The default path is /javascripts/ujs_handler and you can pass either a Hash or a String
'Session_id' is the name of the session that will store the javascript code. The default session name is 'ujs_script'
When you install this plugin it will automatically copy the file from /lib/simple_ujs/javascripts_controller.rb into your controllers folder. (From RAILS_ROOT run ruby vendor/plugins/simple_ujs/install.rb)
The content of that file is as follows.
class JavascriptsController < ApplicationController
def ujs_handler
render :update do |page|
page << session[:ujs_script]
end
end
endThere is a global setting SimpleUjs::Base.use_ujs that can be set to either true or false to activate or deactivate the SimpleUjs plugin.
The SimpleUjs plugin also moves all of your javascript includes called with the javascript_include_tag method to the bottom of the page right before the call to /javascripts/ujs_handler. I do this because I strongly agree with Douglas Crockford. I can be convinced to make it user-choice though if somebody has reason. The bottom of the page is the best place to insert javascript includes from a page load and performance perspective.
This plugin is for people like me that are sometimes lazy and believe that the best possible setting for any tool should always be the default one.
to install ruby script/plugin install http://simple-ujs.googlecode.com/svn/simple_ujs/
Open Hub computes statistics on FOSS projects by examining source code and commit history in source code management systems. This project has no code locations, and so Open Hub cannot perform this analysis
Is this project's source code hosted in a publicly available repository? Do you know the URL? If you do, click the button below and tell us so that Open Hub can generate statistics! It's fast and easy - try it and see!
This Project has No vulnerabilities Reported Against it
Did You Know...
...
there are over 3,000 projects on the Open Hub with security vulnerabilities reported against them
...
search using multiple tags to find exactly what you need
...
use of OSS increased in 65% of companies in 2016
...
learn about Open Hub updates and features on the
Open Hub blog
No code available to analyze
Open Hub computes statistics on FOSS projects by examining source code and commit history in source code management systems. This project has no code locations, and so Open Hub cannot perform this analysis
Is this project's source code hosted in a publicly available repository? Do you know the URL? If you do, click the button below and tell us so that Open Hub can generate statistics! It's fast and easy - try it and see!
This site uses cookies to give you the best possible experience.
By using the site, you consent to our use of cookies.
For more information, please see our
Privacy Policy