Replaces loading and hourglass icons with SVG versions rendered in HTML on attachment upload (#42966).

Patch by Mizuki ISHIKAWA (user:ishikawa999).

git-svn-id: https://svn.redmine.org/redmine/trunk@23987 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Marius Balteanu
2025-09-18 19:01:05 +00:00
parent 4cad9613d0
commit 81ee533651
5 changed files with 35 additions and 15 deletions

View File

@@ -45,10 +45,13 @@ function addFile(inputEl, file, eagerUpload) {
addFile.nextAttachmentId = 1;
function ajaxUpload(file, attachmentId, fileSpan, inputEl) {
let attachmentIcon = $(fileSpan).find('svg.svg-attachment');
function onLoadstart(e) {
fileSpan.removeClass('ajax-waiting');
fileSpan.addClass('ajax-loading');
attachmentIcon.addClass('svg-loader');
updateSVGIcon(attachmentIcon[0], 'loader')
$('input:submit', $(this).parents('form')).attr('disabled', 'disabled');
}
@@ -76,6 +79,8 @@ function ajaxUpload(file, attachmentId, fileSpan, inputEl) {
}).always(function() {
ajaxUpload.uploading--;
fileSpan.removeClass('ajax-loading');
attachmentIcon.removeClass('svg-loader');
updateSVGIcon(attachmentIcon[0], 'attachment');
var form = fileSpan.parents('form');
if (form.queue('upload').length == 0 && ajaxUpload.uploading == 0) {
$('input:submit', form).removeAttr('disabled');
@@ -87,6 +92,7 @@ function ajaxUpload(file, attachmentId, fileSpan, inputEl) {
var progressSpan = $('<div>').insertAfter(fileSpan.find('input.filename'));
progressSpan.progressbar();
fileSpan.addClass('ajax-waiting');
updateSVGIcon(attachmentIcon[0], 'hourglass');
var maxSyncUpload = $(inputEl).data('max-concurrent-uploads');