mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-65093 core_message: show 'OK' dialogue
This commit is contained in:
parent
66fffdbce5
commit
386634bab3
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1545,6 +1545,7 @@ function(
|
||||
[SELECTORS.ACTION_CONFIRM_REMOVE_CONTACT, generateConfirmActionHandler(removeContact)],
|
||||
[SELECTORS.ACTION_CONFIRM_DELETE_SELECTED_MESSAGES, generateConfirmActionHandler(deleteSelectedMessages)],
|
||||
[SELECTORS.ACTION_CONFIRM_DELETE_CONVERSATION, generateConfirmActionHandler(deleteConversation)],
|
||||
[SELECTORS.ACTION_OKAY_CONFIRM, generateConfirmActionHandler(cancelRequest)],
|
||||
[SELECTORS.ACTION_REQUEST_ADD_CONTACT, generateConfirmActionHandler(requestAddContact)],
|
||||
[SELECTORS.ACTION_ACCEPT_CONTACT_REQUEST, generateConfirmActionHandler(acceptContactRequest)],
|
||||
[SELECTORS.ACTION_DECLINE_CONTACT_REQUEST, generateConfirmActionHandler(declineContactRequest)],
|
||||
|
@ -25,6 +25,7 @@ define([], function() {
|
||||
var SELECTORS = {
|
||||
ACTION_ACCEPT_CONTACT_REQUEST: '[data-action="accept-contact-request"]',
|
||||
ACTION_CANCEL_CONFIRM: '[data-action="cancel-confirm"]',
|
||||
ACTION_OKAY_CONFIRM: '[data-action="okay-confirm"]',
|
||||
ACTION_CANCEL_EDIT_MODE: '[data-action="cancel-edit-mode"]',
|
||||
ACTION_CONFIRM_ADD_CONTACT: '[data-action="confirm-add-contact"]',
|
||||
ACTION_CONFIRM_BLOCK: '[data-action="confirm-block"]',
|
||||
@ -50,6 +51,7 @@ define([], function() {
|
||||
CONFIRM_DIALOGUE_CANCEL_BUTTON: '[data-action="cancel-confirm"]',
|
||||
CONFIRM_DIALOGUE_CONTAINER: '[data-region="confirm-dialogue-container"]',
|
||||
CONFIRM_DIALOGUE_HEADER: '[data-region="dialogue-header"]',
|
||||
CONFIRM_DIALOGUE_OKAY_BUTTON: '[data-action="okay-confirm"]',
|
||||
CONFIRM_DIALOGUE_TEXT: '[data-region="dialogue-text"]',
|
||||
CONTACT_REQUEST_SENT_MESSAGE_CONTAINER: '[data-region="contact-request-sent-message-container"]',
|
||||
CONTENT_PLACEHOLDER_CONTAINER: '[data-region="content-placeholder"]',
|
||||
|
@ -981,6 +981,7 @@ function(
|
||||
* @param {String} headerText Text to show in dialogue header.
|
||||
* @param {Bool} canCancel Can this dialogue be cancelled.
|
||||
* @param {Bool} skipHeader Skip blanking out the header
|
||||
* @param {Bool} showOk Show an 'Okay' button for a dialogue which will close it
|
||||
*/
|
||||
var showConfirmDialogue = function(
|
||||
header,
|
||||
@ -990,13 +991,15 @@ function(
|
||||
bodyText,
|
||||
headerText,
|
||||
canCancel,
|
||||
skipHeader
|
||||
skipHeader,
|
||||
showOk
|
||||
) {
|
||||
var dialogue = getConfirmDialogueContainer(body);
|
||||
var buttons = buttonSelectors.map(function(selector) {
|
||||
return dialogue.find(selector);
|
||||
});
|
||||
var cancelButton = dialogue.find(SELECTORS.CONFIRM_DIALOGUE_CANCEL_BUTTON);
|
||||
var okayButton = dialogue.find(SELECTORS.CONFIRM_DIALOGUE_OKAY_BUTTON);
|
||||
var text = dialogue.find(SELECTORS.CONFIRM_DIALOGUE_TEXT);
|
||||
var dialogueHeader = dialogue.find(SELECTORS.CONFIRM_DIALOGUE_HEADER);
|
||||
|
||||
@ -1008,6 +1011,12 @@ function(
|
||||
cancelButton.addClass('hidden');
|
||||
}
|
||||
|
||||
if (showOk) {
|
||||
okayButton.removeClass('hidden');
|
||||
} else {
|
||||
okayButton.addClass('hidden');
|
||||
}
|
||||
|
||||
if (headerText) {
|
||||
dialogueHeader.removeClass('hidden');
|
||||
dialogueHeader.text(headerText);
|
||||
@ -1041,6 +1050,7 @@ function(
|
||||
var hideConfirmDialogue = function(header, body, footer) {
|
||||
var dialogue = getConfirmDialogueContainer(body);
|
||||
var cancelButton = dialogue.find(SELECTORS.CONFIRM_DIALOGUE_CANCEL_BUTTON);
|
||||
var okayButton = dialogue.find(SELECTORS.CONFIRM_DIALOGUE_OKAY_BUTTON);
|
||||
var text = dialogue.find(SELECTORS.CONFIRM_DIALOGUE_TEXT);
|
||||
var dialogueHeader = dialogue.find(SELECTORS.CONFIRM_DIALOGUE_HEADER);
|
||||
|
||||
@ -1050,6 +1060,7 @@ function(
|
||||
hideConfirmDialogueContainer(header);
|
||||
dialogue.find('button').addClass('hidden');
|
||||
cancelButton.removeClass('hidden');
|
||||
okayButton.removeClass('hidden');
|
||||
text.text('');
|
||||
dialogueHeader.addClass('hidden');
|
||||
dialogueHeader.text('');
|
||||
@ -1072,7 +1083,7 @@ function(
|
||||
if (user.canmessageevenifblocked) {
|
||||
return Str.get_string('cantblockuser', 'core_message', user.fullname)
|
||||
.then(function(string) {
|
||||
return showConfirmDialogue(header, body, footer, [], string, '', true, false);
|
||||
return showConfirmDialogue(header, body, footer, [], string, '', false, false, true);
|
||||
});
|
||||
} else {
|
||||
return Str.get_string('blockuserconfirm', 'core_message', user.fullname)
|
||||
|
@ -80,5 +80,6 @@
|
||||
<span data-region="dialogue-button-text">{{#str}} decline, core_message {{/str}}</span>
|
||||
<span class="hidden" data-region="loading-icon-container">{{> core/loading }}</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary btn-block" data-action="okay-confirm">{{#str}} ok, core {{/str}}</button>
|
||||
<button type="button" class="btn btn-secondary btn-block" data-action="cancel-confirm">{{#str}} cancel, core {{/str}}</button>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user