Skip to content

Commit

Permalink
MDL-47773 comment: Indicate comment being saved via AJAX
Browse files Browse the repository at this point in the history
This should be considered as quick & dirty usability fix as the whole JS
should ideally be rewritten and this behaviour should use CSS classes.
  • Loading branch information
mudrd8mz committed Mar 31, 2015
1 parent 20d3883 commit 3e4f5e6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions comment/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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);
Expand Down

0 comments on commit 3e4f5e6

Please sign in to comment.