diff --git a/app/helpers/icons_helper.rb b/app/helpers/icons_helper.rb index 6afb84537..598cddf76 100644 --- a/app/helpers/icons_helper.rb +++ b/app/helpers/icons_helper.rb @@ -21,8 +21,20 @@ module IconsHelper DEFAULT_ICON_SIZE = "18" DEFAULT_SPRITE = "icons" + include Redmine::Themes::Helper + + def sprite_source(sprite: DEFAULT_SPRITE, plugin: nil) + if plugin + "plugin_assets/#{plugin}/#{sprite}.svg" + elsif current_theme && current_theme.images.include?("#{sprite}.svg") + current_theme.image_path("#{sprite}.svg") + else + "#{sprite}.svg" + end + end + def sprite_icon(icon_name, label = nil, icon_only: false, size: DEFAULT_ICON_SIZE, style: :outline, css_class: nil, sprite: DEFAULT_SPRITE, plugin: nil, rtl: false) - sprite = plugin ? "plugin_assets/#{plugin}/#{sprite}.svg" : "#{sprite}.svg" + sprite = sprite_source(sprite: sprite, plugin: plugin) svg_icon = svg_sprite_icon(icon_name, size: size, style: style, css_class: css_class, sprite: sprite, rtl: rtl)