mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-29 16:44:51 +00:00
61c1f11fef
It's much cuter this way. Change-Id: Ibd4a3660b2ec1613ec64c75d29574b73da69a3b8
78 lines
1.8 KiB
JavaScript
78 lines
1.8 KiB
JavaScript
/*
|
|
* VisualEditor user interface MWTemplateDialog class.
|
|
*
|
|
* @copyright 2011-2014 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* Dialog for editing MediaWiki templates.
|
|
*
|
|
* @class
|
|
* @extends ve.ui.MWTransclusionDialog
|
|
*
|
|
* @constructor
|
|
* @param {ve.ui.WindowSet} windowSet Window set this dialog is part of
|
|
* @param {Object} [config] Configuration options
|
|
*/
|
|
ve.ui.MWTemplateDialog = function VeUiMWTemplateDialog( windowSet, config ) {
|
|
// Configuration initialization
|
|
config = ve.extendObject( { 'small': true }, config );
|
|
|
|
// Parent constructor
|
|
ve.ui.MWTransclusionDialog.call( this, windowSet, config );
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.inheritClass( ve.ui.MWTemplateDialog, ve.ui.MWTransclusionDialog );
|
|
|
|
/* Static Properties */
|
|
|
|
ve.ui.MWTemplateDialog.static.name = 'transclusion';
|
|
|
|
ve.ui.MWTemplateDialog.static.title =
|
|
OO.ui.deferMsg( 'visualeditor-dialog-transclusion-title' );
|
|
|
|
/* Methods */
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
ve.ui.MWTemplateDialog.prototype.onReplacePart = function ( removed, added ) {
|
|
// Parent method
|
|
ve.ui.MWTransclusionDialog.prototype.onReplacePart.call( this, removed, added );
|
|
|
|
// Initialization
|
|
if ( added instanceof ve.dm.MWTemplateModel ) {
|
|
this.setTitle( added.getSpec().getLabel() );
|
|
}
|
|
};
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
ve.ui.MWTemplateDialog.prototype.getBookletLayout = function () {
|
|
return new OO.ui.BookletLayout( {
|
|
'$': this.$,
|
|
'continuous': true,
|
|
'autoFocus': true,
|
|
'outlined': false
|
|
} );
|
|
};
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
ve.ui.MWTemplateDialog.prototype.setup = function ( data ) {
|
|
// Parent method
|
|
ve.ui.MWTransclusionDialog.prototype.setup.call( this, data );
|
|
|
|
// Initialization
|
|
this.setTitle( ve.msg( 'visualeditor-dialog-template-title' ) );
|
|
};
|
|
|
|
/* Registration */
|
|
|
|
ve.ui.dialogFactory.register( ve.ui.MWTemplateDialog );
|