Module: Warped::Controllers::Filterable::Ui
- Extended by:
- ActiveSupport::Concern
- Includes:
- Warped::Controllers::Filterable
- Included in:
- Tabulatable::Ui
- Defined in:
- lib/warped/controllers/filterable/ui.rb
Instance Method Summary collapse
- #filter ⇒ Object
-
#filter_url_params(**options) ⇒ Hash
The filters for the current action.
-
#filtered? ⇒ Boolean
Whether the current action is filtered.
Methods included from Warped::Controllers::Filterable
#current_action_filter_values, #current_action_filters, #parse_filter_params
Instance Method Details
#filter ⇒ Object
17 18 19 20 21 |
# File 'lib/warped/controllers/filterable/ui.rb', line 17 def filter(...) @filtered = true super end |
#filter_url_params(**options) ⇒ Hash
Returns The filters for the current action.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/warped/controllers/filterable/ui.rb', line 29 def filter_url_params(**) url_params = {} current_action_filter_values.each_with_object(url_params) do |filter_value, hsh| if filter_value.value.is_a?(Array) filter_value.value.each { |value| hsh["#{filter_value.parameter_name}[]"] = value } else hsh[filter_value.parameter_name] = filter_value.value end hsh["#{filter_value.parameter_name}.rel"] = filter_value.relation end url_params.merge!() end |
#filtered? ⇒ Boolean
Returns Whether the current action is filtered.
24 25 26 |
# File 'lib/warped/controllers/filterable/ui.rb', line 24 def filtered? @filtered ||= false end |