Module: Dorsale::FiltersHelper

Included in:
AllHelpers
Defined in:
app/helpers/dorsale/filters_helper.rb

Instance Method Summary collapse

Instance Method Details

#dorsale_time_periods_for_selectObject



33
34
35
36
37
38
39
40
# File 'app/helpers/dorsale/filters_helper.rb', line 33

def dorsale_time_periods_for_select
  {
    t("time_periods.all_time") => "",
    t("time_periods.today")    => "today",
    t("time_periods.week")     => "week" ,
    t("time_periods.month")    => "month",
  }
end

#filter_buttonsObject



29
30
31
# File 'app/helpers/dorsale/filters_helper.rb', line 29

def filter_buttons
  filter_reset_button + filter_submit_button
end

#filter_reset_button(options = {}) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/helpers/dorsale/filters_helper.rb', line 16

def filter_reset_button(options = {})
  options[:class] ||= "btn reset filter-reset"
  options[:type]  ||= "submit"
  options[:value] ||= "reset"

  text = options.delete(:text) || t("actions.reset")
  icon = options.delete(:icon) || "rotate-left"

  (:button, options) do
    icon(icon) + " " + text
  end
end

#filter_submit_button(options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/dorsale/filters_helper.rb', line 3

def filter_submit_button(options = {})
  options[:class] ||= "btn submit filter-submit"
  options[:type]  ||= "submit"
  options[:value] ||= "submit"

  text = options.delete(:text) || t("actions.filter")
  icon = options.delete(:icon) || "filter"

  (:button, options) do
    icon(icon) + " " + text
  end
end