Project

General

Profile

Patch #42305 » 0001-Changes-issue-watch-button-icon-to-eye-image-to-align-icon-with-function-and-improve-visual-clarity.patch

Katsuya HIDAKA, 2025-02-23 04:24

View differences:

app/assets/images/icons.svg
469 469
      <path d="M12 16m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"/>
470 470
      <path d="M8 11v-5a4 4 0 0 1 8 0"/>
471 471
    </symbol>
472
    <symbol viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" id="icon--unwatch">
473
      <path d="M10.585 10.587a2 2 0 0 0 2.829 2.828"/>
474
      <path d="M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87"/>
475
      <path d="M3 3l18 18"/>
476
    </symbol>
472 477
    <symbol viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" id="icon--user">
473 478
      <path d="M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0"/>
474 479
      <path d="M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2"/>
......
478 483
      <path d="M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636 -2.87l-8.106 -13.536a1.914 1.914 0 0 0 -3.274 0z"/>
479 484
      <path d="M12 16h.01"/>
480 485
    </symbol>
486
    <symbol viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" id="icon--watch">
487
      <path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0"/>
488
      <path d="M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6"/>
489
    </symbol>
481 490
    <symbol viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" id="icon--wiki-page">
482 491
      <path d="M6 4h11a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-11a1 1 0 0 1 -1 -1v-14a1 1 0 0 1 1 -1m3 0v18"/>
483 492
      <path d="M13 8l2 0"/>
app/assets/stylesheets/application.css
1777 1777
  display: none;
1778 1778
}
1779 1779

  
1780
.icon-fav svg.icon-svg {
1781
  fill: #ffc400;
1782
  stroke: #ffc400;
1783
}
1784

  
1785 1780
svg.icon-svg {
1786 1781
  stroke: #169;
1787 1782
  fill: none;
app/helpers/watchers_helper.rb
26 26

  
27 27
    watched = Watcher.any_watched?(objects, user)
28 28
    css = [watcher_css(objects), watched ? 'icon icon-fav' : 'icon icon-fav-off'].join(' ')
29
    icon = watched ? 'unwatch' : 'watch'
29 30
    text = watched ? l(:button_unwatch) : l(:button_watch)
30 31
    url = watch_path(
31 32
      :object_type => objects.first.class.to_s.underscore,
......
33 34
    )
34 35
    method = watched ? 'delete' : 'post'
35 36

  
36
    link_to sprite_icon('fav', text), url, :remote => true, :method => method, :class => css
37
    link_to sprite_icon(icon, text), url, :remote => true, :method => method, :class => css
37 38
  end
38 39

  
39 40
  # Returns the css class used to identify watch links for a given +object+
config/icon_source.yml
209 209
  svg: square-rounded-plus
210 210
- name: toggle-minus
211 211
  svg: square-rounded-minus
212
- name: watch
213
  svg: eye
214
- name: unwatch
215
  svg: eye-off
test/helpers/watchers_helper_test.rb
26 26

  
27 27
  test '#watcher_link with a non-watched object' do
28 28
    expected = link_to(
29
      sprite_icon("fav", "Watch"),
29
      sprite_icon("watch", "Watch"),
30 30
      "/watchers/watch?object_id=1&object_type=issue",
31 31
      :remote => true, :method => 'post', :class => "issue-1-watcher icon icon-fav-off"
32 32
    )
......
35 35

  
36 36
  test '#watcher_link with a single object array' do
37 37
    expected = link_to(
38
      sprite_icon("fav", "Watch"),
38
      sprite_icon("watch", "Watch"),
39 39
      "/watchers/watch?object_id=1&object_type=issue",
40 40
      :remote => true, :method => 'post', :class => "issue-1-watcher icon icon-fav-off"
41 41
    )
......
44 44

  
45 45
  test '#watcher_link with a multiple objects array' do
46 46
    expected = link_to(
47
      sprite_icon("fav", "Watch"),
47
      sprite_icon("watch", "Watch"),
48 48
      "/watchers/watch?object_id%5B%5D=1&object_id%5B%5D=3&object_type=issue",
49 49
      :remote => true, :method => 'post', :class => "issue-bulk-watcher icon icon-fav-off"
50 50
    )
......
59 59
    Watcher.create!(:watchable => Issue.find(1), :user => User.find(1))
60 60

  
61 61
    expected = link_to(
62
      sprite_icon("fav", "Unwatch"),
62
      sprite_icon("unwatch", "Unwatch"),
63 63
      "/watchers/watch?object_id=1&object_type=issue",
64 64
      :remote => true, :method => 'delete', :class => "issue-1-watcher icon icon-fav"
65 65
    )
(7-7/7)