Module: SortingPreference

Includes:
CookiesHelper, SortingHelper
Included in:
Dashboard::ProjectsController, Explore::ProjectsController, Groups::ApplicationController, IssuableCollections
Defined in:
app/controllers/concerns/sorting_preference.rb

Constant Summary

Constants included from CookiesHelper

CookiesHelper::COOKIE_TYPE_ENCRYPTED, CookiesHelper::COOKIE_TYPE_PERMANENT

Instance Method Summary collapse

Methods included from CookiesHelper

#set_secure_cookie

Methods included from SortingHelper

#admin_groups_sort_options_hash, #audit_logs_sort_order_hash, #branches_sort_options_hash, #groups_sort_options_hash, #issuable_reverse_sort_order_hash, #issuable_sort_direction_button, #issuable_sort_option_overrides, #issuable_sort_option_title, #label_sort_options_hash, #member_sort_options_hash, #milestone_sort_options_hash, #packages_reverse_sort_order_hash, #packages_sort_direction_button, #packages_sort_option_title, #packages_sort_options_hash, #project_sort_direction_button, #projects_reverse_sort_options_hash, #projects_sort_option_titles, #projects_sort_options_hash, #search_reverse_sort_options_hash, #search_sort_direction_button, #search_sort_option_title, #sort_direction_button, #sort_direction_icon, #sort_options_hash, #sort_title_access_level_asc, #sort_title_access_level_desc, #sort_title_contacted_date, #sort_title_created_date, #sort_title_downvotes, #sort_title_due_date, #sort_title_due_date_later, #sort_title_due_date_soon, #sort_title_expire_date, #sort_title_label_priority, #sort_title_largest_group, #sort_title_largest_repo, #sort_title_last_joined, #sort_title_latest_activity, #sort_title_milestone, #sort_title_milestone_later, #sort_title_milestone_soon, #sort_title_most_stars, #sort_title_name, #sort_title_name_asc, #sort_title_name_desc, #sort_title_oldest_activity, #sort_title_oldest_created, #sort_title_oldest_joined, #sort_title_oldest_last_activity, #sort_title_oldest_signin, #sort_title_oldest_starred, #sort_title_oldest_updated, #sort_title_popularity, #sort_title_priority, #sort_title_recently_created, #sort_title_recently_last_activity, #sort_title_recently_signin, #sort_title_recently_starred, #sort_title_recently_updated, #sort_title_relative_position, #sort_title_relevant, #sort_title_size, #sort_title_stars, #sort_title_start_date_later, #sort_title_start_date_soon, #sort_title_upvotes, #sort_value_access_level_asc, #sort_value_access_level_desc, #sort_value_contacted_date, #sort_value_created_date, #sort_value_downvotes, #sort_value_due_date, #sort_value_due_date_later, #sort_value_due_date_soon, #sort_value_expire_date, #sort_value_label_priority, #sort_value_largest_group, #sort_value_largest_repo, #sort_value_last_joined, #sort_value_latest_activity, #sort_value_least_popular, #sort_value_milestone, #sort_value_milestone_later, #sort_value_milestone_soon, #sort_value_most_popular, #sort_value_name, #sort_value_name_desc, #sort_value_oldest_activity, #sort_value_oldest_created, #sort_value_oldest_joined, #sort_value_oldest_last_activity, #sort_value_oldest_signin, #sort_value_oldest_updated, #sort_value_popularity, #sort_value_priority, #sort_value_recently_created, #sort_value_recently_last_activity, #sort_value_recently_signin, #sort_value_recently_updated, #sort_value_relative_position, #sort_value_relevant, #sort_value_size, #sort_value_stars_asc, #sort_value_stars_desc, #sort_value_start_date_later, #sort_value_start_date_soon, #sort_value_upvotes, #sortable_item, #starrers_sort_options_hash, #subgroups_sort_options_hash, #tags_sort_options_hash, #users_sort_options_hash

Instance Method Details

#default_sort_orderObject

Implement default_sort_order method on controllers to choose which default sort should be applied if sort param is not provided.


23
24
25
# File 'app/controllers/concerns/sorting_preference.rb', line 23

def default_sort_order
  nil
end

Implement legacy_sort_cookie_name method on controllers to set sort from cookie for backwards compatibility.


29
30
31
# File 'app/controllers/concerns/sorting_preference.rb', line 29

def legacy_sort_cookie_name
  nil
end

#set_sort_order(field = sorting_field, default_order = default_sort_order) ⇒ Object


7
8
9
10
11
12
# File 'app/controllers/concerns/sorting_preference.rb', line 7

def set_sort_order(field = sorting_field, default_order = default_sort_order)
  set_sort_order_from_user_preference(field) ||
    set_sort_order_from_cookie(field) ||
    params[:sort] ||
    default_order
end

#sorting_fieldObject

Implement sorting_field method on controllers to choose which column to store the sorting parameter.


16
17
18
# File 'app/controllers/concerns/sorting_preference.rb', line 16

def sorting_field
  nil
end