summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2024-09-02 20:47:55 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2024-09-02 20:47:55 +0000
commitbcb9a1cd3347031884474cf8c5de153e43964a9e (patch)
treecf40259c52e3b58c2396545fcc6ec1ab400522b4
parentd24d11a6825eda4e4efee455e2aafff01a16616a (diff)
downloadredmine-bcb9a1cd3347031884474cf8c5de153e43964a9e.tar.gz
redmine-bcb9a1cd3347031884474cf8c5de153e43964a9e.zip
Replaces icon-folder and icon-folder-open in repository view with SVG icons (#23980).
git-svn-id: https://svn.redmine.org/redmine/trunk@23010 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/assets/javascripts/application.js12
-rw-r--r--app/assets/stylesheets/application.css4
-rw-r--r--app/helpers/icons_helper.rb6
-rw-r--r--app/views/repositories/_dir_list_content.html.erb2
4 files changed, 21 insertions, 3 deletions
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index ba77034fb..a5f635299 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -552,17 +552,28 @@ 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')
+
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')
+
return false;
}
if (el.hasClass('loading')) {
@@ -574,6 +585,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')
el.find('.expander').switchClass('icon-collapsed', 'icon-expanded');
}
});
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css
index 21948670b..f704df274 100644
--- a/app/assets/stylesheets/application.css
+++ b/app/assets/stylesheets/application.css
@@ -1691,8 +1691,8 @@ span.icon-label {
.icon-download:not(:has(svg)) { background-image: url(/download.png); }
.icon-cancel:not(:has(svg)) { background-image: url(/cancel.png); }
.icon-multiple:not(:has(svg)) { background-image: url(/table_multiple.png); }
-.icon-folder { background-image: url(/folder.png); }
-.open .icon-folder { background-image: url(/folder_open.png); }
+.icon-folder:not(:has(svg)) { background-image: url(/folder.png); }
+.open .icon-folder:not(:has(svg)) { background-image: url(/folder_open.png); }
.icon-package { background-image: url(/package.png); }
.icon-user:not(:has(svg)) { background-image: url(/user.png); }
.icon-project, .icon-projects { background-image: url(/projects.png); }
diff --git a/app/helpers/icons_helper.rb b/app/helpers/icons_helper.rb
index d82a74611..b9b25c0ba 100644
--- a/app/helpers/icons_helper.rb
+++ b/app/helpers/icons_helper.rb
@@ -25,6 +25,12 @@ module IconsHelper
sprite_icon(icon_name) + content_tag(:span, label_text, class: "icon-label")
end
+ def icon_for_file(entry, label_text)
+ if entry.is_dir?
+ icon_with_label("folder", label_text)
+ end
+ end
+
def sprite_icon(icon_name, size: DEFAULT_ICON_SIZE, sprite: DEFAULT_SPRITE)
sprite_path = "#{sprite}.svg"
diff --git a/app/views/repositories/_dir_list_content.html.erb b/app/views/repositories/_dir_list_content.html.erb
index 396c7f6d0..a46f9665b 100644
--- a/app/views/repositories/_dir_list_content.html.erb
+++ b/app/views/repositories/_dir_list_content.html.erb
@@ -16,7 +16,7 @@
:depth => (depth + 1),
:parent_id => tr_id)) %>');">&nbsp;</span>
<% end %>
-<%= link_to ent_name,
+<%= link_to icon_for_file(entry, ent_name),
{:action => (entry.is_dir? ? 'show' : 'entry'), :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(ent_path), :rev => @rev},
:class => (entry.is_dir? ? 'icon icon-folder' : "icon icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%>
</td>