MDL-47773 comment: Indicate comment being saved via AJAX

This should be considered as quick & dirty usability fix as the whole JS
should ideally be rewritten and this behaviour should use CSS classes.
This commit is contained in:
David Mudrák 2015-03-26 17:21:48 +01:00
parent 20d38830ae
commit 3e4f5e6591

View File

@ -65,6 +65,12 @@ M.core_comment = {
var scope = this;
var value = ta.get('value');
if (value && value != M.util.get_string('addcomment', 'moodle')) {
ta.set('disabled', true);
ta.setStyles({
'backgroundImage': 'url(' + M.util.image_url('i/loading_small', 'core') + ')',
'backgroundRepeat': 'no-repeat',
'backgroundPosition': 'center center'
});
var params = {'content': value};
this.request({
action: 'add',
@ -75,6 +81,8 @@ M.core_comment = {
var cid = scope.client_id;
var ta = Y.one('#dlg-content-'+cid);
ta.set('value', '');
ta.set('disabled', false);
ta.setStyle('backgroundImage', 'none');
scope.toggle_textarea(false);
var container = Y.one('#comment-list-'+cid);
var result = scope.render([obj], true);