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:
Go MAEDA
2025-09-18 06:36:41 +00:00
parent be78fbb34c
commit f465577b78
3 changed files with 12 additions and 3 deletions

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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)