Project

General

Profile

Feature #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
<path d="M12 16m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"/>
<path d="M8 11v-5a4 4 0 0 1 8 0"/>
</symbol>
<symbol viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" id="icon--unwatch">
<path d="M10.585 10.587a2 2 0 0 0 2.829 2.828"/>
<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"/>
<path d="M3 3l18 18"/>
</symbol>
<symbol viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" id="icon--user">
<path d="M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0"/>
<path d="M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2"/>
......
<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"/>
<path d="M12 16h.01"/>
</symbol>
<symbol viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" id="icon--watch">
<path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0"/>
<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"/>
</symbol>
<symbol viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" id="icon--wiki-page">
<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"/>
<path d="M13 8l2 0"/>
app/assets/stylesheets/application.css
display: none;
}
.icon-fav svg.icon-svg {
fill: #ffc400;
stroke: #ffc400;
}
svg.icon-svg {
stroke: #169;
fill: none;
app/helpers/watchers_helper.rb
watched = Watcher.any_watched?(objects, user)
css = [watcher_css(objects), watched ? 'icon icon-fav' : 'icon icon-fav-off'].join(' ')
icon = watched ? 'unwatch' : 'watch'
text = watched ? l(:button_unwatch) : l(:button_watch)
url = watch_path(
:object_type => objects.first.class.to_s.underscore,
......
)
method = watched ? 'delete' : 'post'
link_to sprite_icon('fav', text), url, :remote => true, :method => method, :class => css
link_to sprite_icon(icon, text), url, :remote => true, :method => method, :class => css
end
# Returns the css class used to identify watch links for a given +object+
config/icon_source.yml
svg: square-rounded-plus
- name: toggle-minus
svg: square-rounded-minus
- name: watch
svg: eye
- name: unwatch
svg: eye-off
test/helpers/watchers_helper_test.rb
test '#watcher_link with a non-watched object' do
expected = link_to(
sprite_icon("fav", "Watch"),
sprite_icon("watch", "Watch"),
"/watchers/watch?object_id=1&object_type=issue",
:remote => true, :method => 'post', :class => "issue-1-watcher icon icon-fav-off"
)
......
test '#watcher_link with a single object array' do
expected = link_to(
sprite_icon("fav", "Watch"),
sprite_icon("watch", "Watch"),
"/watchers/watch?object_id=1&object_type=issue",
:remote => true, :method => 'post', :class => "issue-1-watcher icon icon-fav-off"
)
......
test '#watcher_link with a multiple objects array' do
expected = link_to(
sprite_icon("fav", "Watch"),
sprite_icon("watch", "Watch"),
"/watchers/watch?object_id%5B%5D=1&object_id%5B%5D=3&object_type=issue",
:remote => true, :method => 'post', :class => "issue-bulk-watcher icon icon-fav-off"
)
......
Watcher.create!(:watchable => Issue.find(1), :user => User.find(1))
expected = link_to(
sprite_icon("fav", "Unwatch"),
sprite_icon("unwatch", "Unwatch"),
"/watchers/watch?object_id=1&object_type=issue",
:remote => true, :method => 'delete', :class => "issue-1-watcher icon icon-fav"
)
(7-7/7)