Patch #42966 » 0004-Replace-sort-handle-loading-icon-with-SVG.patch
| app/assets/javascripts/application-legacy.js | ||
|---|---|---|
|
firstPosition: 1
|
||
|
}, options );
|
||
|
function showReorderLoadingIcon(handle) {
|
||
|
const svg = handle.querySelector('svg');
|
||
|
if (!svg) return;
|
||
|
updateSVGIcon(svg, 'loader');
|
||
|
svg.classList.add('svg-loader');
|
||
|
handle.classList.add('ajax-loading');
|
||
|
}
|
||
|
function restoreReorderIcon(handle) {
|
||
|
const svg = handle.querySelector('svg.svg-loader');
|
||
|
if (!svg) return;
|
||
|
updateSVGIcon(svg, 'reorder');
|
||
|
svg.classList.remove('svg-loader');
|
||
|
handle.classList.remove('ajax-loading');
|
||
|
}
|
||
|
return this.sortable($.extend({
|
||
|
axis: 'y',
|
||
|
handle: ".sort-handle",
|
||
| ... | ... | |
|
},
|
||
|
update: function(event, ui) {
|
||
|
var sortable = $(this);
|
||
|
var handle = ui.item.find(".sort-handle").addClass("ajax-loading");
|
||
|
var handle = ui.item.find(".sort-handle")
|
||
|
var url = handle.data("reorder-url");
|
||
|
var param = handle.data("reorder-param");
|
||
|
var data = {};
|
||
|
showReorderLoadingIcon(handle[0]);
|
||
|
data[param] = {position: ui.item.index() + settings['firstPosition']};
|
||
|
$.ajax({
|
||
|
url: url,
|
||
| ... | ... | |
|
sortable.sortable("cancel");
|
||
|
},
|
||
|
complete: function(jqXHR, textStatus, errorThrown){
|
||
|
handle.removeClass("ajax-loading");
|
||
|
restoreReorderIcon(handle[0]);
|
||
|
}
|
||
|
});
|
||
|
},
|
||
| app/assets/stylesheets/application.css | ||
|---|---|---|
|
.icon-file.application-gzip:not(:has(svg)) { background-image: url(/files/zip.png); }
|
||
|
.icon-copy-link:not(:has(svg)) { background-image: url(/copy_link.png); }
|
||
|
.sort-handle.ajax-loading { background-image: url(/loading.gif); }
|
||
|
tr.ui-sortable-helper { border:1px solid #e4e4e4; }
|
||
|
svg.svg-loader {
|
||
|
animation: spin 1s linear infinite;
|
||