diff --git a/comment/comment.js b/comment/comment.js index 13ab753fc10..a736c01847f 100644 --- a/comment/comment.js +++ b/comment/comment.js @@ -72,16 +72,14 @@ M.core_comment = { scope.toggle_textarea(false); }, post: function() { + var container = Y.one('#comment-list-'+this.client_id); var ta = Y.one('#dlg-content-'+this.client_id); 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 spinner = M.util.add_spinner(Y, container); + spinner.show(); var params = {'content': value}; this.request({ action: 'add', @@ -93,7 +91,7 @@ M.core_comment = { var ta = Y.one('#dlg-content-'+cid); ta.set('value', ''); ta.set('disabled', false); - ta.setStyle('backgroundImage', 'none'); + spinner.remove(); scope.toggle_textarea(false); var container = Y.one('#comment-list-'+cid); var result = await scope.render([obj], true); @@ -401,8 +399,6 @@ M.core_comment = { var collapsedimage = 't/collapsed'; // ltr mode if ( Y.one(document.body).hasClass('dir-rtl') ) { collapsedimage = 't/collapsed_rtl'; - } else { - collapsedimage = 't/collapsed'; } if (img) { img.set('src', M.util.image_url(collapsedimage, 'core')); @@ -451,7 +447,8 @@ M.core_comment = { }, wait: function() { var container = Y.one('#comment-list-'+this.client_id); - container.set('innerHTML', '
'); + container.set('innerHTML', ''); + M.util.add_spinner(Y, container).show(); } }); diff --git a/comment/lib.php b/comment/lib.php index 10bc3985cd2..be7fcc29e7e 100644 --- a/comment/lib.php +++ b/comment/lib.php @@ -458,8 +458,6 @@ class comment { $collapsedimage= 't/collapsed'; if (right_to_left()) { $collapsedimage= 't/collapsed_rtl'; - } else { - $collapsedimage= 't/collapsed'; } $html .= html_writer::start_tag('a', array( 'class' => 'comment-link', @@ -468,7 +466,8 @@ class comment { 'role' => 'button', 'aria-expanded' => 'false') ); - $html .= $OUTPUT->pix_icon($collapsedimage, $this->linktext); + $html .= html_writer::img($OUTPUT->image_url($collapsedimage), $this->linktext, + ['id' => 'comment-img-' . $this->cid, 'class' => 'icon']); $html .= html_writer::tag('span', $this->linktext.' '.$countstring, array('id' => 'comment-link-text-'.$this->cid)); $html .= html_writer::end_tag('a'); } diff --git a/lib/javascript-static.js b/lib/javascript-static.js index 3008c1e552c..28a63bd349f 100644 --- a/lib/javascript-static.js +++ b/lib/javascript-static.js @@ -111,8 +111,6 @@ M.util.CollapsibleRegion = function(Y, id, userpref, strtooltip) { var collapsedimage = 't/collapsed'; // ltr mode if (right_to_left()) { collapsedimage = 't/collapsed_rtl'; - } else { - collapsedimage = 't/collapsed'; } if (this.div.hasClass('collapsed')) { // Add the correct image and record the YUI node created in the process