diff --git a/app/helpers/additionals_icons_helper.rb b/app/helpers/additionals_icons_helper.rb index a955db74..a975fbe9 100644 --- a/app/helpers/additionals_icons_helper.rb +++ b/app/helpers/additionals_icons_helper.rb @@ -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