diff --git a/comment/comment.js b/comment/comment.js index dfb7e8f3063..6e30eed05b5 100644 --- a/comment/comment.js +++ b/comment/comment.js @@ -332,14 +332,15 @@ M.core_comment = { } }, '13,32'); // 13 and 32 are the keycodes for space and enter. + + require(['core/templates', 'core/notification'], function(Templates, Notification) { + var title = node.getAttribute('title'); + Templates.renderPix('t/delete', 'core', title).then(function(html) { + node.set('innerHTML', html); + }).catch(Notification.exception); + }); } ); - - require(['core/templates', 'core/notification'], function(Templates, Notification) { - Templates.renderPix('t/delete', 'core', M.util.get_string('deletecomment', 'moodle')).then(function(html) { - Y.all('div.comment-delete a').set('innerHTML', html); - }).catch(Notification.exception); - }); }, register_pagination: function() { var scope = this; diff --git a/comment/lib.php b/comment/lib.php index 5033e2c7916..16fa9b6d38f 100644 --- a/comment/lib.php +++ b/comment/lib.php @@ -263,8 +263,7 @@ class comment { 'comments', 'commentscount', 'commentsrequirelogin', - 'deletecommentbyon', - 'deletecomment', + 'deletecommentbyon' ), 'moodle' ); @@ -916,8 +915,11 @@ class comment { $replacements = array(); if (!empty($cmt->delete) && empty($nonjs)) { + $strdelete = get_string('deletecommentbyon', 'moodle', (object)['user' => $cmt->fullname, 'time' => $cmt->time]); $deletelink = html_writer::start_tag('div', array('class'=>'comment-delete')); - $deletelink .= html_writer::start_tag('a', array('href' => '#', 'id' => 'comment-delete-'.$this->cid.'-'.$cmt->id)); + $deletelink .= html_writer::start_tag('a', array('href' => '#', 'id' => 'comment-delete-'.$this->cid.'-'.$cmt->id, + 'title' => $strdelete)); + $deletelink .= $OUTPUT->pix_icon('t/delete', get_string('delete')); $deletelink .= html_writer::end_tag('a'); $deletelink .= html_writer::end_tag('div');