Module: AdminBits::Helpers
- Defined in:
- lib/admin_bits/helpers.rb
Instance Method Summary collapse
- #admin_date_filter(attribute) ⇒ Object
- #admin_form(options = {}, &block) ⇒ Object
- #admin_link(attrib, name) ⇒ Object
- #admin_select_filter(attribute, options, html_options) ⇒ Object
- #admin_text_filter(attribute) ⇒ Object
Instance Method Details
#admin_date_filter(attribute) ⇒ Object
40 41 42 |
# File 'lib/admin_bits/helpers.rb', line 40 def admin_date_filter(attribute) text_field_tag "filters[#{attribute}]", admin_resource.filter_params[attribute], :class => "datepicker" end |
#admin_form(options = {}, &block) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/admin_bits/helpers.rb', line 18 def admin_form( = {}, &block) form_tag(admin_resource.original_url, ) do content = capture(&block) = [ hidden_field_tag("order", admin_resource.request_params[:order]), hidden_field_tag("asc", admin_resource.request_params[:asc]), content ] .join("").html_safe end end |
#admin_link(attrib, name) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/admin_bits/helpers.rb', line 3 def admin_link(attrib, name) link_content = name.html_safe if admin_resource.request_params[:order] == attrib.to_s ascending = admin_resource.request_params[:asc] == "true" ? true : false klass = ascending ? "sort_asc" : "sort_desc" ascending = !ascending else klass = nil ascending = true end link_to link_content, admin_resource.url(:order => attrib, :asc => ascending.to_s), :class => klass end |
#admin_select_filter(attribute, options, html_options) ⇒ Object
32 33 34 |
# File 'lib/admin_bits/helpers.rb', line 32 def admin_select_filter(attribute, , ) select_tag "filters[#{attribute}]", , end |
#admin_text_filter(attribute) ⇒ Object
36 37 38 |
# File 'lib/admin_bits/helpers.rb', line 36 def admin_text_filter(attribute) text_field_tag "filters[#{attribute}]", admin_resource.filter_params[attribute] end |