Module: RansackUI::ViewHelpers
- Defined in:
- lib/ransack_ui/view_helpers.rb
Instance Method Summary collapse
- #link_to_add_fields(name, f, type, options) ⇒ Object
- #link_to_remove_fields(name, f, options) ⇒ Object
- #ransack_ui_search(options = {}) ⇒ Object
Instance Method Details
#link_to_add_fields(name, f, type, options) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# 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_ui/#{type.to_s}_fields", :f => builder, :options => end if [:theme].to_s == 'bootstrap' link_to nil, :class => "add_fields btn btn-small btn-primary", "data-field-type" => type, "data-content" => "#{fields}" do "<i class=\"icon-plus icon-white\"></i><span>#{name}</span>".html_safe end else link_to name, nil, :class => "add_fields", "data-field-type" => type, "data-content" => "#{fields}" end end |
#link_to_remove_fields(name, f, options) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/ransack_ui/view_helpers.rb', line 22 def link_to_remove_fields(name, f, ) if [:theme].to_s == 'bootstrap' link_to '<i class="icon-remove icon-white"></i>'.html_safe, nil, :class => "remove_fields btn btn-mini btn-danger" else link_to image_tag('ransack_ui/delete.png', :size => '16x16', :alt => name), nil, :class => "remove_fields" end end |
#ransack_ui_search(options = {}) ⇒ Object
3 4 5 |
# File 'lib/ransack_ui/view_helpers.rb', line 3 def ransack_ui_search( = {}) render 'ransack_ui/search', :options => end |