mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 18:39:52 +00:00
Add documentation to ve.ui.MWTemplateOutlineTemplateWidget
Change-Id: Ibc0b39fd417fa7eef5cf1cd52b9769c6514ce85d
This commit is contained in:
parent
6f5ed6e797
commit
0c141e2581
|
@ -45,11 +45,34 @@ ve.ui.MWTemplateOutlineParameterCheckboxLayout = function VeUiMWTemplateOutlineP
|
|||
|
||||
OO.inheritClass( ve.ui.MWTemplateOutlineParameterCheckboxLayout, OO.ui.FieldLayout );
|
||||
|
||||
/* Events */
|
||||
|
||||
/**
|
||||
* @event change
|
||||
* @param {string} name Parameter name
|
||||
* @param {boolean} checked New checkbox state
|
||||
*/
|
||||
|
||||
/**
|
||||
* @event select
|
||||
* @param {string} name Parameter name
|
||||
*/
|
||||
|
||||
/* Methods */
|
||||
|
||||
/**
|
||||
* Handles a checkbox input widget change event {@see OO.ui.CheckboxInputWidget}.
|
||||
*
|
||||
* @param {boolean} value
|
||||
* @fires change
|
||||
*/
|
||||
ve.ui.MWTemplateOutlineParameterCheckboxLayout.prototype.onEdit = function ( value ) {
|
||||
this.emit( 'change', this.getData(), value );
|
||||
};
|
||||
|
||||
/**
|
||||
* @fires select
|
||||
*/
|
||||
ve.ui.MWTemplateOutlineParameterCheckboxLayout.prototype.onLabelClick = function () {
|
||||
if ( !this.fieldWidget.isSelected() ) {
|
||||
this.fieldWidget.setSelected( true );
|
||||
|
|
|
@ -68,6 +68,10 @@ ve.ui.MWTemplateOutlineTemplateWidget = function VeUiMWTemplateOutlineTemplateWi
|
|||
|
||||
OO.inheritClass( ve.ui.MWTemplateOutlineTemplateWidget, OO.ui.Widget );
|
||||
|
||||
/**
|
||||
* @param {string|ve.dm.MWParameterModel} parameter
|
||||
* @returns {ve.ui.MWTemplateOutlineParameterCheckboxLayout}
|
||||
*/
|
||||
ve.ui.MWTemplateOutlineTemplateWidget.prototype.createCheckbox = function ( parameter ) {
|
||||
var parameterModel = ( parameter instanceof ve.dm.MWParameterModel ) ?
|
||||
parameter : this.templateModel.getParameter( parameter ),
|
||||
|
@ -87,6 +91,12 @@ ve.ui.MWTemplateOutlineTemplateWidget.prototype.createCheckbox = function ( para
|
|||
} );
|
||||
};
|
||||
|
||||
/**
|
||||
* Handles a template model add event {@see ve.dm.MWTemplateModel}.
|
||||
* Triggered when a parameter is added to the template model.
|
||||
*
|
||||
* @param {ve.dm.MWParameterModel} parameter
|
||||
*/
|
||||
ve.ui.MWTemplateOutlineTemplateWidget.prototype.onAddParameter = function ( parameter ) {
|
||||
var paramCheckbox = this.parameters.findItemFromData( parameter.getName() );
|
||||
|
||||
|
@ -100,6 +110,12 @@ ve.ui.MWTemplateOutlineTemplateWidget.prototype.onAddParameter = function ( para
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Handles a template model remove event {@see ve.dm.MWTemplateModel}.
|
||||
* Triggered when a parameter is removed from the template model.
|
||||
*
|
||||
* @param {ve.dm.MWParameterModel} parameter
|
||||
*/
|
||||
ve.ui.MWTemplateOutlineTemplateWidget.prototype.onRemoveParameter = function ( parameter ) {
|
||||
var paramCheckbox = this.parameters.findItemFromData( parameter.getName() );
|
||||
|
||||
|
@ -113,6 +129,12 @@ ve.ui.MWTemplateOutlineTemplateWidget.prototype.onRemoveParameter = function ( p
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Handles a parameter checkbox change event {@see ve.ui.MWTemplateOutlineParameterCheckboxLayout}
|
||||
*
|
||||
* @param {string} data Parameter name
|
||||
* @param {boolean} checked New checkbox state
|
||||
*/
|
||||
ve.ui.MWTemplateOutlineTemplateWidget.prototype.onCheckboxChange = function ( data, checked ) {
|
||||
var parameter = this.templateModel.getParameter( data );
|
||||
|
||||
|
|
Loading…
Reference in a new issue