1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-31 19:47:14 +00:00

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
This commit is contained in:
Marius Balteanu 2024-09-02 20:47:55 +00:00
parent d24d11a682
commit bcb9a1cd33
4 changed files with 21 additions and 3 deletions

View File

@ -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');
}
});

View File

@ -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); }

View File

@ -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"

View File

@ -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>