diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-09-10 14:38:29 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-09-10 15:34:36 +0300 |
commit | 8d19f4b4a610d4c26c685c5069b91c6636590c76 (patch) | |
tree | b0256eab186c65f9c8b68c2b166acdfe4500f747 /app/models/label.rb | |
parent | a5517ada119a0e73e0a70fd18e11fda3932138e8 (diff) |
Add sort dropdown to project labels page and group labels page
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models/label.rb')
-rw-r--r-- | app/models/label.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/label.rb b/app/models/label.rb index 8db7c3abd10..8dc7ded53ad 100644 --- a/app/models/label.rb +++ b/app/models/label.rb @@ -6,6 +6,7 @@ class Label < ActiveRecord::Base include Subscribable include Gitlab::SQL::Pattern include OptionallySearch + include Sortable # Represents a "No Label" state used for filtering Issues and Merge # Requests that have no label assigned. @@ -41,6 +42,8 @@ class Label < ActiveRecord::Base scope :with_lists_and_board, -> { joins(lists: :board).merge(List.movable) } scope :on_group_boards, ->(group_id) { with_lists_and_board.where(boards: { group_id: group_id }) } scope :on_project_boards, ->(project_id) { with_lists_and_board.where(boards: { project_id: project_id }) } + scope :order_name_asc, -> { reorder(title: :asc) } + scope :order_name_desc, -> { reorder(title: :desc) } def self.prioritized(project) joins(:priorities) |