]> source.dussan.org Git - redmine.git/commitdiff
Replaces icons in administration menu with SVG icons (#23980).
authorMarius Balteanu <marius.balteanu@zitec.com>
Fri, 6 Sep 2024 20:40:27 +0000 (20:40 +0000)
committerMarius Balteanu <marius.balteanu@zitec.com>
Fri, 6 Sep 2024 20:40:27 +0000 (20:40 +0000)
git-svn-id: https://svn.redmine.org/redmine/trunk@23028 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/assets/images/icons.svg
app/assets/stylesheets/application.css
lib/redmine/menu_manager.rb
lib/redmine/preparation.rb

index 7875ea782763f0cb59d1130976d4e3a8b0912562..294811c046e33451af64ed1b1a9ffa03d12caaab 100644 (file)
     <symbol viewBox="0 0 384 512" id="icon--file">
       <path  d="M320 464c8.8 0 16-7.2 16-16V160h-80c-17.7 0-32-14.3-32-32V48H64c-8.8 0-16 7.2-16 16v384c0 8.8 7.2 16 16 16zM0 64C0 28.7 28.7 0 64 0h165.5c17 0 33.3 6.7 45.3 18.7l90.5 90.5c12 12 18.7 28.3 18.7 45.3V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64z"/>
     </symbol>
+    <symbol viewBox="0 0 384 512" id="icon--custom-fields">
+      <path d="M64 464c-8.8 0-16-7.2-16-16L48 64c0-8.8 7.2-16 16-16l160 0 0 80c0 17.7 14.3 32 32 32l80 0 0 288c0 8.8-7.2 16-16 16L64 464zM64 0C28.7 0 0 28.7 0 64L0 448c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-293.5c0-17-6.7-33.3-18.7-45.3L274.7 18.7C262.7 6.7 246.5 0 229.5 0L64 0zm56 256c-13.3 0-24 10.7-24 24s10.7 24 24 24l144 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-144 0zm0 96c-13.3 0-24 10.7-24 24s10.7 24 24 24l144 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-144 0z"/></symbol>
     <symbol viewBox="0 0 512 512" id="icon--folder">
       <path d="M64 480H448c35.3 0 64-28.7 64-64V160c0-35.3-28.7-64-64-64H288c-10.1 0-19.6-4.7-25.6-12.8L243.2 57.6C231.1 41.5 212.1 32 192 32H64C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64z"/>
     </symbol>
     <symbol viewBox="0 0 512 512" id="icon--package">
       <path  d="M234.5 5.7c13.9-5 29.1-5 43.1 0l192 68.6c25.4 9.1 42.4 33.2 42.4 60.3v242.9c0 27-17 51.2-42.5 60.3l-192 68.6c-13.9 5-29.1 5-43.1 0l-192-68.6C17 428.6 0 404.5 0 377.4V134.6c0-27 17-51.2 42.5-60.3zM256 66L82.3 128L256 190l173.7-62zm32 368.6l160-57.1v-188l-160 57.1z"/>
     </symbol>
-    <symbol viewBox="0 0 512 512" id="icon--plugin">
+    <symbol viewBox="0 0 512 512" id="icon--plugin">
       <path  d="M192 104.8c0-9.2-5.8-17.3-13.2-22.8c-11.6-8.7-18.8-20.7-18.8-34c0-26.5 28.7-48 64-48s64 21.5 64 48c0 13.3-7.2 25.3-18.8 34c-7.4 5.5-13.2 13.6-13.2 22.8c0 12.8 10.4 23.2 23.2 23.2H336c26.5 0 48 21.5 48 48v56.8c0 12.8 10.4 23.2 23.2 23.2c9.2 0 17.3-5.8 22.8-13.2c8.7-11.6 20.7-18.8 34-18.8c26.5 0 48 28.7 48 64s-21.5 64-48 64c-13.3 0-25.3-7.2-34-18.8c-5.5-7.4-13.6-13.2-22.8-13.2c-12.8 0-23.2 10.4-23.2 23.2V464c0 26.5-21.5 48-48 48h-56.8c-12.8 0-23.2-10.4-23.2-23.2c0-9.2 5.8-17.3 13.2-22.8c11.6-8.7 18.8-20.7 18.8-34c0-26.5-28.7-48-64-48s-64 21.5-64 48c0 13.3 7.2 25.3 18.8 34c7.4 5.5 13.2 13.6 13.2 22.8c0 12.8-10.4 23.2-23.2 23.2H48c-26.5 0-48-21.5-48-48V343.2C0 330.4 10.4 320 23.2 320c9.2 0 17.3 5.8 22.8 13.2c8.7 11.6 20.7 18.8 34 18.8c26.5 0 48-28.7 48-64s-21.5-64-48-64c-13.3 0-25.3 7.2-34 18.8c-5.5 7.4-13.6 13.2-22.8 13.2C10.4 256 0 245.6 0 232.8V176c0-26.5 21.5-48 48-48h120.8c12.8 0 23.2-10.4 23.2-23.2"/>
     </symbol>
     <symbol viewBox="0 0 640 512" id="icon--precode">
index a77f33215800dc42529703bc33a2690f7405b650..abb5e1b2ba92fdb51de8a5fc339c0af6b57b5a75 100644 (file)
@@ -1713,7 +1713,7 @@ span.icon-label {
 .icon-report { background-image: url(/report.png); }
 .icon-comment:not(:has(svg)), .icon-comments:not(:has(svg)) { background-image: url(/comment.png); }
 .icon-summary:not(:has(svg)) { background-image: url(/lightning.png); }
-.icon-server-authentication { background-image: url(/server_key.png); }
+.icon-server-authentication:not(:has(svg)) { background-image: url(/server_key.png); }
 .icon-issue:not(:has(svg)) { background-image: url(/ticket.png); }
 .icon-zoom-in:not(:has(svg)) { background-image: url(/zoom_in.png); }
 .icon-zoom-out:not(:has(svg)) { background-image: url(/zoom_out.png); }
@@ -1731,11 +1731,11 @@ span.icon-label {
 .icon-close:hover:not(:has(svg)) { background-image: url(/close_hl.png); }
 .icon-settings:not(:has(svg)) { background-image: url(/changeset.png); }
 .icon-group:not(:has(svg)),.icon-groupnonmember, .icon-groupanonymous { background-image: url(/group.png); }
-.icon-roles { background-image: url(/database_key.png); }
+.icon-roles:not(:has(svg)) { background-image: url(/database_key.png); }
 .icon-issue-edit:not(:has(svg)) { background-image: url(/ticket_edit.png); }
-.icon-workflows { background-image: url(/ticket_go.png); }
-.icon-custom-fields { background-image: url(/textfield.png); }
-.icon-plugins { background-image: url(/plugin.png); }
+.icon-workflows:not(:has(svg)) { background-image: url(/ticket_go.png); }
+.icon-custom-fields:not(:has(svg)) { background-image: url(/textfield.png); }
+.icon-plugins:not(:has(svg)) { background-image: url(/plugin.png); }
 .icon-news:not(:has(svg)) { background-image: url(/news.png); }
 .icon-issue-closed:not(:has(svg)) { background-image: url(/ticket_checked.png); }
 .icon-issue-note:not(:has(svg)) { background-image: url(/ticket_note.png); }
index 5846011e24602b9b7e9f058170dbaac0f6e390af..7b7b4a809234c377a3b1286b9af8c9534fa70190 100644 (file)
@@ -180,7 +180,14 @@ module Redmine
           url = '#'
           options.reverse_merge!(:onclick => 'return false;')
         end
-        link_to(h(caption), use_absolute_controller(url), options)
+
+        label = if item.icon.present?
+          icon_with_label(item.icon, h(caption))
+        else
+          h(caption)
+        end
+
+        link_to(label, use_absolute_controller(url), options)
       end
 
       def render_unattached_menu_item(menu_item, project)
@@ -424,7 +431,7 @@ module Redmine
     class MenuItem < MenuNode
       include Redmine::I18n
       attr_reader :name, :url, :param, :condition, :parent,
-                  :child_menus, :last, :permission
+                  :child_menus, :last, :permission, :icon
 
       def initialize(name, url, options={})
         if options[:if] && !options[:if].respond_to?(:call)
@@ -447,6 +454,7 @@ module Redmine
         @permission ||= false if options.key?(:permission)
         @param = options[:param] || :id
         @caption = options[:caption]
+        @icon = options[:icon]
         @html_options = options[:html] || {}
         # Adds a unique class to each menu item based on its name
         @html_options[:class] = [@html_options[:class], @name.to_s.dasherize].compact.join(' ')
index ab6cbdff687e6bf07acf388fa498c9879a660d21..553f8693a423e7878d8e8a3643fd729e032d0607 100644 (file)
@@ -242,38 +242,51 @@ module Redmine
       MenuManager.map :admin_menu do |menu|
         menu.push :projects, {:controller => 'admin', :action => 'projects'},
                   :caption => :label_project_plural,
+                  :icon => 'projects',
                   :html => {:class => 'icon icon-projects'}
         menu.push :users, {:controller => 'users'}, :caption => :label_user_plural,
+                  :icon => 'user',
                   :html => {:class => 'icon icon-user'}
         menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural,
+                  :icon => 'group',
                   :html => {:class => 'icon icon-group'}
         menu.push :roles, {:controller => 'roles'},
                   :caption => :label_role_and_permissions,
+                  :icon => 'roles',
                   :html => {:class => 'icon icon-roles'}
         menu.push :trackers, {:controller => 'trackers'},
                   :caption => :label_tracker_plural,
+                  :icon => 'issue',
                   :html => {:class => 'icon icon-issue'}
         menu.push :issue_statuses, {:controller => 'issue_statuses'},
                   :caption => :label_issue_status_plural,
+                  :icon => 'issue-edit',
                   :html => {:class => 'icon icon-issue-edit'}
         menu.push :workflows, {:controller => 'workflows', :action => 'edit'},
                   :caption => :label_workflow,
+                  :icon => 'workflows',
                   :html => {:class => 'icon icon-workflows'}
         menu.push :custom_fields, {:controller => 'custom_fields'},
                   :caption => :label_custom_field_plural,
+                  :icon => 'custom-fields',
                   :html => {:class => 'icon icon-custom-fields'}
         menu.push :enumerations, {:controller => 'enumerations'},
+                  :icon => 'list',
                   :html => {:class => 'icon icon-list'}
         menu.push :settings, {:controller => 'settings'},
+                  :icon => 'settings',
                   :html => {:class => 'icon icon-settings'}
         menu.push :ldap_authentication,
                   {:controller => 'auth_sources', :action => 'index'},
+                  :icon => 'server-authentication',
                   :html => {:class => 'icon icon-server-authentication'}
         menu.push :plugins, {:controller => 'admin', :action => 'plugins'},
                   :last => true,
+                  :icon => 'plugins',
                   :html => {:class => 'icon icon-plugins'}
         menu.push :info, {:controller => 'admin', :action => 'info'},
                   :caption => :label_information_plural,
+                  :icon => 'help',
                   :last => true,
                   :html => {:class => 'icon icon-help'}
       end