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
dbe0d0fb
Commit
dbe0d0fb
authored
Dec 30, 2016
by
Sam Rose
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable award emoji button but display tooltip
parent
8dc2163c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
10 deletions
+23
-10
app/assets/stylesheets/framework/awards.scss
app/assets/stylesheets/framework/awards.scss
+13
-1
app/helpers/issues_helper.rb
app/helpers/issues_helper.rb
+4
-2
app/views/award_emoji/_awards_block.html.haml
app/views/award_emoji/_awards_block.html.haml
+1
-2
spec/features/issues/award_emoji_spec.rb
spec/features/issues/award_emoji_spec.rb
+1
-1
spec/helpers/issues_helper_spec.rb
spec/helpers/issues_helper_spec.rb
+4
-4
No files found.
app/assets/stylesheets/framework/awards.scss
View file @
dbe0d0fb
...
...
@@ -97,8 +97,20 @@
padding
:
5px
6px
;
outline
:
0
;
&
:hover
,
&
.disabled
{
cursor
:
default
;
&
:hover
,
&
:focus
,
&
:active
{
background-color
:
$white-light
;
border-color
:
$border-color
;
box-shadow
:
none
;
}
}
&
.active
,
&
:hover
,
&
:active
{
background-color
:
$row-hover
;
border-color
:
$row-hover-border
;
...
...
app/helpers/issues_helper.rb
View file @
dbe0d0fb
...
...
@@ -128,8 +128,10 @@ module IssuesHelper
names
.
to_sentence
end
def
award_active_class
(
awards
,
current_user
)
if
current_user
&&
awards
.
find
{
|
a
|
a
.
user_id
==
current_user
.
id
}
def
award_state_class
(
awards
,
current_user
)
if
!
current_user
"disabled"
elsif
current_user
&&
awards
.
find
{
|
a
|
a
.
user_id
==
current_user
.
id
}
"active"
else
""
...
...
app/views/award_emoji/_awards_block.html.haml
View file @
dbe0d0fb
...
...
@@ -2,8 +2,7 @@
.awards.js-awards-block
{
class:
(
"hidden"
if
!
inline
&&
grouped_emojis
.
empty?
),
data:
{
award_url:
toggle_award_url
(
awardable
)
}
}
-
awards_sort
(
grouped_emojis
).
each
do
|
emoji
,
awards
|
%button
.btn.award-control.js-emoji-btn.has-tooltip
{
type:
"button"
,
disabled:
!
current_user
,
class:
(
award_active_class
(
awards
,
current_user
)),
class:
(
award_state_class
(
awards
,
current_user
)),
data:
{
placement:
"bottom"
,
title:
award_user_list
(
awards
,
current_user
)
}
}
=
emoji_icon
(
emoji
,
sprite:
false
)
%span
.award-control-text.js-counter
...
...
spec/features/issues/award_emoji_spec.rb
View file @
dbe0d0fb
...
...
@@ -76,7 +76,7 @@ describe 'Awards Emoji', feature: true do
end
it
'has disabled emoji button'
do
expect
(
first
(
'.award-control'
)[
:
disabled
]).
to
be
(
true
)
expect
(
first
(
'.award-control'
)[
:
class
]).
to
have_text
(
'disabled'
)
end
end
...
...
spec/helpers/issues_helper_spec.rb
View file @
dbe0d0fb
...
...
@@ -98,15 +98,15 @@ describe IssuesHelper do
end
end
describe
'#award_
activ
e_class'
do
describe
'#award_
stat
e_class'
do
let!
(
:upvote
)
{
create
(
:award_emoji
)
}
it
"returns
empty
string for unauthenticated user"
do
expect
(
award_
active_class
(
AwardEmoji
.
all
,
nil
)).
to
eq
(
"
"
)
it
"returns
disabled
string for unauthenticated user"
do
expect
(
award_
state_class
(
AwardEmoji
.
all
,
nil
)).
to
eq
(
"disabled
"
)
end
it
"returns active string for author"
do
expect
(
award_
activ
e_class
(
AwardEmoji
.
all
,
upvote
.
user
)).
to
eq
(
"active"
)
expect
(
award_
stat
e_class
(
AwardEmoji
.
all
,
upvote
.
user
)).
to
eq
(
"active"
)
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