Línea 643... |
Línea 643... |
643 |
initializer: function() {
|
643 |
initializer: function() {
|
644 |
var managementconsole = this.get('console'),
|
644 |
var managementconsole = this.get('console'),
|
645 |
container = managementconsole.get('element'),
|
645 |
container = managementconsole.get('element'),
|
646 |
categorylisting = container.one('#category-listing'),
|
646 |
categorylisting = container.one('#category-listing'),
|
647 |
courselisting = container.one('#course-listing > .course-listing'),
|
647 |
courselisting = container.one('#course-listing > .course-listing'),
|
648 |
categoryul = (categorylisting) ? categorylisting.one('ul.ml') : null,
|
648 |
categoryul = (categorylisting) ? categorylisting.one('ul.category-list') : null,
|
649 |
courseul = (courselisting) ? courselisting.one('ul.ml') : null,
|
649 |
courseul = (courselisting) ? courselisting.one('ul.course-list') : null,
|
650 |
canmoveoutof = (courselisting) ? courselisting.getData('canmoveoutof') : false,
|
650 |
canmoveoutof = (courselisting) ? courselisting.getData('canmoveoutof') : false,
|
651 |
contstraint = (canmoveoutof) ? container : courseul;
|
651 |
contstraint = (canmoveoutof) ? container : courseul;
|
Línea 652... |
Línea 652... |
652 |
|
652 |
|
653 |
if (!courseul) {
|
653 |
if (!courseul) {
|
Línea 1278... |
Línea 1278... |
1278 |
e.preventDefault();
|
1278 |
e.preventDefault();
|
1279 |
this.get('console').performAjaxAction('showcategory', catarg, this.show, this);
|
1279 |
this.get('console').performAjaxAction('showcategory', catarg, this.show, this);
|
1280 |
break;
|
1280 |
break;
|
1281 |
case 'hide':
|
1281 |
case 'hide':
|
1282 |
e.preventDefault();
|
1282 |
e.preventDefault();
|
- |
|
1283 |
var courseCount = this.get('node').getData('course-count');
|
- |
|
1284 |
if (courseCount === '0') {
|
1283 |
this.get('console').performAjaxAction('hidecategory', catarg, this.hide, this);
|
1285 |
this.get('console').performAjaxAction('hidecategory', catarg, this.hide, this);
|
- |
|
1286 |
break;
|
- |
|
1287 |
}
|
- |
|
1288 |
var warningStr = courseCount === '1' ? 'hidecategoryone' : 'hidecategorymany';
|
- |
|
1289 |
var warningParams = {
|
- |
|
1290 |
category: this.get('node').getData('category-name'),
|
- |
|
1291 |
coursecount: courseCount,
|
- |
|
1292 |
};
|
- |
|
1293 |
require(['core/notification', 'core/str'], function(Notification, Str) {
|
- |
|
1294 |
Notification.saveCancelPromise(
|
- |
|
1295 |
Str.get_string('hidecategory'),
|
- |
|
1296 |
Str.get_string(warningStr, 'core', warningParams),
|
- |
|
1297 |
Str.get_string('hide')
|
- |
|
1298 |
).then(function() {
|
- |
|
1299 |
this.get('console').performAjaxAction('hidecategory', catarg, this.hide, this);
|
- |
|
1300 |
}.bind(this)
|
- |
|
1301 |
).catch(function() {
|
- |
|
1302 |
// User cancelled, no action needed.
|
- |
|
1303 |
});
|
- |
|
1304 |
}.bind(this));
|
1284 |
break;
|
1305 |
break;
|
1285 |
case 'expand':
|
1306 |
case 'expand':
|
1286 |
e.preventDefault();
|
1307 |
e.preventDefault();
|
1287 |
if (this.get('node').getData('expanded') === '0') {
|
1308 |
if (this.get('node').getData('expanded') === '0') {
|
1288 |
this.get('node').setAttribute('data-expanded', '1').setData('expanded', 'true');
|
1309 |
this.get('node').setAttribute('data-expanded', '1').setData('expanded', 'true');
|