mirror of
https://github.com/moodle/moodle.git
synced 2025-04-11 19:42:35 +02:00
MDL-82909 javascript: replace custom loading icon with existing module.
This commit is contained in:
parent
09e56f2d1a
commit
b181f297ce
2
lib/amd/build/inplace_editable.min.js
vendored
2
lib/amd/build/inplace_editable.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -36,14 +36,14 @@ define(
|
||||
'core/config',
|
||||
'core/url',
|
||||
'core/form-autocomplete',
|
||||
'core/loadingicon',
|
||||
'core/pending',
|
||||
'core/local/inplace_editable/events',
|
||||
],
|
||||
function($, ajax, templates, notification, str, cfg, url, autocomplete, Pending, Events) {
|
||||
function($, ajax, templates, notification, str, cfg, url, autocomplete, LoadingIcon, Pending, Events) {
|
||||
|
||||
const removeSpinner = function(element) {
|
||||
element.removeClass('updating');
|
||||
element.find('img.spinner').hide();
|
||||
element.find('.loading-icon').hide();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -61,9 +61,10 @@ define(
|
||||
mainelement.attr('data-component'),
|
||||
mainelement.attr('data-itemtype'),
|
||||
].join('-');
|
||||
var pendingPromise = new Pending(pendingId);
|
||||
|
||||
addSpinner(mainelement);
|
||||
var pendingPromise = new Pending(pendingId);
|
||||
LoadingIcon.addIconToContainerRemoveOnCompletion(mainelement, pendingPromise);
|
||||
|
||||
ajax.call([{
|
||||
methodname: 'core_update_inplace_editable',
|
||||
args: {
|
||||
@ -104,20 +105,6 @@ define(
|
||||
});
|
||||
};
|
||||
|
||||
const addSpinner = function(element) {
|
||||
element.addClass('updating');
|
||||
var spinner = element.find('img.spinner');
|
||||
if (spinner.length) {
|
||||
spinner.show();
|
||||
} else {
|
||||
spinner = $('<img/>')
|
||||
.attr('src', url.imageUrl('i/loading_small'))
|
||||
.addClass(['spinner', 'icon'])
|
||||
;
|
||||
element.append(spinner);
|
||||
}
|
||||
};
|
||||
|
||||
$('body').on('click keypress', '[data-inplaceeditable] [data-inplaceeditablelink]', function(e) {
|
||||
if (e.type === 'keypress' && e.keyCode !== 13) {
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user