Module: ActionView::Helpers::PrototypeHelper::JavaScriptGenerator::GeneratorMethods
- Defined in:
- lib/jquery_for_rjs.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
64 65 66 |
# File 'lib/jquery_for_rjs.rb', line 64 def hide(*ids) call "#{JQUERY_VAR}(\"#{jquery_ids(ids)}\").hide" end |
#insert_html(position, id, *options_for_render) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/jquery_for_rjs.rb', line 41 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
72 73 74 |
# File 'lib/jquery_for_rjs.rb', line 72 def jquery_id(id) id.to_s.count('#.*,>+~:[/ ') == 0 ? "##{id}" : id end |
#jquery_ids(ids) ⇒ Object
76 77 78 |
# File 'lib/jquery_for_rjs.rb', line 76 def jquery_ids(ids) Array(ids).map{|id| jquery_id(id)}.join(',') end |
#remove(*ids) ⇒ Object
56 57 58 |
# File 'lib/jquery_for_rjs.rb', line 56 def remove(*ids) call "#{JQUERY_VAR}(\"#{jquery_ids(ids)}\").remove" end |
#replace(id, *options_for_render) ⇒ Object
52 53 54 |
# File 'lib/jquery_for_rjs.rb', line 52 def replace(id, *) call "#{JQUERY_VAR}(\"#{jquery_id(id)}\").replaceWith", render(*) end |
#replace_html(id, *options_for_render) ⇒ Object
48 49 50 |
# File 'lib/jquery_for_rjs.rb', line 48 def replace_html(id, *) insert_html(:html, id, *) end |
#show(*ids) ⇒ Object
60 61 62 |
# File 'lib/jquery_for_rjs.rb', line 60 def show(*ids) call "#{JQUERY_VAR}(\"#{jquery_ids(ids)}\").show" end |
#toggle(*ids) ⇒ Object
68 69 70 |
# File 'lib/jquery_for_rjs.rb', line 68 def toggle(*ids) call "#{JQUERY_VAR}(\"#{jquery_ids(ids)}\").toggle" end |