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
2330 2330
  margin-bottom: -1px;
2331 2331
  font-weight: bold;
2332 2332
}
2333
.reaction-button.has-reactions .icon-svg {
2334
  stroke-width: 2.0;
2335
}
2333 2336
.reaction-button.readonly {
2334 2337
  cursor: default;
2335 2338
}
app/helpers/reactions_helper.rb
55 55
        sprite_icon('thumb-up-filled', count.nonzero?, style: :filled),
56 56
        reaction_path(reaction, object_type: object.class.name, object_id: object),
57 57
        remote: true, method: :delete,
58
        class: ['icon', 'reaction-button', 'reacted'],
58
        class: ['icon', 'reaction-button', 'reacted', { 'has-reactions': count.nonzero? }],
59 59
        title: tooltip
60 60
      )
61 61
    end
......
67 67
        sprite_icon('thumb-up', count.nonzero?),
68 68
        reactions_path(object_type: object.class.name, object_id: object),
69 69
        remote: true, method: :post,
70
        class: 'icon reaction-button',
70
        class: ['icon', 'reaction-button', { 'has-reactions': count.nonzero? }],
71 71
        title: tooltip
72 72
      )
73 73
    end
......
75 75

  
76 76
  def reaction_button_readonly(object, count, tooltip)
77 77
    reaction_button_wrapper object do
78
      tag.span(class: 'icon reaction-button readonly', title: tooltip) do
78
      tag.span(class: ['icon', 'reaction-button', 'readonly', { 'has-reactions': count.nonzero? }], title: tooltip) do
79 79
        sprite_icon('thumb-up', count.nonzero?)
80 80
      end
81 81
    end
test/helpers/reactions_helper_test.rb
202 202
    end
203 203
  end
204 204

  
205
  test 'reaction_button with reactions should have .has-reactions class' do
206
    assert_select_in reaction_button(issues(:issues_001)), 'a.reaction-button.has-reactions'
207
    # issues_002 has no reactions
208
    assert_select_in reaction_button(issues(:issues_002)), 'a.reaction-button:not(.has-reactions)'
209
  end
210

  
205 211
  private
206 212

  
207 213
  def build_reactions(count)
(27-27/30)