Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
195dc3a7
Commit
195dc3a7
authored
Dec 25, 2015
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add sorting of awards
parent
a1b63e12
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
2 deletions
+21
-2
app/helpers/issues_helper.rb
app/helpers/issues_helper.rb
+12
-0
app/views/votes/_votes_block.html.haml
app/views/votes/_votes_block.html.haml
+1
-1
features/steps/project/issues/award_emoji.rb
features/steps/project/issues/award_emoji.rb
+1
-1
spec/helpers/issues_helper_spec.rb
spec/helpers/issues_helper_spec.rb
+7
-0
No files found.
app/helpers/issues_helper.rb
View file @
195dc3a7
...
...
@@ -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
app/views/votes/_votes_block.html.haml
View file @
195dc3a7
.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
...
...
features/steps/project/issues/award_emoji.rb
View file @
195dc3a7
...
...
@@ -37,7 +37,7 @@ class Spinach::Features::AwardEmoji < Spinach::FeatureSteps
step
'I have award added'
do
page
.
within
'.awards'
do
expect
(
page
).
to
have_selector
'.award'
expect
(
page
.
find
(
'.award .counter'
)).
to
have_content
'1'
expect
(
page
.
find
(
'.award
.active
.counter'
)).
to
have_content
'1'
end
end
...
...
spec/helpers/issues_helper_spec.rb
View file @
195dc3a7
...
...
@@ -141,4 +141,11 @@ describe IssuesHelper do
expect
(
note_active_class
(
Note
.
all
,
@note
.
author
)).
to
eq
(
"active"
)
end
end
describe
"#awards_sort"
do
it
"sorts a hash so thumbsup and thumbsdown are always on top"
do
data
=
{
"thumbsdown"
=>
"some value"
,
"lifter"
=>
"some value"
,
"thumbsup"
=>
"some value"
}
expect
(
awards_sort
(
data
).
keys
).
to
eq
([
"thumbsup"
,
"thumbsdown"
,
"lifter"
])
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment