MDL-59499 - Fixed collapsing category javascript to use template rendering

This commit is contained in:
Andrew Davidson
2017-07-24 13:50:56 +02:00
committed by David Monllao
parent 87d1c6134f
commit d040476723
4 changed files with 23 additions and 11 deletions
@@ -1377,10 +1377,14 @@ Category.prototype = {
node.addClass('collapsed').setAttribute('aria-expanded', 'false');
action.setAttribute('data-action', 'expand').setAttrs({
title: M.util.get_string('expandcategory', 'moodle', this.getName())
}).one('img').setAttrs({
src: M.util.image_url('t/switch_plus', 'moodle'),
alt: M.util.get_string('expand', 'moodle')
});
require(['core/templates', 'core/notification'], function(Templates, Notification) {
Templates.renderPix('t/switch_plus', 'core', M.util.get_string('expand', 'moodle')).then(function(html) {
action.set('innerHTML', html);
}).fail(Notification.exception);
});
if (ul) {
ul.setAttribute('aria-hidden', 'true');
}
File diff suppressed because one or more lines are too long
@@ -1350,10 +1350,14 @@ Category.prototype = {
node.addClass('collapsed').setAttribute('aria-expanded', 'false');
action.setAttribute('data-action', 'expand').setAttrs({
title: M.util.get_string('expandcategory', 'moodle', this.getName())
}).one('img').setAttrs({
src: M.util.image_url('t/switch_plus', 'moodle'),
alt: M.util.get_string('expand', 'moodle')
});
require(['core/templates', 'core/notification'], function(Templates, Notification) {
Templates.renderPix('t/switch_plus', 'core', M.util.get_string('expand', 'moodle')).then(function(html) {
action.set('innerHTML', html);
}).fail(Notification.exception);
});
if (ul) {
ul.setAttribute('aria-hidden', 'true');
}
+7 -3
View File
@@ -194,10 +194,14 @@ Category.prototype = {
node.addClass('collapsed').setAttribute('aria-expanded', 'false');
action.setAttribute('data-action', 'expand').setAttrs({
title: M.util.get_string('expandcategory', 'moodle', this.getName())
}).one('img').setAttrs({
src: M.util.image_url('t/switch_plus', 'moodle'),
alt: M.util.get_string('expand', 'moodle')
});
require(['core/templates', 'core/notification'], function(Templates, Notification) {
Templates.renderPix('t/switch_plus', 'core', M.util.get_string('expand', 'moodle')).then(function(html) {
action.set('innerHTML', html);
}).fail(Notification.exception);
});
if (ul) {
ul.setAttribute('aria-hidden', 'true');
}