MDL-59499 coursemanagement: Rewitten expand and collapse

Also replace M.util.get_string() calls with core/str module
This commit is contained in:
Andrew Davidson 2017-07-19 13:40:26 +01:00 committed by David Monllao
parent d040476723
commit 9c631e9408
4 changed files with 50 additions and 26 deletions

View File

@ -1354,10 +1354,14 @@ Category.prototype = {
title: M.util.get_string('collapsecategory', 'moodle', this.getName())
});
require(['core/templates', 'core/notification'], function(Templates, Notification) {
Templates.renderPix('t/switch_minus', 'core', M.util.get_string('collapse', 'moodle')).then(function(html) {
action.set('innerHTML', html);
}).fail(Notification.exception);
require(['core/str', 'core/templates', 'core/notification'], function(Str, Templates, Notification) {
Str.get_string('collapse', 'core')
.then(function(string) {
return Templates.renderPix('t/switch_minus', 'core', string);
})
.then(function(html) {
return action.set('innerHTML', html);
}).fail(Notification.exception);
});
if (ul) {
@ -1379,10 +1383,14 @@ Category.prototype = {
title: M.util.get_string('expandcategory', 'moodle', this.getName())
});
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);
require(['core/str', 'core/templates', 'core/notification'], function(Str, Templates, Notification) {
Str.get_string('expand', 'core')
.then(function(string) {
return Templates.renderPix('t/switch_plus', 'core', string);
})
.then(function(html) {
return action.set('innerHTML', html);
}).fail(Notification.exception);
});
if (ul) {

File diff suppressed because one or more lines are too long

View File

@ -1327,10 +1327,14 @@ Category.prototype = {
title: M.util.get_string('collapsecategory', 'moodle', this.getName())
});
require(['core/templates', 'core/notification'], function(Templates, Notification) {
Templates.renderPix('t/switch_minus', 'core', M.util.get_string('collapse', 'moodle')).then(function(html) {
action.set('innerHTML', html);
}).fail(Notification.exception);
require(['core/str', 'core/templates', 'core/notification'], function(Str, Templates, Notification) {
Str.get_string('collapse', 'core')
.then(function(string) {
return Templates.renderPix('t/switch_minus', 'core', string);
})
.then(function(html) {
return action.set('innerHTML', html);
}).fail(Notification.exception);
});
if (ul) {
@ -1352,10 +1356,14 @@ Category.prototype = {
title: M.util.get_string('expandcategory', 'moodle', this.getName())
});
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);
require(['core/str', 'core/templates', 'core/notification'], function(Str, Templates, Notification) {
Str.get_string('expand', 'core')
.then(function(string) {
return Templates.renderPix('t/switch_plus', 'core', string);
})
.then(function(html) {
return action.set('innerHTML', html);
}).fail(Notification.exception);
});
if (ul) {

View File

@ -171,10 +171,14 @@ Category.prototype = {
title: M.util.get_string('collapsecategory', 'moodle', this.getName())
});
require(['core/templates', 'core/notification'], function(Templates, Notification) {
Templates.renderPix('t/switch_minus', 'core', M.util.get_string('collapse', 'moodle')).then(function(html) {
action.set('innerHTML', html);
}).fail(Notification.exception);
require(['core/str', 'core/templates', 'core/notification'], function(Str, Templates, Notification) {
Str.get_string('collapse', 'core')
.then(function(string) {
return Templates.renderPix('t/switch_minus', 'core', string);
})
.then(function(html) {
return action.set('innerHTML', html);
}).fail(Notification.exception);
});
if (ul) {
@ -196,10 +200,14 @@ Category.prototype = {
title: M.util.get_string('expandcategory', 'moodle', this.getName())
});
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);
require(['core/str', 'core/templates', 'core/notification'], function(Str, Templates, Notification) {
Str.get_string('expand', 'core')
.then(function(string) {
return Templates.renderPix('t/switch_plus', 'core', string);
})
.then(function(html) {
return action.set('innerHTML', html);
}).fail(Notification.exception);
});
if (ul) {