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
b95c9217
Commit
b95c9217
authored
Apr 01, 2016
by
Arinde Eniola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prevent users from being able to both upvote and downvote
parent
593972ca
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
app/assets/javascripts/awards_handler.coffee
app/assets/javascripts/awards_handler.coffee
+13
-2
app/views/votes/_votes_block.html.haml
app/views/votes/_votes_block.html.haml
+1
-1
No files found.
app/assets/javascripts/awards_handler.coffee
View file @
b95c9217
...
@@ -22,8 +22,19 @@ class @AwardsHandler
...
@@ -22,8 +22,19 @@ class @AwardsHandler
emoji
=
$
(
this
)
emoji
=
$
(
this
)
.
find
(
".icon"
)
.
find
(
".icon"
)
.
data
"emoji"
.
data
"emoji"
if
emoji
is
"thumbsup"
and
awards_handler
.
didUserClickEmoji
$
(
this
),
"thumbsdown"
awards_handler
.
addAward
"thumbsdown"
else
if
emoji
is
"thumbsdown"
and
awards_handler
.
didUserClickEmoji
$
(
this
),
"thumbsup"
awards_handler
.
addAward
"thumbsup"
awards_handler
.
addAward
emoji
awards_handler
.
addAward
emoji
didUserClickEmoji
:
(
that
,
emoji
)
->
if
$
(
that
).
siblings
(
"button:has([data-emoji=
#{
emoji
}
])"
).
attr
(
"data-original-title"
)
$
(
that
).
siblings
(
"button:has([data-emoji=
#{
emoji
}
])"
).
attr
(
"data-original-title"
).
indexOf
(
'me'
)
>
-
1
showEmojiMenu
:
->
showEmojiMenu
:
->
if
$
(
".emoji-menu"
).
length
if
$
(
".emoji-menu"
).
length
if
$
(
".emoji-menu"
).
is
".is-visible"
if
$
(
".emoji-menu"
).
is
".is-visible"
...
@@ -105,7 +116,7 @@ class @AwardsHandler
...
@@ -105,7 +116,7 @@ class @AwardsHandler
if
origTitle
if
origTitle
authors
=
origTitle
.
split
(
', '
)
authors
=
origTitle
.
split
(
', '
)
authors
.
push
(
"me"
)
authors
.
push
(
"me"
)
award_block
.
attr
(
"title"
,
authors
.
join
(
", "
))
award_block
.
attr
(
"
data-original-
title"
,
authors
.
join
(
", "
))
@
resetTooltip
(
award_block
)
@
resetTooltip
(
award_block
)
resetTooltip
:
(
award
)
->
resetTooltip
:
(
award
)
->
...
@@ -122,7 +133,7 @@ class @AwardsHandler
...
@@ -122,7 +133,7 @@ class @AwardsHandler
nodes
=
[]
nodes
=
[]
nodes
.
push
(
nodes
.
push
(
"<button class='btn award-control js-emoji-btn has-tooltip active' title='me'>"
,
"<button class='btn award-control js-emoji-btn has-tooltip active'
data-original-
title='me'>"
,
"<div class='icon emoji-icon
#{
emojiCssClass
}
' data-emoji='
#{
emoji
}
'></div>"
,
"<div class='icon emoji-icon
#{
emojiCssClass
}
' data-emoji='
#{
emoji
}
'></div>"
,
"<span class='award-control-text js-counter'>1</span>"
,
"<span class='award-control-text js-counter'>1</span>"
,
"</button>"
"</button>"
...
...
app/views/votes/_votes_block.html.haml
View file @
b95c9217
.awards.votes-block
.awards.votes-block
-
awards_sort
(
votable
.
notes
.
awards
.
grouped_awards
).
each
do
|
emoji
,
notes
|
-
awards_sort
(
votable
.
notes
.
awards
.
grouped_awards
).
each
do
|
emoji
,
notes
|
%button
.btn.award-control.js-emoji-btn.has-tooltip
{
class:
(
note_active_class
(
notes
,
current_user
)),
title:
emoji_author_list
(
notes
,
current_user
),
data:
{
placement:
"top"
}}
%button
.btn.award-control.js-emoji-btn.has-tooltip
{
class:
(
note_active_class
(
notes
,
current_user
)),
data:
{
placement:
"top"
,
original_title:
emoji_author_list
(
notes
,
current_user
)
}}
=
emoji_icon
(
emoji
,
sprite:
false
)
=
emoji_icon
(
emoji
,
sprite:
false
)
%span
.award-control-text.js-counter
%span
.award-control-text.js-counter
=
notes
.
count
=
notes
.
count
...
...
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