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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
20e6e0db
Commit
20e6e0db
authored
May 24, 2016
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle posting emoji only vote +1 and -1 comments.
And remove mutual votes.
parent
b0082bec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
24 deletions
+30
-24
app/assets/javascripts/awards_handler.coffee
app/assets/javascripts/awards_handler.coffee
+30
-24
No files found.
app/assets/javascripts/awards_handler.coffee
View file @
20e6e0db
...
...
@@ -25,26 +25,9 @@ class @AwardsHandler
e
.
preventDefault
()
$emojiBtn
=
$
(
e
.
currentTarget
)
$addAwardBtn
=
$
(
'.js-add-award.is-active'
)
$votesBlock
=
$
(
$addAwardBtn
.
closest
(
'.js-award-holder'
).
data
(
'target'
))
if
$addAwardBtn
.
length
is
0
$votesBlock
=
$emojiBtn
.
closest
(
'.js-awards-block'
)
else
if
$votesBlock
.
length
is
0
$votesBlock
=
$addAwardBtn
.
closest
(
'.js-awards-block'
)
$votesBlock
.
addClass
'js-awards-block'
awardUrl
=
$votesBlock
.
data
'award-url'
emoji
=
$emojiBtn
.
find
(
'.icon'
).
data
(
'emoji'
)
if
emoji
in
[
'thumbsup'
,
'thumbsdown'
]
mutualVote
=
if
emoji
is
'thumbsup'
then
'thumbsdown'
else
'thumbsup'
isAlreadyVoted
=
$
(
"[data-emoji=
#{
mutualVote
}
]"
).
parent
().
hasClass
'active'
@
addAward
awardUrl
,
mutualVote
if
isAlreadyVoted
@
addAward
awardUrl
,
emoji
emoji
=
$
(
e
.
currentTarget
).
find
(
'.icon'
).
data
'emoji'
@
getVotesBlock
().
addClass
'js-awards-block'
@
addAward
@
getAwardUrl
(),
emoji
showEmojiMenu
:
(
$addBtn
)
->
...
...
@@ -105,16 +88,21 @@ class @AwardsHandler
$menu
.
css
(
css
)
addAward
:
(
awardUrl
,
emoji
)
->
addAward
:
(
awardUrl
,
emoji
,
checkMutuality
=
yes
)
->
emoji
=
@
normilizeEmojiName
(
emoji
)
@
postEmoji
awardUrl
,
emoji
,
=>
@
addAwardToEmojiBar
(
emoji
)
@
addAwardToEmojiBar
(
emoji
,
checkMutuality
)
$
(
'.js-awards-block-current'
).
removeClass
'js-awards-block-current'
$
(
".emoji-menu"
).
removeClass
"is-visible"
$
(
'.emoji-menu'
).
removeClass
'is-visible'
addAwardToEmojiBar
:
(
emoji
)
->
addAwardToEmojiBar
:
(
emoji
,
checkForMutuality
=
yes
)
->
@
checkMutuality
emoji
if
checkForMutuality
@
addEmojiToFrequentlyUsedList
(
emoji
)
emoji
=
@
normilizeEmojiName
(
emoji
)
...
...
@@ -131,6 +119,24 @@ class @AwardsHandler
else
@
createEmoji
(
emoji
)
getVotesBlock
:
->
return
$
'.awards.js-awards-block'
getAwardUrl
:
->
@
getVotesBlock
().
data
'award-url'
checkMutuality
:
(
emoji
)
->
awardUrl
=
@
getAwardUrl
()
if
emoji
in
[
'thumbsup'
,
'thumbsdown'
]
mutualVote
=
if
emoji
is
'thumbsup'
then
'thumbsdown'
else
'thumbsup'
isAlreadyVoted
=
$
(
"[data-emoji=
#{
mutualVote
}
]"
).
parent
().
hasClass
'active'
@
addAward
awardUrl
,
mutualVote
,
no
if
isAlreadyVoted
isActive
:
(
$emojiBtn
)
->
$emojiBtn
.
hasClass
(
"active"
)
...
...
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