Module: Sidekiq::Tasks::Web::Helpers::SortHelper

Extended by:
SortHelper
Included in:
SortHelper
Defined in:
lib/sidekiq/tasks/web/helpers/sort_helper.rb

Instance Method Summary collapse

Instance Method Details

#sort_header_classes(search, column) ⇒ Object



17
18
19
20
21
# File 'lib/sidekiq/tasks/web/helpers/sort_helper.rb', line 17

def sort_header_classes(search, column)
  css = "st-sortable"
  css += " st-sorted-#{search.direction}" if search.sorted_by?(column)
  css
end

#sort_header_url(search, root_path, column) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/sidekiq/tasks/web/helpers/sort_helper.rb', line 8

def sort_header_url(search, root_path, column)
  next_direction = search.toggle_direction(column)

  query_params = {filter: search.filter.to_s, count: search.count}
  query_params.merge!(sort: column, direction: next_direction) if next_direction

  "#{root_path}tasks?#{URI.encode_www_form(query_params)}"
end