mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 02:23:58 +00:00
Rename event to be descriptive, not prescriptive
Events should be named based on what happened, not what the side-effect will be. Change-Id: I563db48181e1db79ca22ef2ba1e25d5186976110
This commit is contained in:
parent
d93e35a0d1
commit
1653815e8c
|
@ -186,7 +186,7 @@ ve.ui.MWTemplateDialog.prototype.onAddParameter = function ( param ) {
|
|||
$overlay: this.$overlay
|
||||
} )
|
||||
.connect( this, {
|
||||
focusTemplateParameterById: this.bookletLayout.focusPart.bind( this.bookletLayout )
|
||||
templateParameterAdded: this.bookletLayout.focusPart.bind( this.bookletLayout )
|
||||
} );
|
||||
}
|
||||
this.bookletLayout.addPages( [ page ], this.transclusionModel.getIndex( param ) );
|
||||
|
|
|
@ -141,7 +141,7 @@ ve.ui.MWAddParameterPage.prototype.updateParameterNameValidation = function ( va
|
|||
|
||||
/**
|
||||
* @private
|
||||
* @fires focusTemplateParameterById
|
||||
* @fires templateParameterAdded
|
||||
*/
|
||||
ve.ui.MWAddParameterPage.prototype.onParameterNameSubmitted = function () {
|
||||
var name = this.paramInputField.getValue().trim();
|
||||
|
@ -157,7 +157,7 @@ ve.ui.MWAddParameterPage.prototype.onParameterNameSubmitted = function () {
|
|||
|
||||
var param = new ve.dm.MWParameterModel( this.template, name );
|
||||
this.template.addParameter( param );
|
||||
this.emit( 'focusTemplateParameterById', param.getId() );
|
||||
this.emit( 'templateParameterAdded', param.getId() );
|
||||
|
||||
ve.track( 'activity.transclusion', {
|
||||
action: 'add-unknown-parameter'
|
||||
|
|
|
@ -60,7 +60,7 @@ OO.inheritClass( ve.ui.MWTransclusionOutlineTemplateWidget, ve.ui.MWTransclusion
|
|||
/* Events */
|
||||
|
||||
/**
|
||||
* @event focusTemplateParameterById
|
||||
* @event templateParameterAdded
|
||||
* @param {string} pageName Unique id of the {@see OO.ui.BookletLayout} page, e.g. something like
|
||||
* "part_1" or "part_1/param1".
|
||||
*/
|
||||
|
@ -289,14 +289,14 @@ ve.ui.MWTransclusionOutlineTemplateWidget.prototype.onParameterRemovedFromTempla
|
|||
* @private
|
||||
* @param {OO.ui.OptionWidget} item
|
||||
* @param {boolean} selected
|
||||
* @fires focusTemplateParameterById
|
||||
* @fires templateParameterAdded
|
||||
*/
|
||||
ve.ui.MWTransclusionOutlineTemplateWidget.prototype.onTemplateParameterChoose = function ( item, selected ) {
|
||||
this.onTemplateParameterSelectionChanged( item, selected );
|
||||
|
||||
var param = this.templateModel.getParameter( item.getData() );
|
||||
if ( param && selected ) {
|
||||
this.emit( 'focusTemplateParameterById', param.getId() );
|
||||
this.emit( 'templateParameterAdded', param.getId() );
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ ve.ui.MWTransclusionOutlineWidget.prototype.addPartWidget = function ( part, new
|
|||
widget.connect( this, {
|
||||
// We can forward these events as is. The parameter's unique ids are reused as page
|
||||
// names in {@see ve.ui.MWTemplateDialog.onAddParameter}.
|
||||
focusTemplateParameterById: [ 'emit', 'focusPageByName' ],
|
||||
templateParameterAdded: [ 'emit', 'focusPageByName' ],
|
||||
filterParametersById: [ 'emit', 'filterPagesByName' ]
|
||||
} );
|
||||
} else if ( part instanceof ve.dm.MWTemplatePlaceholderModel ) {
|
||||
|
|
Loading…
Reference in a new issue