Project

General

Profile

Feature #42630 » 0001-Improve-consistency-and-visibility-of-reaction-buttons-with-reactions.patch

Katsuya HIDAKA, 2025-09-18 07:47

View differences:

app/assets/stylesheets/application.css
margin-bottom: -1px;
font-weight: bold;
}
.reaction-button.has-reactions .icon-svg {
stroke-width: 2.0;
}
.reaction-button.readonly {
cursor: default;
}
app/helpers/reactions_helper.rb
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
......
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
......
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
test/helpers/reactions_helper_test.rb
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)
(27-27/30)