Module: Agilibox::FiltersHelper
- Included in:
- AllHelpers
- Defined in:
- app/helpers/agilibox/filters_helper.rb
Instance Method Summary collapse
- #agilibox_time_periods_for_select ⇒ Object
- #filter_buttons ⇒ Object
- #filter_reset_button(options = {}) ⇒ Object
- #filter_submit_button(options = {}) ⇒ Object
- #filters_form(options = {}, &block) ⇒ Object
Instance Method Details
#agilibox_time_periods_for_select ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'app/helpers/agilibox/filters_helper.rb', line 53 def agilibox_time_periods_for_select { t("time_periods.all_time") => "", t("time_periods.today") => "today", t("time_periods.yesterday") => "yesterday", t("time_periods.this_week") => "this_week", t("time_periods.last_week") => "last_week", t("time_periods.this_month") => "this_month", t("time_periods.last_month") => "last_month", t("time_periods.this_year") => "this_year", t("time_periods.last_year") => "last_year", t("time_periods.custom_date") => "custom_date", } end |
#filter_buttons ⇒ Object
28 29 30 |
# File 'app/helpers/agilibox/filters_helper.rb', line 28 def + end |
#filter_reset_button(options = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/helpers/agilibox/filters_helper.rb', line 15 def ( = {}) [:class] ||= "btn btn-default reset filter-reset" [:type] ||= "submit" [:value] ||= "reset" text = .delete(:text) || t("actions.reset") icon = .delete(:icon) || :undo content_tag(:button, ) do icon(icon) + " " + text end end |
#filter_submit_button(options = {}) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 |
# File 'app/helpers/agilibox/filters_helper.rb', line 2 def ( = {}) [:class] ||= "btn btn-default submit filter-submit" [:type] ||= "submit" [:value] ||= "submit" text = .delete(:text) || t("actions.filter") icon = .delete(:icon) || :filter content_tag(:button, ) do icon(icon) + " " + text end end |
#filters_form(options = {}, &block) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/helpers/agilibox/filters_helper.rb', line 32 def filters_form( = {}, &block) if .key?(:buttons) = .delete(:buttons) else = true end = { :url => agilibox.small_data_filters_path, :wrapper => :inline_form, }.merge() html = simple_form_for(:filters, , &block) if html = html.gsub("</form>", "#{form_hidden_submit + }</form>").html_safe end html end |