diff options
author | Marius Balteanu <marius.balteanu@zitec.com> | 2024-09-08 17:23:06 +0000 |
---|---|---|
committer | Marius Balteanu <marius.balteanu@zitec.com> | 2024-09-08 17:23:06 +0000 |
commit | dfc5b2a13bdfaedcb7be9722f19df1e5ce008a81 (patch) | |
tree | e877142841712fab35d9c8d3c5c96a740ddfc527 /app/helpers/icons_helper.rb | |
parent | 00cc5f744086651874e4a4f52774eb406d2f4e01 (diff) | |
download | redmine-dfc5b2a13bdfaedcb7be9722f19df1e5ce008a81.tar.gz redmine-dfc5b2a13bdfaedcb7be9722f19df1e5ce008a81.zip |
Replaces various icons with SVG icons (#23980).
git-svn-id: https://svn.redmine.org/redmine/trunk@23039 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers/icons_helper.rb')
-rw-r--r-- | app/helpers/icons_helper.rb | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/app/helpers/icons_helper.rb b/app/helpers/icons_helper.rb index dc7d94ae0..24dbf0c31 100644 --- a/app/helpers/icons_helper.rb +++ b/app/helpers/icons_helper.rb @@ -21,22 +21,26 @@ module IconsHelper DEFAULT_ICON_SIZE = "14" DEFAULT_SPRITE = "icons" - def icon_with_label(icon_name, label_text, icon_only: false) + def icon_with_label(icon_name, label_text, icon_only: false, size: DEFAULT_ICON_SIZE, css_class: nil) label_classes = ["icon-label"] label_classes << "hidden" if icon_only - sprite_icon(icon_name) + content_tag(:span, label_text, class: label_classes.join(' ')) + sprite_icon(icon_name, size: size, css_class: css_class) + content_tag(:span, label_text, class: label_classes.join(' ')) end - def icon_for_file(entry, name) + def icon_for_file(entry, name, size: DEFAULT_ICON_SIZE, css_class: nil) if entry.is_dir? - icon_with_label("folder", name) + icon_with_label("folder", name, size: size, css_class: css_class) else icon = icon_for_mime_type(Redmine::MimeType.css_class_of(name)) - icon_with_label(icon, name) + icon_with_label(icon, name, size: size, css_class: css_class) end end - def icon_for_event_type(event_type) + def icon_for_principal(principal_class, size: DEFAULT_ICON_SIZE, css_class: nil) + sprite_icon('group', size: size, css_class:css_class) if ['groupanonymous', 'groupnonmember', 'group'].include?(principal_class) + end + + def icon_for_event_type(event_type, size: DEFAULT_ICON_SIZE, css_class: nil) icon = case event_type when 'reply', 'issue-note' 'comments' @@ -48,10 +52,10 @@ module IconsHelper event_type end - sprite_icon icon + sprite_icon(icon, size: size, css_class: css_class) end - def sprite_icon(icon_name, size: DEFAULT_ICON_SIZE, sprite: DEFAULT_SPRITE) + def sprite_icon(icon_name, size: DEFAULT_ICON_SIZE, sprite: DEFAULT_SPRITE, css_class: nil) sprite_path = "#{sprite}.svg" content_tag( |