Project

General

Profile

Feature #31531 » 0001-Change-the-quote-icon-to-filled-quote-icon.patch

Mizuki ISHIKAWA, 2025-03-03 08:20

View differences:

app/assets/images/icons.svg
322 322
      <path d="M7 5.03v5.455"/>
323 323
      <path d="M12 8l5 -3"/>
324 324
    </symbol>
325
    <symbol viewBox="0 0 24 24" id="icon--quote">
326
      <path d="M9 5a2 2 0 0 1 2 2v6c0 3.13 -1.65 5.193 -4.757 5.97a1 1 0 1 1 -.486 -1.94c2.227 -.557 3.243 -1.827 3.243 -4.03v-1h-3a2 2 0 0 1 -1.995 -1.85l-.005 -.15v-3a2 2 0 0 1 2 -2z"/>
327
      <path d="M18 5a2 2 0 0 1 2 2v6c0 3.13 -1.65 5.193 -4.757 5.97a1 1 0 1 1 -.486 -1.94c2.227 -.557 3.243 -1.827 3.243 -4.03v-1h-3a2 2 0 0 1 -1.995 -1.85l-.005 -.15v-3a2 2 0 0 1 2 -2z"/>
328
    </symbol>
325 329
    <symbol viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" id="icon--reload">
326 330
      <path d="M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4"/>
327 331
      <path d="M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/>
app/assets/stylesheets/application.css
1789 1789
  vertical-align: middle;
1790 1790
}
1791 1791

  
1792
svg.icon-svg.filled {
1793
  fill: #169;
1794
}
1795

  
1792 1796
svg.s20 {
1793 1797
  width: 1.25rem;
1794 1798
  height: 1.25rem;
app/helpers/icons_helper.rb
21 21
  DEFAULT_ICON_SIZE = "18"
22 22
  DEFAULT_SPRITE = "icons"
23 23

  
24
  def sprite_icon(icon_name, label = nil, icon_only: false, size: DEFAULT_ICON_SIZE, css_class: nil, sprite: DEFAULT_SPRITE, plugin: nil)
24
  def sprite_icon(icon_name, label = nil, icon_only: false, size: DEFAULT_ICON_SIZE, css_class: nil, sprite: DEFAULT_SPRITE, icon_style: :outline, plugin: nil)
25 25
    sprite = plugin ? "plugin_assets/#{plugin}/#{sprite}.svg" : "#{sprite}.svg"
26 26

  
27
    svg_icon = svg_sprite_icon(icon_name, size: size, css_class: css_class, sprite: sprite)
27
    svg_icon = svg_sprite_icon(icon_name, size: size, css_class: css_class, sprite: sprite, icon_style: icon_style)
28 28

  
29 29
    if label
30 30
      label_classes = ["icon-label"]
......
69 69

  
70 70
  private
71 71

  
72
  def svg_sprite_icon(icon_name, size: DEFAULT_ICON_SIZE, sprite: DEFAULT_SPRITE, css_class: nil)
72
  def svg_sprite_icon(icon_name, size: DEFAULT_ICON_SIZE, sprite: DEFAULT_SPRITE, css_class: nil, icon_style: :outline)
73 73
    css_classes = "s#{size} icon-svg"
74
    css_classes += " filled" if icon_style == :filled
74 75
    css_classes += " #{css_class}" unless css_class.nil?
75 76

  
76 77
    content_tag(
config/icon_source.yml
209 209
  svg: square-rounded-plus
210 210
- name: toggle-minus
211 211
  svg: square-rounded-minus
212
- name: quote
213
  svg: quote
214
  style: filled
lib/redmine/quote_reply.rb
27 27
      def quote_reply(url, selector_for_content, icon_only: false)
28 28
        quote_reply_function = "quoteReply('#{j url}', '#{j selector_for_content}', '#{j Setting.text_formatting}')"
29 29

  
30
        html_options = { class: 'icon icon-comment' }
30
        html_options = { class: 'icon icon-quote' }
31 31
        html_options[:title] = l(:button_quote) if icon_only
32 32

  
33 33
        link_to_function(
34
          sprite_icon('comment', l(:button_quote), icon_only: icon_only),
34
          sprite_icon('quote', l(:button_quote), icon_only: icon_only, icon_style: :filled),
35 35
          quote_reply_function,
36 36
          html_options
37 37
        )
lib/tasks/icons.rake
16 16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17 17

  
18 18
unless Rails.env.production?
19
  ICON_RELEASE_VERSION = "v3.19.0"
19
  ICON_RELEASE_VERSION = "v3.30.0"
20 20
  ICON_DEFAULT_STYLE = "outline"
21 21
  SOURCE = URI.parse("https://raw.githubusercontent.com/tabler/tabler-icons/#{ICON_RELEASE_VERSION}/icons")
22 22

  
test/helpers/icons_helper_test.rb
71 71
    assert_match expected, icon
72 72
  end
73 73

  
74
  def test_sprite_icon_should_return_svg_with_filled_class_when_icon_style_is_filled
75
    expected = %r{<svg class="s18 icon-svg filled" aria-hidden="true"><use href="/assets/icons-\w+.svg#icon--edit"></use></svg>$}
76
    icon = sprite_icon('edit', icon_style: :filled)
77

  
78
    assert_match expected, icon
79
  end
80

  
74 81
  def test_file_icon_should_return_folder_icon_for_directory
75 82
    entry = stub(:is_dir? => true)
76 83
    expected = %r{<svg class="s18 icon-svg" aria-hidden="true"><use href="/assets/icons-\w+.svg#icon--folder"></use></svg><span class="icon-label">folder_name</span>}
test/helpers/journals_helper_test.rb
47 47
    journals = issue.visible_journals_with_index # add indice
48 48
    journal_actions = render_journal_actions(issue, journals.first, {reply_links: true})
49 49

  
50
    assert_select_in journal_actions, 'a[title=?][class="icon icon-comment"]', 'Quote'
50
    assert_select_in journal_actions, 'a[title=?][class="icon icon-quote"]', 'Quote'
51 51
    assert_select_in journal_actions, 'a[title=?][class="icon-only icon-edit"]', 'Edit'
52 52
    assert_select_in journal_actions, 'div[class="drdn-items"] a[class="icon icon-del"]'
53 53
    assert_select_in journal_actions, 'div[class="drdn-items"] a[class="icon icon-copy-link"]'
test/unit/lib/redmine/quote_reply_helper_test.rb
29 29

  
30 30
      a_tag = quote_reply(url, '#issue_description_wiki')
31 31
      assert_includes a_tag, %|onclick="#{h "quoteReply('/issues/1/quoted', '#issue_description_wiki', 'common_mark'); return false;"}"|
32
      assert_includes a_tag, %|class="icon icon-comment"|
32
      assert_includes a_tag, %|class="icon icon-quote"|
33 33
      assert_not_includes a_tag, 'title='
34 34

  
35 35
      # When icon_only is true
(6-6/8)