diff --git a/VisualEditor.php b/VisualEditor.php index 3251e0f6d7..5b5ef9d020 100644 --- a/VisualEditor.php +++ b/VisualEditor.php @@ -566,7 +566,7 @@ $wgResourceModules += array( 'modules/ve-mw/dm/models/ve.dm.MWTemplateSpecModel.js', 'modules/ve-mw/dm/models/ve.dm.MWTemplateModel.js', 'modules/ve-mw/dm/models/ve.dm.MWTemplatePlaceholderModel.js', - 'modules/ve-mw/dm/models/ve.dm.MWTemplateParameterModel.js', + 'modules/ve-mw/dm/models/ve.dm.MWParameterModel.js', // ce 'modules/ve-mw/ce/ve.ce.MWResizableNode.js', @@ -609,7 +609,7 @@ $wgResourceModules += array( 'modules/ve-mw/ui/pages/ve.ui.MWCategoriesPage.js', 'modules/ve-mw/ui/pages/ve.ui.MWLanguagesPage.js', 'modules/ve-mw/ui/pages/ve.ui.MWTemplatePage.js', - 'modules/ve-mw/ui/pages/ve.ui.MWTemplateParameterPage.js', + 'modules/ve-mw/ui/pages/ve.ui.MWParameterPage.js', 'modules/ve-mw/ui/pages/ve.ui.MWTemplatePlaceholderPage.js', 'modules/ve-mw/ui/pages/ve.ui.MWTransclusionContentPage.js', diff --git a/modules/ve-mw/dm/models/ve.dm.MWTemplateParameterModel.js b/modules/ve-mw/dm/models/ve.dm.MWParameterModel.js similarity index 67% rename from modules/ve-mw/dm/models/ve.dm.MWTemplateParameterModel.js rename to modules/ve-mw/dm/models/ve.dm.MWParameterModel.js index f62876adac..7f9e015f36 100644 --- a/modules/ve-mw/dm/models/ve.dm.MWTemplateParameterModel.js +++ b/modules/ve-mw/dm/models/ve.dm.MWParameterModel.js @@ -1,5 +1,5 @@ /*! - * VisualEditor DataModel MWTemplateParameterModel class. + * VisualEditor DataModel MWParameterModel class. * * @copyright 2011-2014 VisualEditor Team and others; see AUTHORS.txt * @license The MIT License (MIT); see LICENSE.txt @@ -16,7 +16,7 @@ * @param {string} name Parameter name * @param {string} value Parameter value */ -ve.dm.MWTemplateParameterModel = function VeDmMWTemplateParameterModel( template, name, value ) { +ve.dm.MWParameterModel = function VeDmMWParameterModel( template, name, value ) { // Mixin constructors OO.EventEmitter.call( this ); @@ -30,7 +30,7 @@ ve.dm.MWTemplateParameterModel = function VeDmMWTemplateParameterModel( template /* Inheritance */ -OO.mixinClass( ve.dm.MWTemplateParameterModel, OO.EventEmitter ); +OO.mixinClass( ve.dm.MWParameterModel, OO.EventEmitter ); /* Events */ @@ -47,7 +47,7 @@ OO.mixinClass( ve.dm.MWTemplateParameterModel, OO.EventEmitter ); * @param {string} name Parameter name * @returns {boolean} Parameter is required */ -ve.dm.MWTemplateParameterModel.prototype.isRequired = function () { +ve.dm.MWParameterModel.prototype.isRequired = function () { return this.template.getSpec().isParameterRequired( this.name ); }; @@ -56,7 +56,7 @@ ve.dm.MWTemplateParameterModel.prototype.isRequired = function () { * * @returns {ve.dm.MWTemplateModel} Template */ -ve.dm.MWTemplateParameterModel.prototype.getTemplate = function () { +ve.dm.MWParameterModel.prototype.getTemplate = function () { return this.template; }; @@ -65,7 +65,7 @@ ve.dm.MWTemplateParameterModel.prototype.getTemplate = function () { * * @returns {string} Unique ID */ -ve.dm.MWTemplateParameterModel.prototype.getId = function () { +ve.dm.MWParameterModel.prototype.getId = function () { return this.id; }; @@ -74,7 +74,7 @@ ve.dm.MWTemplateParameterModel.prototype.getId = function () { * * @returns {string} Parameter name */ -ve.dm.MWTemplateParameterModel.prototype.getName = function () { +ve.dm.MWParameterModel.prototype.getName = function () { return this.name; }; @@ -83,7 +83,7 @@ ve.dm.MWTemplateParameterModel.prototype.getName = function () { * * @returns {string} Parameter name */ -ve.dm.MWTemplateParameterModel.prototype.getOriginalName = function () { +ve.dm.MWParameterModel.prototype.getOriginalName = function () { return this.originalName; }; @@ -92,7 +92,7 @@ ve.dm.MWTemplateParameterModel.prototype.getOriginalName = function () { * * @returns {string} Parameter value */ -ve.dm.MWTemplateParameterModel.prototype.getValue = function () { +ve.dm.MWParameterModel.prototype.getValue = function () { return this.value; }; @@ -101,7 +101,7 @@ ve.dm.MWTemplateParameterModel.prototype.getValue = function () { * * @param {string} value Parameter value */ -ve.dm.MWTemplateParameterModel.prototype.setValue = function ( value ) { +ve.dm.MWParameterModel.prototype.setValue = function ( value ) { this.value = value; this.emit( 'change' ); }; @@ -109,6 +109,6 @@ ve.dm.MWTemplateParameterModel.prototype.setValue = function ( value ) { /** * Remove parameter from template. */ -ve.dm.MWTemplateParameterModel.prototype.remove = function () { +ve.dm.MWParameterModel.prototype.remove = function () { this.template.removeParameter( this ); }; diff --git a/modules/ve-mw/dm/models/ve.dm.MWTemplateModel.js b/modules/ve-mw/dm/models/ve.dm.MWTemplateModel.js index 46db3ea59f..7bb160b52c 100644 --- a/modules/ve-mw/dm/models/ve.dm.MWTemplateModel.js +++ b/modules/ve-mw/dm/models/ve.dm.MWTemplateModel.js @@ -42,12 +42,12 @@ OO.inheritClass( ve.dm.MWTemplateModel, ve.dm.MWTransclusionPartModel ); /** * @event add - * @param {ve.dm.MWTemplateParameterModel} param Added param + * @param {ve.dm.MWParameterModel} param Added param */ /** * @event remove - * @param {ve.dm.MWTemplateParameterModel} param Removed param + * @param {ve.dm.MWParameterModel} param Removed param */ /* Static Methods */ @@ -67,7 +67,7 @@ ve.dm.MWTemplateModel.newFromData = function ( transclusion, data ) { for ( key in data.params ) { template.addParameter( - new ve.dm.MWTemplateParameterModel( template, key, data.params[key].wt, 'data' ) + new ve.dm.MWParameterModel( template, key, data.params[key].wt, 'data' ) ); } @@ -131,7 +131,7 @@ ve.dm.MWTemplateModel.prototype.getSpec = function () { /** * Get all params. * - * @returns {Object.} Parameters keyed by name + * @returns {Object.} Parameters keyed by name */ ve.dm.MWTemplateModel.prototype.getParameters = function () { return this.params; @@ -141,7 +141,7 @@ ve.dm.MWTemplateModel.prototype.getParameters = function () { * Get a parameter. * * @param {string} name Parameter name - * @returns {ve.dm.MWTemplateParameterModel} Parameter + * @returns {ve.dm.MWParameterModel} Parameter */ ve.dm.MWTemplateModel.prototype.getParameter = function ( name ) { return this.params[name]; @@ -231,7 +231,7 @@ ve.dm.MWTemplateModel.prototype.getParameterNames = function () { /** * Add a parameter to template. * - * @param {ve.dm.MWTemplateParameterModel} param Parameter to add + * @param {ve.dm.MWParameterModel} param Parameter to add * @fires add */ ve.dm.MWTemplateModel.prototype.addParameter = function ( param ) { @@ -247,7 +247,7 @@ ve.dm.MWTemplateModel.prototype.addParameter = function ( param ) { /** * Remove parameter from template. * - * @param {ve.dm.MWTemplateParameterModel} param Parameter to remove + * @param {ve.dm.MWParameterModel} param Parameter to remove * @fires remove */ ve.dm.MWTemplateModel.prototype.removeParameter = function ( param ) { @@ -272,7 +272,7 @@ ve.dm.MWTemplateModel.prototype.addRequiredParameters = function () { for ( i = 0, len = names.length; i < len; i++ ) { if ( !this.params[name] && spec.isParameterRequired( names[i] ) ) { - this.addParameter( new ve.dm.MWTemplateParameterModel( this, names[i] ) ); + this.addParameter( new ve.dm.MWParameterModel( this, names[i] ) ); } } }; diff --git a/modules/ve-mw/dm/models/ve.dm.MWTransclusionModel.js b/modules/ve-mw/dm/models/ve.dm.MWTransclusionModel.js index 33a501fc04..f8f17ced4c 100644 --- a/modules/ve-mw/dm/models/ve.dm.MWTransclusionModel.js +++ b/modules/ve-mw/dm/models/ve.dm.MWTransclusionModel.js @@ -387,7 +387,7 @@ ve.dm.MWTransclusionModel.prototype.getParts = function () { */ ve.dm.MWTransclusionModel.prototype.getPartFromId = function ( id ) { var i, len, - // For ids from ve.dm.MWTemplateParameterModel, compare against the part id + // For ids from ve.dm.MWParameterModel, compare against the part id // of the parameter instead of the entire model id (e.g. "part_1" instead of "part_1/foo"). partId = id.split( '/' )[0]; @@ -404,7 +404,7 @@ ve.dm.MWTransclusionModel.prototype.getPartFromId = function ( id ) { * * Indexes are linear depth-first addresses in the transclusion tree. * - * @param {ve.dm.MWTransclusionPartModel|ve.dm.MWTemplateParameterModel} model Part or parameter + * @param {ve.dm.MWTransclusionPartModel|ve.dm.MWParameterModel} model Part or parameter * @returns {number} Page index of model */ ve.dm.MWTransclusionModel.prototype.getIndex = function ( model ) { diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js index 663d9ecada..6e40961b0f 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js @@ -105,10 +105,10 @@ ve.ui.MWTransclusionDialog.prototype.onReplacePart = function ( removed, added ) /** * Handle add param events. * - * @param {ve.dm.MWTemplateParameterModel} param Added param + * @param {ve.dm.MWParameterModel} param Added param */ ve.ui.MWTransclusionDialog.prototype.onAddParameter = function ( param ) { - var page = new ve.ui.MWTemplateParameterPage( param, param.getId(), { '$': this.$ } ); + var page = new ve.ui.MWParameterPage( param, param.getId(), { '$': this.$ } ); this.bookletLayout.addPages( [ page ], this.transclusion.getIndex( param ) ); if ( this.loaded ) { this.setPageByName( param.getId() ); @@ -118,7 +118,7 @@ ve.ui.MWTransclusionDialog.prototype.onAddParameter = function ( param ) { /** * Handle remove param events. * - * @param {ve.dm.MWTemplateParameterModel} param Removed param + * @param {ve.dm.MWParameterModel} param Removed param */ ve.ui.MWTransclusionDialog.prototype.onRemoveParameter = function ( param ) { this.bookletLayout.removePages( [ this.bookletLayout.getPage( param.getId() ) ] ); diff --git a/modules/ve-mw/ui/pages/ve.ui.MWTemplateParameterPage.js b/modules/ve-mw/ui/pages/ve.ui.MWParameterPage.js similarity index 81% rename from modules/ve-mw/ui/pages/ve.ui.MWTemplateParameterPage.js rename to modules/ve-mw/ui/pages/ve.ui.MWParameterPage.js index 34f127e6fa..ecf68e8577 100644 --- a/modules/ve-mw/ui/pages/ve.ui.MWTemplateParameterPage.js +++ b/modules/ve-mw/ui/pages/ve.ui.MWParameterPage.js @@ -1,5 +1,5 @@ /*! - * VisualEditor user interface MWTemplateParameterPage class. + * VisualEditor user interface MWParameterPage class. * * @copyright 2011-2014 VisualEditor Team and others; see AUTHORS.txt * @license The MIT License (MIT); see LICENSE.txt @@ -12,11 +12,11 @@ * @extends OO.ui.PageLayout * * @constructor - * @param {ve.dm.MWTemplateParameterModel} parameter Template parameter + * @param {ve.dm.MWParameterModel} parameter Template parameter * @param {string} name Unique symbolic name of page * @param {Object} [config] Configuration options */ -ve.ui.MWTemplateParameterPage = function VeUiMWTemplateParameter( parameter, name, config ) { +ve.ui.MWParameterPage = function VeUiMWParameter( parameter, name, config ) { var spec = parameter.getTemplate().getSpec(); // Parent constructor @@ -65,14 +65,14 @@ ve.ui.MWTemplateParameterPage = function VeUiMWTemplateParameter( parameter, nam /* Inheritance */ -OO.inheritClass( ve.ui.MWTemplateParameterPage, OO.ui.PageLayout ); +OO.inheritClass( ve.ui.MWParameterPage, OO.ui.PageLayout ); /* Methods */ /** * @inheritdoc */ -ve.ui.MWTemplateParameterPage.prototype.setOutlineItem = function ( outlineItem ) { +ve.ui.MWParameterPage.prototype.setOutlineItem = function ( outlineItem ) { // Parent method OO.ui.PageLayout.prototype.setOutlineItem.call( this, outlineItem ); @@ -91,10 +91,10 @@ ve.ui.MWTemplateParameterPage.prototype.setOutlineItem = function ( outlineItem } }; -ve.ui.MWTemplateParameterPage.prototype.onTextInputChange = function () { +ve.ui.MWParameterPage.prototype.onTextInputChange = function () { this.parameter.setValue( this.valueInput.getValue() ); }; -ve.ui.MWTemplateParameterPage.prototype.onRemoveButtonClick = function () { +ve.ui.MWParameterPage.prototype.onRemoveButtonClick = function () { this.parameter.remove(); }; diff --git a/modules/ve-mw/ui/pages/ve.ui.MWTemplatePage.js b/modules/ve-mw/ui/pages/ve.ui.MWTemplatePage.js index afdffc215e..185968c28a 100644 --- a/modules/ve-mw/ui/pages/ve.ui.MWTemplatePage.js +++ b/modules/ve-mw/ui/pages/ve.ui.MWTemplatePage.js @@ -83,7 +83,7 @@ ve.ui.MWTemplatePage.prototype.onParameterSelect = function ( name ) { var param; if ( name ) { - param = new ve.dm.MWTemplateParameterModel( this.template, name ); + param = new ve.dm.MWParameterModel( this.template, name ); this.template.addParameter( param ); this.addParameterSearch.query.setValue(); }