diff options
author | Valery Sizov <vsv2711@gmail.com> | 2015-12-25 12:08:53 +0200 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2015-12-25 14:11:19 +0200 |
commit | 195dc3a7461468b060b9a9c6860aca37cebc9d8d (patch) | |
tree | a64253586d1da0f277fc75a101d199c607d291e1 /app | |
parent | a1b63e12526c069a8754b5e64deb9eb15668832a (diff) | |
download | gitlab-ce-195dc3a7461468b060b9a9c6860aca37cebc9d8d.tar.gz |
add sorting of awards
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/issues_helper.rb | 12 | ||||
-rw-r--r-- | app/views/votes/_votes_block.html.haml | 2 |
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 |