From 198c5dba77b50abbea65f0a3502f5711a8f7dddb Mon Sep 17 00:00:00 2001 From: Thiemo Kreuz Date: Tue, 13 Jul 2021 12:33:52 +0200 Subject: [PATCH] Make button to add undocumented template parameter work Thanks to the widget now being an actual ButtonElement. Bug: T274544 Change-Id: I1b0ef28b0aa115a027a07f3ae53c583598483e96 --- .../widgets/ve.ui.MWTransclusionOutlineTemplateWidget.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineTemplateWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineTemplateWidget.js index 4ead53799a..8741cf60a1 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineTemplateWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineTemplateWidget.js @@ -38,7 +38,8 @@ ve.ui.MWTransclusionOutlineTemplateWidget = function VeUiMWTransclusionOutlineTe var addParameterButton = new ve.ui.MWTransclusionOutlineButtonWidget( { icon: 'parameter', label: ve.msg( 'visualeditor-dialog-transclusion-add-param' ) - } ); + } ) + .connect( this, { click: 'onAddParameterButtonClick' } ); this.parameters = new OO.ui.FieldsetLayout( { items: checkboxes @@ -131,3 +132,7 @@ ve.ui.MWTransclusionOutlineTemplateWidget.prototype.onCheckboxChange = function } } }; + +ve.ui.MWTransclusionOutlineTemplateWidget.prototype.onAddParameterButtonClick = function () { + this.templateModel.addParameter( new ve.dm.MWParameterModel( this.templateModel ) ); +};