Module: ActionView::Helpers::JavaScriptHelper

Included in:
JqgridJson, JqueryAutoCompleteJson
Defined in:
lib/jquery/jquery.rb

Instance Method Summary collapse

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 %>



22
23
24
25
26
27
28
29
# File 'lib/jquery/jquery.rb', line 22

def javascript_function(*args, &block)
  html_options = args.extract_options!
  function = args[0] || ''

  html_options.symbolize_keys!
  function = update_page(&block) if block_given?
  javascript_tag(function)
end

#jquery_id(id) ⇒ Object



31
32
33
# File 'lib/jquery/jquery.rb', line 31

def jquery_id(id)
  id.to_s.count('#.*,>+~:[/ ') == 0 ? "##{id}" : id
end

#jquery_ids(ids) ⇒ Object



35
36
37
# File 'lib/jquery/jquery.rb', line 35

def jquery_ids(ids)
  Array(ids).map { |id| jquery_id(id) }.join(',')
end