VESwitchConfirmDialog: Use modes to hide 'keep' button

Change-Id: I92110ea14ded335db330721c08314c7a20169886
This commit is contained in:
Ed Sanders 2015-11-03 18:57:15 +00:00
parent 07c6c17e5c
commit 28a5d0db84

View file

@ -43,12 +43,20 @@ ve.ui.MWVESwitchConfirmDialog.static.actions = [
{ {
action: 'cancel', action: 'cancel',
label: mw.msg( 'visualeditor-mweditmodesource-warning-cancel' ), label: mw.msg( 'visualeditor-mweditmodesource-warning-cancel' ),
flags: [ 'safe', 'back' ] flags: [ 'safe', 'back' ],
modes: [ 'restbase', 'simple' ]
}, },
{ {
action: 'discard', action: 'discard',
label: mw.msg( 'visualeditor-mweditmodesource-warning-switch-discard' ), label: mw.msg( 'visualeditor-mweditmodesource-warning-switch-discard' ),
flags: 'destructive' flags: 'destructive',
modes: [ 'restbase', 'simple' ]
},
{
action: 'keep',
label: mw.msg( 'visualeditor-mweditmodesource-warning-switch' ),
flags: [ 'progressive', 'primary' ],
modes: [ 'restbase' ]
} }
]; ];
@ -58,16 +66,9 @@ ve.ui.MWVESwitchConfirmDialog.static.actions = [
* @inheritdoc * @inheritdoc
*/ */
ve.ui.MWVESwitchConfirmDialog.prototype.getSetupProcess = function () { ve.ui.MWVESwitchConfirmDialog.prototype.getSetupProcess = function () {
return ve.ui.MWVESwitchConfirmDialog.super.prototype.getSetupProcess return ve.ui.MWVESwitchConfirmDialog.super.prototype.getSetupProcess.apply( this, arguments )
.apply( this, arguments )
.next( function () { .next( function () {
if ( mw.config.get( 'wgVisualEditorConfig' ).fullRestbaseUrl ) { this.actions.setMode( mw.config.get( 'wgVisualEditorConfig' ).fullRestbaseUrl ? 'restbase' : 'simple' );
this.getActions().add( [ new OO.ui.ActionWidget( {
action: 'keep',
label: mw.msg( 'visualeditor-mweditmodesource-warning-switch' ),
flags: [ 'progressive', 'primary' ]
} ) ] );
}
}, this ); }, this );
}; };