rename svg_sprite_icon to additionals_svg_sprite_icon, which does not conflict with latest master changes

This commit is contained in:
Alexander Meindl 2024-10-20 10:37:39 +02:00
parent bb27649880
commit 2ff47bf1a0

View File

@ -19,7 +19,7 @@ module AdditionalsIconsHelper
wrapper_class: 'a-icon',
wrapper_css: nil)
svg_code = svg_sprite_icon(icon_name, size:, title:, css_class:)
svg_code = additionals_svg_sprite_icon(icon_name, size:, title:, css_class:)
content = svg_code.dup
@ -40,23 +40,6 @@ module AdditionalsIconsHelper
content_tag wrapper, content, class: wrapper_classes
end
def svg_sprite_icon(icon_name, size: DEFAULT_ICON_SIZE, sprite: 'icons', css_class: nil, title: nil)
sprite_path = "#{sprite}.svg"
title = l title if title.is_a? Symbol
css_classes = "a-s#{size} a-svg-icon"
css_classes += " #{css_class}" if css_class
content_tag(
:svg,
content_tag(:use,
'',
{ 'href' => additionals_asset_path("#{sprite_path}#icon--#{icon_name}") }),
class: css_classes,
title: title.presence,
aria: { hidden: true }
)
end
def additionals_asset_path(file)
plugin_id = 'additionals'
@ -77,6 +60,23 @@ module AdditionalsIconsHelper
private
def additionals_svg_sprite_icon(icon_name, size: DEFAULT_ICON_SIZE, sprite: 'icons', css_class: nil, title: nil)
sprite_path = "#{sprite}.svg"
title = l title if title.is_a? Symbol
css_classes = "a-s#{size} a-svg-icon"
css_classes += " #{css_class}" if css_class
content_tag(
:svg,
content_tag(:use,
'',
{ 'href' => additionals_asset_path("#{sprite_path}#icon--#{icon_name}") }),
class: css_classes,
title: title.presence,
aria: { hidden: true }
)
end
def svg_icon_for_mime_type(mime)
if %w[text-plain text-x-c text-x-csharp text-x-java text-x-php
text-x-ruby text-xml text-css text-html text-css text-html