2013-09-23 23:04:36 +00:00
|
|
|
/*global mw */
|
2013-08-01 20:18:33 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor user interface MWBetaWelcomeDialog class.
|
|
|
|
*
|
|
|
|
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Dialog for inserting MediaWiki media objects.
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @extends ve.ui.MWDialog
|
|
|
|
*
|
|
|
|
* @constructor
|
2013-10-09 19:59:03 +00:00
|
|
|
* @param {ve.ui.SurfaceWindowSet} windowSet Window set this dialog is part of
|
2013-09-25 10:21:09 +00:00
|
|
|
* @param {Object} [config] Configuration options
|
2013-08-01 20:18:33 +00:00
|
|
|
*/
|
2013-10-09 19:59:03 +00:00
|
|
|
ve.ui.MWBetaWelcomeDialog = function VeUiMWBetaWelcomeDialog( windowSet, config ) {
|
2013-08-01 20:18:33 +00:00
|
|
|
// Configuration initialization
|
2013-09-20 07:09:06 +00:00
|
|
|
config = ve.extendObject( { 'small': true, 'footless': false }, config );
|
2013-08-01 20:18:33 +00:00
|
|
|
|
|
|
|
// Parent constructor
|
2013-10-09 19:59:03 +00:00
|
|
|
ve.ui.MWDialog.call( this, windowSet, config );
|
2013-08-01 20:18:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
|
|
|
ve.inheritClass( ve.ui.MWBetaWelcomeDialog, ve.ui.MWDialog );
|
|
|
|
|
|
|
|
/* Static Properties */
|
|
|
|
|
2013-08-27 23:28:29 +00:00
|
|
|
ve.ui.MWBetaWelcomeDialog.static.name = 'betaWelcome';
|
|
|
|
|
2013-08-01 20:18:33 +00:00
|
|
|
ve.ui.MWBetaWelcomeDialog.static.titleMessage = 'visualeditor-dialog-beta-welcome-title';
|
|
|
|
|
|
|
|
ve.ui.MWBetaWelcomeDialog.static.icon = 'help';
|
|
|
|
|
|
|
|
/* Methods */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
ve.ui.MWBetaWelcomeDialog.prototype.initialize = function () {
|
|
|
|
// Parent method
|
|
|
|
ve.ui.MWDialog.prototype.initialize.call( this );
|
|
|
|
|
|
|
|
// Properties
|
2013-09-03 20:54:15 +00:00
|
|
|
this.contentLayout = new ve.ui.PanelLayout( {
|
|
|
|
'$$': this.frame.$$,
|
|
|
|
'scrollable': true,
|
|
|
|
'padded': true
|
|
|
|
} );
|
2013-10-02 00:00:57 +00:00
|
|
|
this.continueButton = new ve.ui.PushButtonWidget( {
|
2013-08-01 20:18:33 +00:00
|
|
|
'$$': this.$$,
|
|
|
|
'label': ve.msg( 'visualeditor-dialog-beta-welcome-action-continue' ),
|
|
|
|
'flags': ['primary']
|
|
|
|
} );
|
|
|
|
|
|
|
|
// Events
|
|
|
|
this.continueButton.connect( this, { 'click': [ 'close', 'close' ] } );
|
|
|
|
|
|
|
|
// Initialization
|
2013-09-03 20:54:15 +00:00
|
|
|
this.contentLayout.$
|
|
|
|
.addClass( 've-ui-mwBetaWelcomeDialog-content' )
|
|
|
|
.text( ve.msg( 'visualeditor-dialog-beta-welcome-content', $( '#ca-edit' ).text() ) );
|
|
|
|
this.$body.append( this.contentLayout.$ );
|
2013-08-01 20:18:33 +00:00
|
|
|
this.$foot.append( this.continueButton.$ );
|
|
|
|
};
|
|
|
|
|
2013-09-23 23:04:36 +00:00
|
|
|
/**
|
|
|
|
* Get the title of the window.
|
|
|
|
*
|
|
|
|
* Send the MediaWiki username along with the message for {{GENDER:}} i18n support
|
|
|
|
* @returns {string} Window title
|
|
|
|
*/
|
|
|
|
ve.ui.MWBetaWelcomeDialog.prototype.getTitle = function () {
|
|
|
|
var userName = mw.config.get( 'wgUserName' );
|
|
|
|
if ( !userName ) {
|
|
|
|
userName = ''; // Make sure 'null' and 'undefined' are sent as empty string
|
|
|
|
}
|
|
|
|
return ve.msg( this.constructor.static.titleMessage, userName );
|
|
|
|
};
|
|
|
|
|
2013-08-01 20:18:33 +00:00
|
|
|
/* Registration */
|
|
|
|
|
2013-08-27 23:28:29 +00:00
|
|
|
ve.ui.dialogFactory.register( ve.ui.MWBetaWelcomeDialog );
|