mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-27 15:50:29 +00:00
Update accept button in confirmation dialog
The only places where this dialog is used now will have the same button labels and format. We want to use "normal" destructive here so no additional "primary" styling. It seems that the focus on the action will only be applied automatically when it is primary. So extra code is needed. Bug: T299647 Change-Id: Ib5250b79e85d27ea197b83c6380863d0749e5d89
This commit is contained in:
parent
8fa3a7a4eb
commit
cede096333
|
@ -2250,11 +2250,10 @@
|
|||
"visualeditor-dialog-transclusion-add-template",
|
||||
"visualeditor-dialog-transclusion-add-undocumented-param",
|
||||
"visualeditor-dialog-transclusion-add-wikitext",
|
||||
"visualeditor-dialog-transclusion-back-confirmation-continue",
|
||||
"visualeditor-dialog-transclusion-back-confirmation-prompt",
|
||||
"visualeditor-dialog-transclusion-close-confirmation-continue",
|
||||
"visualeditor-dialog-transclusion-close-confirmation-prompt",
|
||||
"visualeditor-dialog-transclusion-collapse-options",
|
||||
"visualeditor-dialog-transclusion-confirmation-discard",
|
||||
"visualeditor-dialog-transclusion-confirmation-reject",
|
||||
"visualeditor-dialog-transclusion-content",
|
||||
"visualeditor-dialog-transclusion-contextitem-description",
|
||||
|
|
|
@ -193,11 +193,10 @@
|
|||
"visualeditor-dialog-transclusion-add-param-save": "Add parameter",
|
||||
"visualeditor-dialog-transclusion-add-template": "Add template",
|
||||
"visualeditor-dialog-transclusion-add-undocumented-param": "Add undocumented parameter",
|
||||
"visualeditor-dialog-transclusion-back-confirmation-continue": "Go back",
|
||||
"visualeditor-dialog-transclusion-back-confirmation-prompt": "Go back to search? Edits will be lost and cannot be undone.",
|
||||
"visualeditor-dialog-transclusion-close-confirmation-continue": "Close",
|
||||
"visualeditor-dialog-transclusion-close-confirmation-prompt": "Close template editor? Changes will be lost and cannot be undone.",
|
||||
"visualeditor-dialog-transclusion-collapse-options": "Hide options",
|
||||
"visualeditor-dialog-transclusion-confirmation-discard": "Discard edits",
|
||||
"visualeditor-dialog-transclusion-confirmation-reject": "Continue editing",
|
||||
"visualeditor-dialog-transclusion-content": "Content",
|
||||
"visualeditor-dialog-transclusion-contextitem-description": "Generated from: $1",
|
||||
|
|
|
@ -211,11 +211,10 @@
|
|||
"visualeditor-dialog-transclusion-add-param-save": "Label for save button that adds a new undocumented parameter to a transcluded template.",
|
||||
"visualeditor-dialog-transclusion-add-template": "Label for button that adds the specified template to the page.\n{{Identical|Add template}}",
|
||||
"visualeditor-dialog-transclusion-add-undocumented-param": "Label for button that adds a new undocumented parameter to a transcluded template.",
|
||||
"visualeditor-dialog-transclusion-back-confirmation-continue": "Button label to confirm abandoning an insert template dialog with unsaved changes.",
|
||||
"visualeditor-dialog-transclusion-back-confirmation-prompt": "Confirmation prompt for abandoning unsaved changes in an insert template dialog.",
|
||||
"visualeditor-dialog-transclusion-close-confirmation-continue": "Button label to confirm abandoning an edit template dialog with unsaved changes.\n{{identical|Close}}",
|
||||
"visualeditor-dialog-transclusion-close-confirmation-prompt": "Confirmation prompt for abandoning unsaved changes in an edit template dialog.",
|
||||
"visualeditor-dialog-transclusion-collapse-options": "Label for button that hides advanced options in transclusion dialog",
|
||||
"visualeditor-dialog-transclusion-confirmation-discard": "Button label to confirm abandoning a template dialog with unsaved changes",
|
||||
"visualeditor-dialog-transclusion-confirmation-reject": "Button label to reject a confirmation dialog, and continue editing.",
|
||||
"visualeditor-dialog-transclusion-content": "Label for editor of content between transclusion parts.\n{{Identical|Content}}",
|
||||
"visualeditor-dialog-transclusion-contextitem-description": "Message shown to an editor when they click on a template or group of templates that form a transclusion, listing the template(s) from which the transclusion is constructed.\n\n* $1 – the name of the template, or a list of the names of the templates if there are multiple.\n* $2 - number of templates for PLURAL support.",
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
* @param {Object} [config] Configuration options
|
||||
*/
|
||||
ve.ui.MWConfirmationDialog = function VeUiMWConfirmationDialog( config ) {
|
||||
this.accept = config.accept;
|
||||
|
||||
// Parent constructor
|
||||
ve.ui.MWConfirmationDialog.super.call( this, config );
|
||||
};
|
||||
|
@ -38,15 +36,12 @@ ve.ui.MWConfirmationDialog.static.size = 'small';
|
|||
* Open a confirmation dialog
|
||||
*
|
||||
* @param {string} prompt message key to show as dialog content
|
||||
* @param {string} accept message key for button label to continue
|
||||
* @param {Function} successCmd callback if continue action is chosen
|
||||
*/
|
||||
ve.ui.MWConfirmationDialog.confirm = function ( prompt, accept, successCmd ) {
|
||||
ve.ui.MWConfirmationDialog.confirm = function ( prompt, successCmd ) {
|
||||
var windowManager = new OO.ui.WindowManager();
|
||||
$( document.body ).append( windowManager.$element );
|
||||
var dialog = new ve.ui.MWConfirmationDialog( {
|
||||
accept: accept
|
||||
} );
|
||||
var dialog = new ve.ui.MWConfirmationDialog();
|
||||
windowManager.addWindows( [ dialog ] );
|
||||
windowManager.openWindow( dialog, {
|
||||
// Messages that can be used here:
|
||||
|
@ -82,14 +77,21 @@ ve.ui.MWConfirmationDialog.prototype.getSetupProcess = function ( data ) {
|
|||
},
|
||||
{
|
||||
action: 'accept',
|
||||
// Additional messages that can be used here:
|
||||
// * visualeditor-dialog-transclusion-back-confirmation-continue
|
||||
// * visualeditor-dialog-transclusion-close-confirmation-continue
|
||||
label: OO.ui.deferMsg( this.accept || 'ooui-dialog-message-accept' ),
|
||||
flags: 'primary'
|
||||
label: OO.ui.deferMsg( 'visualeditor-dialog-transclusion-confirmation-discard' ),
|
||||
flags: 'destructive'
|
||||
}
|
||||
]
|
||||
}, data );
|
||||
|
||||
return ve.ui.MWConfirmationDialog.super.prototype.getSetupProcess.call( this, data );
|
||||
};
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
ve.ui.MWConfirmationDialog.prototype.getReadyProcess = function ( data ) {
|
||||
// "normal" destructive actions don't get focus by default
|
||||
this.getActions().get( { actions: 'accept' } )[ 0 ].focus();
|
||||
|
||||
return ve.ui.MWConfirmationDialog.super.prototype.getReadyProcess.call( this, data );
|
||||
};
|
||||
|
|
|
@ -422,7 +422,6 @@ ve.ui.MWTransclusionDialog.prototype.getActionProcess = function ( action ) {
|
|||
if ( this.transclusionModel.containsValuableData() ) {
|
||||
ve.ui.MWConfirmationDialog.confirm(
|
||||
'visualeditor-dialog-transclusion-back-confirmation-prompt',
|
||||
'visualeditor-dialog-transclusion-back-confirmation-continue',
|
||||
this.resetDialog.bind( this )
|
||||
);
|
||||
} else {
|
||||
|
@ -442,7 +441,6 @@ ve.ui.MWTransclusionDialog.prototype.getActionProcess = function ( action ) {
|
|||
return new OO.ui.Process( function () {
|
||||
ve.ui.MWConfirmationDialog.confirm(
|
||||
'visualeditor-dialog-transclusion-close-confirmation-prompt',
|
||||
'visualeditor-dialog-transclusion-close-confirmation-continue',
|
||||
this.close.bind( this ) );
|
||||
}, this );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue