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
<path d="M7 5.03v5.455"/>
<path d="M12 8l5 -3"/>
</symbol>
<symbol viewBox="0 0 24 24" id="icon--quote">
<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"/>
<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"/>
</symbol>
<symbol viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" id="icon--reload">
<path d="M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4"/>
<path d="M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/>
app/assets/stylesheets/application.css
vertical-align: middle;
}
svg.icon-svg.filled {
fill: #169;
}
svg.s20 {
width: 1.25rem;
height: 1.25rem;
app/helpers/icons_helper.rb
DEFAULT_ICON_SIZE = "18"
DEFAULT_SPRITE = "icons"
def sprite_icon(icon_name, label = nil, icon_only: false, size: DEFAULT_ICON_SIZE, css_class: nil, sprite: DEFAULT_SPRITE, plugin: nil)
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)
sprite = plugin ? "plugin_assets/#{plugin}/#{sprite}.svg" : "#{sprite}.svg"
svg_icon = svg_sprite_icon(icon_name, size: size, css_class: css_class, sprite: sprite)
svg_icon = svg_sprite_icon(icon_name, size: size, css_class: css_class, sprite: sprite, icon_style: icon_style)
if label
label_classes = ["icon-label"]
......
private
def svg_sprite_icon(icon_name, size: DEFAULT_ICON_SIZE, sprite: DEFAULT_SPRITE, css_class: nil)
def svg_sprite_icon(icon_name, size: DEFAULT_ICON_SIZE, sprite: DEFAULT_SPRITE, css_class: nil, icon_style: :outline)
css_classes = "s#{size} icon-svg"
css_classes += " filled" if icon_style == :filled
css_classes += " #{css_class}" unless css_class.nil?
content_tag(
config/icon_source.yml
svg: square-rounded-plus
- name: toggle-minus
svg: square-rounded-minus
- name: quote
svg: quote
style: filled
lib/redmine/quote_reply.rb
def quote_reply(url, selector_for_content, icon_only: false)
quote_reply_function = "quoteReply('#{j url}', '#{j selector_for_content}', '#{j Setting.text_formatting}')"
html_options = { class: 'icon icon-comment' }
html_options = { class: 'icon icon-quote' }
html_options[:title] = l(:button_quote) if icon_only
link_to_function(
sprite_icon('comment', l(:button_quote), icon_only: icon_only),
sprite_icon('quote', l(:button_quote), icon_only: icon_only, icon_style: :filled),
quote_reply_function,
html_options
)
lib/tasks/icons.rake
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
unless Rails.env.production?
ICON_RELEASE_VERSION = "v3.19.0"
ICON_RELEASE_VERSION = "v3.30.0"
ICON_DEFAULT_STYLE = "outline"
SOURCE = URI.parse("https://raw.githubusercontent.com/tabler/tabler-icons/#{ICON_RELEASE_VERSION}/icons")
test/helpers/icons_helper_test.rb
assert_match expected, icon
end
def test_sprite_icon_should_return_svg_with_filled_class_when_icon_style_is_filled
expected = %r{<svg class="s18 icon-svg filled" aria-hidden="true"><use href="/assets/icons-\w+.svg#icon--edit"></use></svg>$}
icon = sprite_icon('edit', icon_style: :filled)
assert_match expected, icon
end
def test_file_icon_should_return_folder_icon_for_directory
entry = stub(:is_dir? => true)
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
journals = issue.visible_journals_with_index # add indice
journal_actions = render_journal_actions(issue, journals.first, {reply_links: true})
assert_select_in journal_actions, 'a[title=?][class="icon icon-comment"]', 'Quote'
assert_select_in journal_actions, 'a[title=?][class="icon icon-quote"]', 'Quote'
assert_select_in journal_actions, 'a[title=?][class="icon-only icon-edit"]', 'Edit'
assert_select_in journal_actions, 'div[class="drdn-items"] a[class="icon icon-del"]'
assert_select_in journal_actions, 'div[class="drdn-items"] a[class="icon icon-copy-link"]'
test/unit/lib/redmine/quote_reply_helper_test.rb
a_tag = quote_reply(url, '#issue_description_wiki')
assert_includes a_tag, %|onclick="#{h "quoteReply('/issues/1/quoted', '#issue_description_wiki', 'common_mark'); return false;"}"|
assert_includes a_tag, %|class="icon icon-comment"|
assert_includes a_tag, %|class="icon icon-quote"|
assert_not_includes a_tag, 'title='
# When icon_only is true
(6-6/8)