mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
MDL-60430 assignment: Assignment save and show next for 1 user
This commit is contained in:
parent
849405177f
commit
6a633d36c2
File diff suppressed because one or more lines are too long
2
mod/assign/amd/build/grading_panel.min.js
vendored
2
mod/assign/amd/build/grading_panel.min.js
vendored
File diff suppressed because one or more lines are too long
@ -130,6 +130,7 @@ define(['jquery', 'core/notification', 'core/str', 'core/form-autocomplete',
|
||||
} else {
|
||||
this._selectNoUser();
|
||||
}
|
||||
this._triggerNextUserEvent();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -233,6 +234,7 @@ define(['jquery', 'core/notification', 'core/str', 'core/form-autocomplete',
|
||||
} else {
|
||||
this._selectNoUser();
|
||||
}
|
||||
this._triggerNextUserEvent();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -447,6 +449,20 @@ define(['jquery', 'core/notification', 'core/str', 'core/form-autocomplete',
|
||||
this._refreshCount();
|
||||
};
|
||||
|
||||
/**
|
||||
* Trigger the next user event depending on the number of filtered users
|
||||
*
|
||||
* @private
|
||||
* @method _triggerNextUserEvent
|
||||
*/
|
||||
GradingNavigation.prototype._triggerNextUserEvent = function() {
|
||||
if (this._filteredUsers.length > 1) {
|
||||
$(document).trigger('next-user', {nextUserId: null, nextUser: true});
|
||||
} else {
|
||||
$(document).trigger('next-user', {nextUser: false});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Change to a different user in the grading list.
|
||||
*
|
||||
|
@ -54,6 +54,12 @@ define(['jquery', 'core/yui', 'core/notification', 'core/templates', 'core/fragm
|
||||
/** @type {JQuery} JQuery node for the page region containing the user navigation. */
|
||||
GradingPanel.prototype._region = null;
|
||||
|
||||
/** @type {Integer} The id of the next user in the grading list */
|
||||
GradingPanel.prototype.nextUserId = null;
|
||||
|
||||
/** @type {Boolean} Next user exists in the grading list */
|
||||
GradingPanel.prototype.nextUser = false;
|
||||
|
||||
/**
|
||||
* Fade the dom node out, update it, and fade it back.
|
||||
*
|
||||
@ -314,6 +320,29 @@ define(['jquery', 'core/yui', 'core/notification', 'core/templates', 'core/fragm
|
||||
}.bind(this)).fail(notification.exception);
|
||||
};
|
||||
|
||||
/**
|
||||
* Get next user data and store it in global variables
|
||||
*
|
||||
* @private
|
||||
* @method _getNextUser
|
||||
* @param {Event} event
|
||||
* @param {Object} data Next user's data
|
||||
*/
|
||||
GradingPanel.prototype._getNextUser = function(event, data) {
|
||||
this.nextUserId = data.nextUserId;
|
||||
this.nextUser = data.nextUser;
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle the save-and-show-next event
|
||||
*
|
||||
* @private
|
||||
* @method _handleSaveAndShowNext
|
||||
*/
|
||||
GradingPanel.prototype._handleSaveAndShowNext = function() {
|
||||
this._submitForm(null, this.nextUserId, this.nextUser);
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the grade panel element.
|
||||
*
|
||||
@ -355,9 +384,10 @@ define(['jquery', 'core/yui', 'core/notification', 'core/templates', 'core/fragm
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
docElement.on('next-user', this._getNextUser.bind(this));
|
||||
docElement.on('user-changed', this._refreshGradingPanel.bind(this));
|
||||
docElement.on('save-changes', this._submitForm.bind(this));
|
||||
docElement.on('save-and-show-next', this._submitForm.bind(this, null, null, true));
|
||||
docElement.on('save-and-show-next', this._handleSaveAndShowNext.bind(this));
|
||||
docElement.on('reset', this._resetForm.bind(this));
|
||||
|
||||
docElement.on('save-form-state', this._saveFormState.bind(this));
|
||||
|
Loading…
x
Reference in New Issue
Block a user