| Línea 650... |
Línea 650... |
| 650 |
initializer: function() {
|
650 |
initializer: function() {
|
| 651 |
var managementconsole = this.get('console'),
|
651 |
var managementconsole = this.get('console'),
|
| 652 |
container = managementconsole.get('element'),
|
652 |
container = managementconsole.get('element'),
|
| 653 |
categorylisting = container.one('#category-listing'),
|
653 |
categorylisting = container.one('#category-listing'),
|
| 654 |
courselisting = container.one('#course-listing > .course-listing'),
|
654 |
courselisting = container.one('#course-listing > .course-listing'),
|
| 655 |
categoryul = (categorylisting) ? categorylisting.one('ul.ml') : null,
|
655 |
categoryul = (categorylisting) ? categorylisting.one('ul.category-list') : null,
|
| 656 |
courseul = (courselisting) ? courselisting.one('ul.ml') : null,
|
656 |
courseul = (courselisting) ? courselisting.one('ul.course-list') : null,
|
| 657 |
canmoveoutof = (courselisting) ? courselisting.getData('canmoveoutof') : false,
|
657 |
canmoveoutof = (courselisting) ? courselisting.getData('canmoveoutof') : false,
|
| 658 |
contstraint = (canmoveoutof) ? container : courseul;
|
658 |
contstraint = (canmoveoutof) ? container : courseul;
|
| Línea 659... |
Línea 659... |
| 659 |
|
659 |
|
| 660 |
if (!courseul) {
|
660 |
if (!courseul) {
|
| Línea 1304... |
Línea 1304... |
| 1304 |
e.preventDefault();
|
1304 |
e.preventDefault();
|
| 1305 |
this.get('console').performAjaxAction('showcategory', catarg, this.show, this);
|
1305 |
this.get('console').performAjaxAction('showcategory', catarg, this.show, this);
|
| 1306 |
break;
|
1306 |
break;
|
| 1307 |
case 'hide':
|
1307 |
case 'hide':
|
| 1308 |
e.preventDefault();
|
1308 |
e.preventDefault();
|
| - |
|
1309 |
var courseCount = this.get('node').getData('course-count');
|
| - |
|
1310 |
if (courseCount === '0') {
|
| 1309 |
this.get('console').performAjaxAction('hidecategory', catarg, this.hide, this);
|
1311 |
this.get('console').performAjaxAction('hidecategory', catarg, this.hide, this);
|
| - |
|
1312 |
break;
|
| - |
|
1313 |
}
|
| - |
|
1314 |
var warningStr = courseCount === '1' ? 'hidecategoryone' : 'hidecategorymany';
|
| - |
|
1315 |
var warningParams = {
|
| - |
|
1316 |
category: this.get('node').getData('category-name'),
|
| - |
|
1317 |
coursecount: courseCount,
|
| - |
|
1318 |
};
|
| - |
|
1319 |
require(['core/notification', 'core/str'], function(Notification, Str) {
|
| - |
|
1320 |
Notification.saveCancelPromise(
|
| - |
|
1321 |
Str.get_string('hidecategory'),
|
| - |
|
1322 |
Str.get_string(warningStr, 'core', warningParams),
|
| - |
|
1323 |
Str.get_string('hide')
|
| - |
|
1324 |
).then(function() {
|
| - |
|
1325 |
this.get('console').performAjaxAction('hidecategory', catarg, this.hide, this);
|
| - |
|
1326 |
}.bind(this)
|
| - |
|
1327 |
).catch(function() {
|
| - |
|
1328 |
// User cancelled, no action needed.
|
| - |
|
1329 |
});
|
| - |
|
1330 |
}.bind(this));
|
| 1310 |
break;
|
1331 |
break;
|
| 1311 |
case 'expand':
|
1332 |
case 'expand':
|
| 1312 |
e.preventDefault();
|
1333 |
e.preventDefault();
|
| 1313 |
if (this.get('node').getData('expanded') === '0') {
|
1334 |
if (this.get('node').getData('expanded') === '0') {
|
| 1314 |
this.get('node').setAttribute('data-expanded', '1').setData('expanded', 'true');
|
1335 |
this.get('node').setAttribute('data-expanded', '1').setData('expanded', 'true');
|