Module: Warped::Controllers::Sortable::Ui
- Extended by:
- ActiveSupport::Concern
- Includes:
- Warped::Controllers::Sortable
- Included in:
- Tabulatable::Ui
- Defined in:
- lib/warped/controllers/sortable/ui.rb
Instance Method Summary collapse
- #sort ⇒ Object
-
#sort_url_params(**options) ⇒ Hash
The sort_url_params.
-
#sortable_field?(parameter_name) ⇒ Boolean
Whether the parameter_name is sortable.
-
#sorted? ⇒ Boolean
Whether the current action is sorted.
- #sorted_field?(parameter_name) ⇒ Boolean
Methods included from Warped::Controllers::Sortable
Instance Method Details
#sort ⇒ Object
19 20 21 22 23 |
# File 'lib/warped/controllers/sortable/ui.rb', line 19 def sort(...) @sorted = true super end |
#sort_url_params(**options) ⇒ Hash
Returns The sort_url_params.
43 44 45 46 47 48 49 |
# File 'lib/warped/controllers/sortable/ui.rb', line 43 def sort_url_params(**) url_params = { sort_key: current_action_sort_value.parameter_name, sort_direction: current_action_sort_value.direction } url_params.merge!() end |
#sortable_field?(parameter_name) ⇒ Boolean
Returns Whether the parameter_name is sortable.
33 34 35 |
# File 'lib/warped/controllers/sortable/ui.rb', line 33 def sortable_field?(parameter_name) current_action_sorts.any? { |sort| sort.parameter_name == parameter_name.to_s } end |
#sorted? ⇒ Boolean
Returns Whether the current action is sorted.
38 39 40 |
# File 'lib/warped/controllers/sortable/ui.rb', line 38 def sorted? @sorted ||= false end |
#sorted_field?(parameter_name) ⇒ Boolean
27 28 29 |
# File 'lib/warped/controllers/sortable/ui.rb', line 27 def sorted_field?(parameter_name) current_action_sort_value.parameter_name == parameter_name.to_s end |