2015-06-29 21:11:39 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor user interface MWWelcomeDialog class.
|
|
|
|
*
|
2016-01-03 22:56:59 +00:00
|
|
|
* @copyright 2011-2016 VisualEditor Team and others; see AUTHORS.txt
|
2015-06-29 21:11:39 +00:00
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Dialog for welcoming new users to VisualEditor.
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @extends OO.ui.MessageDialog
|
|
|
|
*
|
|
|
|
* @constructor
|
|
|
|
* @param {Object} [config] Configuration options
|
|
|
|
*/
|
|
|
|
ve.ui.MWWelcomeDialog = function VeUiMWWelcomeDialog( config ) {
|
|
|
|
// Parent constructor
|
|
|
|
ve.ui.MWWelcomeDialog.super.call( this, config );
|
2016-02-19 18:47:33 +00:00
|
|
|
|
|
|
|
this.$element
|
|
|
|
.addClass( 've-init-mw-desktopArticleTarget-windowManager' )
|
|
|
|
.addClass( 've-init-mw-desktopArticleTarget-windowManager-welcome' );
|
2015-06-29 21:11:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
|
|
|
OO.inheritClass( ve.ui.MWWelcomeDialog, OO.ui.MessageDialog );
|
|
|
|
|
|
|
|
/* Static Properties */
|
|
|
|
|
|
|
|
ve.ui.MWWelcomeDialog.static.name = 'welcome';
|
|
|
|
|
|
|
|
ve.ui.MWWelcomeDialog.static.size = 'medium';
|
|
|
|
|
|
|
|
ve.ui.MWWelcomeDialog.static.verbose = true;
|
|
|
|
|
|
|
|
ve.ui.MWWelcomeDialog.static.icon = 'help';
|
|
|
|
|
|
|
|
ve.ui.MWWelcomeDialog.static.actions = [
|
|
|
|
{
|
2015-12-12 03:12:38 +00:00
|
|
|
action: 'switch',
|
|
|
|
label: OO.ui.deferMsg( 'visualeditor-welcomedialog-switch' )
|
|
|
|
},
|
|
|
|
{
|
|
|
|
action: 'accept',
|
2015-06-29 21:11:39 +00:00
|
|
|
label: OO.ui.deferMsg( 'visualeditor-welcomedialog-action' ),
|
|
|
|
flags: [ 'progressive', 'primary' ]
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
ve.ui.MWWelcomeDialog.prototype.getSetupProcess = function ( data ) {
|
|
|
|
// Provide default title and message
|
|
|
|
data = $.extend( {
|
|
|
|
title: ve.msg( 'visualeditor-welcomedialog-title', mw.user, mw.config.get( 'wgSiteName' ) ),
|
|
|
|
message: $( '<div>' ).addClass( 'visualeditor-welcomedialog-content' )
|
2015-09-15 23:25:48 +00:00
|
|
|
.append(
|
|
|
|
$( '<span>' )
|
|
|
|
.addClass( 'visualeditor-welcomedialog-content-text' )
|
2015-09-16 21:54:11 +00:00
|
|
|
.html(
|
2015-09-15 23:25:48 +00:00
|
|
|
ve.msg( 'visualeditor-welcomedialog-content' ) +
|
|
|
|
'<br />' +
|
|
|
|
ve.msg( 'visualeditor-welcomedialog-content-thanks' )
|
|
|
|
)
|
|
|
|
)
|
2015-06-29 21:11:39 +00:00
|
|
|
}, data );
|
|
|
|
|
2016-02-19 18:47:33 +00:00
|
|
|
if ( data.targetName === 'mobile' ) {
|
|
|
|
this.mobile = true;
|
|
|
|
}
|
|
|
|
|
2015-06-29 21:11:39 +00:00
|
|
|
return ve.ui.MWWelcomeDialog.super.prototype.getSetupProcess.call( this, data );
|
|
|
|
};
|
|
|
|
|
2016-02-19 18:47:33 +00:00
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
ve.ui.MWWelcomeDialog.prototype.getReadyProcess = function () {
|
|
|
|
if ( this.mobile ) {
|
|
|
|
this.actions.remove( this.actions.get( { actions: 'switch' } ) ); // ew
|
|
|
|
}
|
|
|
|
|
|
|
|
return ve.ui.MWWelcomeDialog.super.prototype.getReadyProcess.apply( this, arguments );
|
|
|
|
};
|
|
|
|
|
2015-12-12 03:12:38 +00:00
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
ve.ui.MWWelcomeDialog.prototype.getActionProcess = function ( action ) {
|
|
|
|
if ( action === 'switch' ) {
|
|
|
|
return new OO.ui.Process( function () {
|
|
|
|
this.close( { action: 'switch' } );
|
|
|
|
}, this );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Parent method
|
|
|
|
return ve.ui.MWWelcomeDialog.super.prototype.getActionProcess.call( this, action );
|
|
|
|
};
|
|
|
|
|
2015-06-29 21:11:39 +00:00
|
|
|
/* Registration */
|
|
|
|
|
|
|
|
ve.ui.windowFactory.register( ve.ui.MWWelcomeDialog );
|