| Línea 59... |
Línea 59... |
| 59 |
this._region.find('[data-action="change-user"]').on('change', this._handleChangeUser.bind(this));
|
59 |
this._region.find('[data-action="change-user"]').on('change', this._handleChangeUser.bind(this));
|
| 60 |
this._region.find('[data-region="user-filters"]').on('click', this._toggleExpandFilters.bind(this));
|
60 |
this._region.find('[data-region="user-filters"]').on('click', this._toggleExpandFilters.bind(this));
|
| 61 |
this._region.find('[data-region="user-resettable"]').on('click', this._toggleResetTable.bind());
|
61 |
this._region.find('[data-region="user-resettable"]').on('click', this._toggleResetTable.bind());
|
| Línea 62... |
Línea 62... |
| 62 |
|
62 |
|
| - |
|
63 |
$(document).on('user-changed', this._refreshSelector.bind(this));
|
| 63 |
$(document).on('user-changed', this._refreshSelector.bind(this));
|
64 |
$(document).on('reset-table', this._toggleResetTable.bind(this));
|
| Línea 64... |
Línea 65... |
| 64 |
$(document).on('done-saving-show-next', this._handleNextUser.bind(this));
|
65 |
$(document).on('done-saving-show-next', this._handleNextUser.bind(this));
|
| 65 |
|
66 |
|
| 66 |
// Position the configure filters panel under the link that expands it.
|
67 |
// Position the configure filters panel under the link that expands it.
|
| Línea 156... |
Línea 157... |
| 156 |
// Position the configure filters panel under the link that expands it.
|
157 |
// Position the configure filters panel under the link that expands it.
|
| 157 |
var toggleLink = this._region.find('[data-region="user-filters"]');
|
158 |
var toggleLink = this._region.find('[data-region="user-filters"]');
|
| 158 |
var configPanel = $(document.getElementById(toggleLink.attr('aria-controls')));
|
159 |
var configPanel = $(document.getElementById(toggleLink.attr('aria-controls')));
|
| Línea 159... |
Línea 160... |
| 159 |
|
160 |
|
| - |
|
161 |
configPanel.find('select[name="filter"]').trigger('change');
|
| - |
|
162 |
|
| - |
|
163 |
$('[data-region="grade-panel"]').show();
|
| 160 |
configPanel.find('select[name="filter"]').trigger('change');
|
164 |
$('[data-region="grade-actions-panel"]').show();
|
| 161 |
} else {
|
165 |
} else {
|
| 162 |
this._selectNoUser();
|
166 |
this._selectNoUser();
|
| 163 |
}
|
167 |
}
|
| 164 |
this._triggerNextUserEvent();
|
168 |
this._triggerNextUserEvent();
|
| Línea 253... |
Línea 257... |
| 253 |
}.bind(this)).fail(notification.exception);
|
257 |
}.bind(this)).fail(notification.exception);
|
| 254 |
}
|
258 |
}
|
| Línea 255... |
Línea 259... |
| 255 |
|
259 |
|
| 256 |
var select = this._region.find('[data-action=change-user]');
|
260 |
var select = this._region.find('[data-action=change-user]');
|
| 257 |
var currentUserID = select.data('currentuserid');
|
261 |
var currentUserID = select.data('currentuserid');
|
| 258 |
this._updateFilterPreferences(currentUserID, this._filters, preferenceNames).done(function() {
|
262 |
this._updateFilterPreferences(currentUserID, this._filters, preferenceNames).then(function() {
|
| 259 |
// Reload the list of users to apply the new filters.
|
263 |
// Reload the list of users to apply the new filters.
|
| 260 |
if (!this._loadAllUsers()) {
|
264 |
if (!this._loadAllUsers()) {
|
| 261 |
var userid = parseInt(select.attr('data-selected'));
|
265 |
var userid = parseInt(select.attr('data-selected'));
|
| 262 |
let foundIndex = null;
|
266 |
let foundIndex = null;
|
| Línea 265... |
Línea 269... |
| 265 |
if (userid == user.id) {
|
269 |
if (userid == user.id) {
|
| 266 |
foundIndex = index;
|
270 |
foundIndex = index;
|
| 267 |
}
|
271 |
}
|
| 268 |
});
|
272 |
});
|
| Línea 269... |
Línea 273... |
| 269 |
|
273 |
|
| 270 |
if (this._filteredUsers.length && foundIndex !== null) {
|
274 |
if (this._filteredUsers.length) {
|
| 271 |
this._selectUserById(this._filteredUsers[foundIndex].id);
|
275 |
this._selectUserById(this._filteredUsers[foundIndex ?? 0].id);
|
| 272 |
} else {
|
276 |
} else {
|
| 273 |
this._selectNoUser();
|
277 |
this._selectNoUser();
|
| Línea 274... |
Línea 278... |
| 274 |
}
|
278 |
}
|
| 275 |
|
279 |
|
| 276 |
}
|
280 |
}
|
| 277 |
}.bind(this)).fail(notification.exception);
|
281 |
}.bind(this)).catch(notification.exception);
|
| Línea 278... |
Línea 282... |
| 278 |
this._refreshCount();
|
282 |
this._refreshCount();
|
| 279 |
};
|
283 |
};
|
| Línea 287... |
Línea 291... |
| 287 |
GradingNavigation.prototype._selectNoUser = function() {
|
291 |
GradingNavigation.prototype._selectNoUser = function() {
|
| 288 |
// Detect unsaved changes, and offer to save them - otherwise change user right now.
|
292 |
// Detect unsaved changes, and offer to save them - otherwise change user right now.
|
| 289 |
if (this._isLoading) {
|
293 |
if (this._isLoading) {
|
| 290 |
return;
|
294 |
return;
|
| 291 |
}
|
295 |
}
|
| - |
|
296 |
|
| - |
|
297 |
$('[data-region="grade-panel"]').hide();
|
| - |
|
298 |
$('[data-region="grade-actions-panel"]').hide();
|
| - |
|
299 |
|
| 292 |
if (checker.checkFormForChanges('[data-region="grade-panel"] .gradeform')) {
|
300 |
if (checker.checkFormForChanges('[data-region="grade-panel"] .gradeform')) {
|
| 293 |
// Form has changes, so we need to confirm before switching users.
|
301 |
// Form has changes, so we need to confirm before switching users.
|
| 294 |
str.get_strings([
|
302 |
str.get_strings([
|
| 295 |
{key: 'unsavedchanges', component: 'mod_assign'},
|
303 |
{key: 'unsavedchanges', component: 'mod_assign'},
|
| 296 |
{key: 'unsavedchangesquestion', component: 'mod_assign'},
|
304 |
{key: 'unsavedchangesquestion', component: 'mod_assign'},
|