2013-12-02 20:10:55 +00:00
|
|
|
/*
|
|
|
|
* VisualEditor user interface MWTemplateDialog class.
|
|
|
|
*
|
2014-01-05 12:05:05 +00:00
|
|
|
* @copyright 2011-2014 VisualEditor Team and others; see AUTHORS.txt
|
2013-12-02 20:10:55 +00:00
|
|
|
* @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 ) {
|
|
|
|
// Parent constructor
|
|
|
|
ve.ui.MWTransclusionDialog.call( this, windowSet, config );
|
|
|
|
|
|
|
|
// Properties
|
|
|
|
this.node = null;
|
|
|
|
this.transclusion = null;
|
|
|
|
this.loaded = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
|
|
|
OO.inheritClass( ve.ui.MWTemplateDialog, ve.ui.MWTransclusionDialog );
|
|
|
|
|
|
|
|
/* Static Properties */
|
|
|
|
|
|
|
|
ve.ui.MWTemplateDialog.static.name = 'transclusion';
|
|
|
|
|
2014-02-12 21:45:37 +00:00
|
|
|
ve.ui.MWTemplateDialog.static.title =
|
|
|
|
OO.ui.deferMsg( 'visualeditor-dialog-transclusion-title' );
|
2013-12-02 20:10:55 +00:00
|
|
|
|
|
|
|
/* Methods */
|
|
|
|
|
2014-02-26 00:23:58 +00:00
|
|
|
/**
|
|
|
|
* @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() );
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-12-02 20:10:55 +00:00
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
ve.ui.MWTemplateDialog.prototype.getBookletLayout = function () {
|
|
|
|
return new OO.ui.BookletLayout( {
|
|
|
|
'$': this.$,
|
|
|
|
'continuous': true,
|
|
|
|
'autoFocus': true,
|
2014-02-26 00:24:41 +00:00
|
|
|
'outlined': false
|
2013-12-02 20:10:55 +00:00
|
|
|
} );
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Registration */
|
|
|
|
|
|
|
|
ve.ui.dialogFactory.register( ve.ui.MWTemplateDialog );
|