summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorValery Sizov <vsv2711@gmail.com>2015-12-25 12:08:53 +0200
committerValery Sizov <vsv2711@gmail.com>2015-12-25 14:11:19 +0200
commit195dc3a7461468b060b9a9c6860aca37cebc9d8d (patch)
treea64253586d1da0f277fc75a101d199c607d291e1 /app
parenta1b63e12526c069a8754b5e64deb9eb15668832a (diff)
downloadgitlab-ce-195dc3a7461468b060b9a9c6860aca37cebc9d8d.tar.gz
add sorting of awards
Diffstat (limited to 'app')
-rw-r--r--app/helpers/issues_helper.rb12
-rw-r--r--app/views/votes/_votes_block.html.haml2
2 files changed, 13 insertions, 1 deletions
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index 4fe84322199..c1053554fbd 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -120,6 +120,18 @@ module IssuesHelper
end
end
+ def awards_sort(awards)
+ awards.sort_by do |award, notes|
+ if award == "thumbsup"
+ 0
+ elsif award == "thumbsdown"
+ 1
+ else
+ 2
+ end
+ end.to_h
+ end
+
# Required for Banzai::Filter::IssueReferenceFilter
module_function :url_for_issue
end
diff --git a/app/views/votes/_votes_block.html.haml b/app/views/votes/_votes_block.html.haml
index e16187bb42f..ce0a0113403 100644
--- a/app/views/votes/_votes_block.html.haml
+++ b/app/views/votes/_votes_block.html.haml
@@ -1,5 +1,5 @@
.awards.votes-block
- - votable.notes.awards.grouped_awards.each do |emoji, notes|
+ - awards_sort(votable.notes.awards.grouped_awards).each do |emoji, notes|
.award{class: (note_active_class(notes, current_user)), title: emoji_author_list(notes, current_user)}
= emoji_icon(emoji)
.counter