Module: ActionView::Helpers::PrototypeHelper::JavaScriptGenerator::GeneratorMethods
- Defined in:
- lib/jquery/jquery.rb
Instance Method Summary collapse
- #hide(*ids) ⇒ Object
- #insert_html(position, id, *options_for_render) ⇒ Object
- #jquery_id(id) ⇒ Object
- #jquery_ids(ids) ⇒ Object
- #remove(*ids) ⇒ Object
- #replace(id, *options_for_render) ⇒ Object
- #replace_html(id, *options_for_render) ⇒ Object
- #show(*ids) ⇒ Object
- #toggle(*ids) ⇒ Object
Instance Method Details
#hide(*ids) ⇒ Object
112 113 114 |
# File 'lib/jquery/jquery.rb', line 112 def hide(*ids) call "#{JQUERY_VAR}(\"#{jquery_ids(ids)}\").hide" end |
#insert_html(position, id, *options_for_render) ⇒ Object
89 90 91 92 93 94 |
# File 'lib/jquery/jquery.rb', line 89 def insert_html(position, id, *) insertion = position.to_s.downcase insertion = 'append' if insertion == 'bottom' insertion = 'prepend' if insertion == 'top' call "#{JQUERY_VAR}(\"#{jquery_id(id)}\").#{insertion}", render(*) end |
#jquery_id(id) ⇒ Object
120 121 122 |
# File 'lib/jquery/jquery.rb', line 120 def jquery_id(id) id.to_s.count('#.*,>+~:[/ ') == 0 ? "##{id}" : id end |
#jquery_ids(ids) ⇒ Object
124 125 126 |
# File 'lib/jquery/jquery.rb', line 124 def jquery_ids(ids) Array(ids).map { |id| jquery_id(id) }.join(',') end |
#remove(*ids) ⇒ Object
104 105 106 |
# File 'lib/jquery/jquery.rb', line 104 def remove(*ids) call "#{JQUERY_VAR}(\"#{jquery_ids(ids)}\").remove" end |
#replace(id, *options_for_render) ⇒ Object
100 101 102 |
# File 'lib/jquery/jquery.rb', line 100 def replace(id, *) call "#{JQUERY_VAR}(\"#{jquery_id(id)}\").replaceWith", render(*) end |
#replace_html(id, *options_for_render) ⇒ Object
96 97 98 |
# File 'lib/jquery/jquery.rb', line 96 def replace_html(id, *) insert_html(:html, id, *) end |
#show(*ids) ⇒ Object
108 109 110 |
# File 'lib/jquery/jquery.rb', line 108 def show(*ids) call "#{JQUERY_VAR}(\"#{jquery_ids(ids)}\").show" end |
#toggle(*ids) ⇒ Object
116 117 118 |
# File 'lib/jquery/jquery.rb', line 116 def toggle(*ids) call "#{JQUERY_VAR}(\"#{jquery_ids(ids)}\").toggle" end |