From 28a5d0db84324756139e00395bfd4a61d5f9060a Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Tue, 3 Nov 2015 18:57:15 +0000 Subject: [PATCH] VESwitchConfirmDialog: Use modes to hide 'keep' button Change-Id: I92110ea14ded335db330721c08314c7a20169886 --- .../dialogs/ve.ui.MWVESwitchConfirmDialog.js | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWVESwitchConfirmDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWVESwitchConfirmDialog.js index 95dc105509..b94e5c1186 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWVESwitchConfirmDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWVESwitchConfirmDialog.js @@ -43,12 +43,20 @@ ve.ui.MWVESwitchConfirmDialog.static.actions = [ { action: 'cancel', label: mw.msg( 'visualeditor-mweditmodesource-warning-cancel' ), - flags: [ 'safe', 'back' ] + flags: [ 'safe', 'back' ], + modes: [ 'restbase', 'simple' ] }, { action: '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 */ ve.ui.MWVESwitchConfirmDialog.prototype.getSetupProcess = function () { - return ve.ui.MWVESwitchConfirmDialog.super.prototype.getSetupProcess - .apply( this, arguments ) + return ve.ui.MWVESwitchConfirmDialog.super.prototype.getSetupProcess.apply( this, arguments ) .next( function () { - if ( mw.config.get( 'wgVisualEditorConfig' ).fullRestbaseUrl ) { - this.getActions().add( [ new OO.ui.ActionWidget( { - action: 'keep', - label: mw.msg( 'visualeditor-mweditmodesource-warning-switch' ), - flags: [ 'progressive', 'primary' ] - } ) ] ); - } + this.actions.setMode( mw.config.get( 'wgVisualEditorConfig' ).fullRestbaseUrl ? 'restbase' : 'simple' ); }, this ); };