Module: ActionView::Helpers::JavaScriptHelper
- Defined in:
- lib/jquery/jrails.rb
Instance Method Summary collapse
-
#javascript_function(*args, &block) ⇒ Object
This function can be used to render rjs inline.
- #jquery_id(id) ⇒ Object
- #jquery_ids(ids) ⇒ Object
Instance Method Details
#javascript_function(*args, &block) ⇒ Object
This function can be used to render rjs inline
<%= javascript_function do |page|
page.replace_html :list, :partial => 'list', :object => @list
end %>
21 22 23 24 25 26 27 28 |
# File 'lib/jquery/jrails.rb', line 21 def javascript_function(*args, &block) = args. function = args[0] || '' .symbolize_keys! function = update_page(&block) if block_given? javascript_tag(function) end |
#jquery_id(id) ⇒ Object
30 31 32 |
# File 'lib/jquery/jrails.rb', line 30 def jquery_id(id) id.to_s.count('#.*,>+~:[/ ') == 0 ? "##{id}" : id end |
#jquery_ids(ids) ⇒ Object
34 35 36 |
# File 'lib/jquery/jrails.rb', line 34 def jquery_ids(ids) Array(ids).map{|id| jquery_id(id)}.join(',') end |