Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 120... Línea 120...
120
                e.preventDefault();
120
                e.preventDefault();
121
                this.get('console').performAjaxAction('showcategory', catarg, this.show, this);
121
                this.get('console').performAjaxAction('showcategory', catarg, this.show, this);
122
                break;
122
                break;
123
            case 'hide':
123
            case 'hide':
124
                e.preventDefault();
124
                e.preventDefault();
-
 
125
                var courseCount = this.get('node').getData('course-count');
-
 
126
                if (courseCount === '0') {
125
                this.get('console').performAjaxAction('hidecategory', catarg, this.hide, this);
127
                    this.get('console').performAjaxAction('hidecategory', catarg, this.hide, this);
-
 
128
                    break;
-
 
129
                }
-
 
130
                var warningStr = courseCount === '1' ? 'hidecategoryone' : 'hidecategorymany';
-
 
131
                var warningParams = {
-
 
132
                    category: this.get('node').getData('category-name'),
-
 
133
                    coursecount: courseCount,
-
 
134
                };
-
 
135
                require(['core/notification', 'core/str'], function(Notification, Str) {
-
 
136
                    Notification.saveCancelPromise(
-
 
137
                        Str.get_string('hidecategory'),
-
 
138
                        Str.get_string(warningStr, 'core', warningParams),
-
 
139
                        Str.get_string('hide')
-
 
140
                    ).then(function() {
-
 
141
                        this.get('console').performAjaxAction('hidecategory', catarg, this.hide, this);
-
 
142
                    }.bind(this)
-
 
143
                    ).catch(function() {
-
 
144
                        // User cancelled, no action needed.
-
 
145
                    });
-
 
146
                }.bind(this));
126
                break;
147
                break;
127
            case 'expand':
148
            case 'expand':
128
                e.preventDefault();
149
                e.preventDefault();
129
                if (this.get('node').getData('expanded') === '0') {
150
                if (this.get('node').getData('expanded') === '0') {
130
                    this.get('node').setAttribute('data-expanded', '1').setData('expanded', 'true');
151
                    this.get('node').setAttribute('data-expanded', '1').setData('expanded', 'true');