From 1564abd48d7baa8b499f10e8d90d781ec64a0b6e Mon Sep 17 00:00:00 2001 From: David Lynch Date: Fri, 12 Aug 2016 17:31:04 -0700 Subject: [PATCH] Dialog must listen for changes to the param names Otherwise the second keystroke made while changing parameter names will cause an error. I think this code previously assumed the change only happened once, rather than on-keystroke. Bug: T142889 Change-Id: I0e9c096a053667c51bbce74ee3ce1bd573ae7d49 --- modules/ext.templateDataGenerator.ui.tdDialog.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/modules/ext.templateDataGenerator.ui.tdDialog.js b/modules/ext.templateDataGenerator.ui.tdDialog.js index 0883dbc6..4e23e6c3 100644 --- a/modules/ext.templateDataGenerator.ui.tdDialog.js +++ b/modules/ext.templateDataGenerator.ui.tdDialog.js @@ -280,6 +280,21 @@ mw.TemplateData.Dialog.prototype.onModelChangeParamOrder = function () { this.repopulateParamSelectWidget(); }; +/** + * Respond to change of param property from the model + * + * @param {string} paramKey Parameter key + * @param {string} prop Property name + * @param {...Mixed} value Property value + * @param {string} [language] Value language + */ +mw.TemplateData.Dialog.prototype.onModelChangeProperty = function ( paramKey, prop, value ) { + // Refresh the parameter widget + if ( paramKey === this.selectedParamKey && prop === 'name' ) { + this.selectedParamKey = value; + } +}; + /** * Respond to a change in the model */ @@ -804,6 +819,7 @@ mw.TemplateData.Dialog.prototype.getSetupProcess = function ( data ) { this.model.connect( this, { 'change-description': 'onModelChangeDescription', 'change-paramOrder': 'onModelChangeParamOrder', + 'change-property': 'onModelChangeProperty', change: 'onModelChange' } );