Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2016-07-27 00:21:20 +0300
committerFelipe Artur <felipefac@gmail.com>2016-08-19 22:14:20 +0300
commit37bf35f0bcba28e271789542fb8c81a6c77236b6 (patch)
treeaa10aa7fbff70b17f9978cbe4aced667197062d9 /app/finders
parent415159c28da1aec00bb383d46aad67a9de75faae (diff)
Todos sorting dropdown
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/todos_finder.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/finders/todos_finder.rb b/app/finders/todos_finder.rb
index 4fe0070552e..37e919e6cf7 100644
--- a/app/finders/todos_finder.rb
+++ b/app/finders/todos_finder.rb
@@ -33,7 +33,7 @@ class TodosFinder
# the project IDs yielded by the todos query thus far
items = by_project(items)
- items.reorder(id: :desc)
+ sort(items)
end
private
@@ -106,6 +106,10 @@ class TodosFinder
params[:type]
end
+ def sort(items)
+ params[:sort] ? items.sort(params[:sort]) : items.reorder(id: :desc)
+ end
+
def by_action(items)
if action?
items = items.where(action: to_action_id)