mirror of
https://github.com/redmine/redmine.git
synced 2025-10-26 07:46:17 +01:00
Improve consistency and visibility of reaction buttons with reactions (#42630).
Patch by Katsuya HIDAKA (user:hidakatsuya). git-svn-id: https://svn.redmine.org/redmine/trunk@23980 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -2330,6 +2330,9 @@ span[role="img"].avatar.s50 {
|
||||
margin-bottom: -1px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.reaction-button.has-reactions .icon-svg {
|
||||
stroke-width: 2.0;
|
||||
}
|
||||
.reaction-button.readonly {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ module ReactionsHelper
|
||||
sprite_icon('thumb-up-filled', count.nonzero?, style: :filled),
|
||||
reaction_path(reaction, object_type: object.class.name, object_id: object),
|
||||
remote: true, method: :delete,
|
||||
class: ['icon', 'reaction-button', 'reacted'],
|
||||
class: ['icon', 'reaction-button', 'reacted', { 'has-reactions': count.nonzero? }],
|
||||
title: tooltip
|
||||
)
|
||||
end
|
||||
@@ -67,7 +67,7 @@ module ReactionsHelper
|
||||
sprite_icon('thumb-up', count.nonzero?),
|
||||
reactions_path(object_type: object.class.name, object_id: object),
|
||||
remote: true, method: :post,
|
||||
class: 'icon reaction-button',
|
||||
class: ['icon', 'reaction-button', { 'has-reactions': count.nonzero? }],
|
||||
title: tooltip
|
||||
)
|
||||
end
|
||||
@@ -75,7 +75,7 @@ module ReactionsHelper
|
||||
|
||||
def reaction_button_readonly(object, count, tooltip)
|
||||
reaction_button_wrapper object do
|
||||
tag.span(class: 'icon reaction-button readonly', title: tooltip) do
|
||||
tag.span(class: ['icon', 'reaction-button', 'readonly', { 'has-reactions': count.nonzero? }], title: tooltip) do
|
||||
sprite_icon('thumb-up', count.nonzero?)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -202,6 +202,12 @@ class ReactionsHelperTest < ActionView::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
test 'reaction_button with reactions should have .has-reactions class' do
|
||||
assert_select_in reaction_button(issues(:issues_001)), 'a.reaction-button.has-reactions'
|
||||
# issues_002 has no reactions
|
||||
assert_select_in reaction_button(issues(:issues_002)), 'a.reaction-button:not(.has-reactions)'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def build_reactions(count)
|
||||
|
||||
Reference in New Issue
Block a user