Module: RansackUI::ViewHelpers
- Defined in:
- lib/ransack_ui/view_helpers.rb
Instance Method Summary collapse
- #link_to_add_fields(name, f, type) ⇒ Object
- #link_to_remove_fields(name, f) ⇒ Object
- #ransack_search_form ⇒ Object
Instance Method Details
#link_to_add_fields(name, f, type) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/ransack_ui/view_helpers.rb', line 7 def link_to_add_fields(name, f, type) new_object = f.object.send "build_#{type}" fields = f.send("#{type}_fields", new_object, :child_index => "new_#{type}") do |builder| render "ransack/#{type.to_s}_fields", :f => builder end link_to name, nil, :class => "add_fields", "data-field-type" => type, "data-content" => "#{fields}" end |
#link_to_remove_fields(name, f) ⇒ Object
15 16 17 |
# File 'lib/ransack_ui/view_helpers.rb', line 15 def link_to_remove_fields(name, f) link_to image_tag('delete.png', :size => '16x16', :alt => name), nil, :class => "remove_fields" end |
#ransack_search_form ⇒ Object
3 4 5 |
# File 'lib/ransack_ui/view_helpers.rb', line 3 def ransack_search_form render 'ransack/search' end |