mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 12:32:08 +02:00
MDL-76848 core: add disable buttons to modals
This commit is contained in:
parent
8503f2cfd8
commit
b1ad8480fe
2
lib/amd/build/modal.min.js
vendored
2
lib/amd/build/modal.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1008,5 +1008,24 @@ define([
|
||||
this.focusOnClose = element;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the a button enabled or disabled.
|
||||
*
|
||||
* @param {DOMString} action The action of the button
|
||||
* @param {Boolean} disabled the new disabled value
|
||||
*/
|
||||
Modal.prototype.setButtonDisabled = function(action, disabled) {
|
||||
const button = this.getFooter().find(this.getActionSelector(action));
|
||||
|
||||
if (!button) {
|
||||
throw new Error("Unable to find the '" + action + "' button");
|
||||
}
|
||||
if (disabled) {
|
||||
button.attr('disabled', '');
|
||||
} else {
|
||||
button.removeAttr('disabled');
|
||||
}
|
||||
};
|
||||
|
||||
return Modal;
|
||||
});
|
||||
|
@ -62,6 +62,9 @@ information provided here is intended especially for developers.
|
||||
description being incorrectly passed for the $required parameter). A debugging notice will be shown when such cases occur.
|
||||
* The moodle-core-popuphelp YUI modal has been removed. It has not been actively used in Moodle since 3.3. It should be replaced with appropriate ESM/AMD JavaScript.
|
||||
* The moodle-core-tooltip YUI modal has been removed. It should be replaced with appropriate ESM/AMD JavaScript.
|
||||
* The core/modal module and all their versions (SAVE_CANCEL, DELETE_CANCEL...) now has a setButtonDisable to disable or enable
|
||||
specific modal action buttons. This function allows developers to have modals that could only be submited if the user do some
|
||||
action in the modal body like ticking a checkbox or selecting an element.
|
||||
|
||||
=== 4.1 ===
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user