From 166540d743be89d5544870b69bab7b6a46ca3a9c Mon Sep 17 00:00:00 2001 From: Marius Balteanu Date: Sun, 8 Sep 2024 17:25:02 +0000 Subject: Replaces icon-expanded and icon-collapsed with SVG icons (#23980). git-svn-id: https://svn.redmine.org/redmine/trunk@23041 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/assets/javascripts/application.js | 34 ++++++++++++++++------- app/assets/stylesheets/application.css | 4 +-- app/views/calendars/show.html.erb | 5 +++- app/views/gantts/show.html.erb | 10 +++++-- app/views/imports/_issues_mapping.html.erb | 5 +++- app/views/issues/_list.html.erb | 2 +- app/views/projects/_list.html.erb | 2 +- app/views/queries/_query_form.html.erb | 10 +++++-- app/views/repositories/_dir_list_content.html.erb | 2 +- app/views/roles/permissions.html.erb | 7 +++-- app/views/search/index.html.erb | 5 +++- app/views/timelog/_list.html.erb | 2 +- app/views/trackers/fields.html.erb | 4 +-- app/views/users/_list.html.erb | 2 +- app/views/versions/_sidebar.html.erb | 2 +- app/views/wiki/show.html.erb | 5 +++- app/views/workflows/edit.html.erb | 12 ++++++-- app/views/workflows/permissions.html.erb | 4 +-- 18 files changed, 82 insertions(+), 35 deletions(-) (limited to 'app') diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 96a9986bb..4560bff09 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -35,12 +35,32 @@ function toggleRowGroup(el) { var n = tr.next(); tr.toggleClass('open'); $(el).toggleClass('icon-expanded icon-collapsed'); + toggleExpendCollapseIcon(el) while (n.length && !n.hasClass('group')) { n.toggle(); n = n.next('tr'); } } +function toggleExpendCollapseIcon(el) { + if (el.classList.contains('icon-expanded')) { + updateSVGIcon(el, 'angle-down') + } else { + updateSVGIcon(el, 'angle-right') + } +} + +function updateSVGIcon(element, icon) { + const iconElement = element.getElementsByTagName("use").item(0) + + if (iconElement === null) { + return false; + } + + const iconPath = iconElement.getAttribute('href'); + iconElement.setAttribute('href', iconPath.replace(/#.*$/g, "#icon--" + icon)) +} + function collapseAllRowGroups(el) { var tbody = $(el).parents('tbody').first(); tbody.children('tr').each(function(index) { @@ -78,6 +98,7 @@ function toggleFieldset(el) { var fieldset = $(el).parents('fieldset').first(); fieldset.toggleClass('collapsed'); fieldset.children('legend').toggleClass('icon-expanded icon-collapsed'); + toggleExpendCollapseIcon(fieldset.children('legend')[0]) fieldset.children('div').toggle(); } @@ -552,27 +573,20 @@ function expandScmEntry(id) { $('#'+id).addClass('open'); } -function switchScmFolderIcon(el, from, to) { - var iconEl = el.find('svg use') - var iconHref = iconEl.attr('href') - - iconEl.attr('href', iconHref.replace(from, to)) -} - function scmEntryClick(id, url) { var el = $('#'+id); if (el.hasClass('open')) { collapseScmEntry(id); el.find('.expander').switchClass('icon-expanded', 'icon-collapsed'); el.addClass('collapsed'); - switchScmFolderIcon(el, 'icon--folder-open', 'icon--folder') + updateSVGIcon(el[0], 'folder') return false; } else if (el.hasClass('loaded')) { expandScmEntry(id); el.find('.expander').switchClass('icon-collapsed', 'icon-expanded'); el.removeClass('collapsed'); - switchScmFolderIcon(el, 'icon--folder', 'icon--folder-open') + updateSVGIcon(el[0], 'folder-open') return false; } @@ -585,7 +599,7 @@ function scmEntryClick(id, url) { success: function(data) { el.after(data); el.addClass('open').addClass('loaded').removeClass('loading'); - switchScmFolderIcon(el, 'icon--folder', 'icon--folder-open') + updateSVGIcon(el[0], 'folder-open') el.find('.expander').switchClass('icon-collapsed', 'icon-expanded'); } }); diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 3667f19e8..c3ce852c2 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -1771,8 +1771,8 @@ span.icon-label { .icon-shared:not(:has(svg)) { background-image: url(/link.png); } .icon-actions:not(:has(svg)) { background-image: url(/3_bullets.png); } .icon-sort-handle:not(:has(svg)) { background-image: url(/reorder.png); } -.icon-expanded { background-image: url(/arrow_down.png); } -.icon-collapsed { background-image: url(/arrow_right.png); } +.icon-expanded:not(:has(svg)) { background-image: url(/arrow_down.png); } +.icon-collapsed:not(:has(svg)) { background-image: url(/arrow_right.png); } .icon-bookmark:not(:has(svg)) { background-image: url(/tag_blue_delete.png); } .icon-bookmark-off:not(:has(svg)) { background-image: url(/tag_blue_add.png); } .icon-bookmarked-project:not(:has(svg)) { background-image: url(/tag_blue.png); } diff --git a/app/views/calendars/show.html.erb b/app/views/calendars/show.html.erb index 950836a15..fa0f1cbc8 100644 --- a/app/views/calendars/show.html.erb +++ b/app/views/calendars/show.html.erb @@ -9,7 +9,10 @@
"> - "><%= l(:label_filter_plural) %> + "> + <%= sprite_icon(@query.new_record? ? "angle-down" : "angle-right") %> + <%= l(:label_filter_plural) %> +
"> <%= render :partial => 'queries/filters', :locals => {:query => @query} %>
diff --git a/app/views/gantts/show.html.erb b/app/views/gantts/show.html.erb index 3e73d9d7a..cf602e439 100644 --- a/app/views/gantts/show.html.erb +++ b/app/views/gantts/show.html.erb @@ -15,14 +15,20 @@
"> - "><%= l(:label_filter_plural) %> + "> + <%= sprite_icon(@query.new_record? ? "angle-down" : "angle-right") %> + <%= l(:label_filter_plural) %> +
"> <%= render :partial => 'queries/filters', :locals => {:query => @query} %>