From be031285b93618325da694c43993894764a84a5e Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 8 Feb 2016 17:46:21 -0800 Subject: [PATCH] Added form-level change event --- platform/features/plot/src/PlotOptionsForm.js | 29 +++++++------------ .../res/templates/controls/checkbox.html | 2 +- .../forms/res/templates/controls/radio.html | 2 +- .../forms/res/templates/controls/select.html | 2 +- .../res/templates/controls/textfield.html | 2 +- platform/forms/res/templates/form.html | 2 +- platform/forms/src/MCTControl.js | 2 ++ 7 files changed, 18 insertions(+), 23 deletions(-) diff --git a/platform/features/plot/src/PlotOptionsForm.js b/platform/features/plot/src/PlotOptionsForm.js index d21106318f..c6c5d2b343 100644 --- a/platform/features/plot/src/PlotOptionsForm.js +++ b/platform/features/plot/src/PlotOptionsForm.js @@ -46,6 +46,7 @@ define( */ this.xAxisForm = { 'name':'x-axis', + 'onchange': onchange, 'sections': [{ 'name': 'x-axis', 'rows': [ @@ -53,7 +54,6 @@ define( 'name': 'Domain', 'control': 'select', 'key': 'key', - 'onchange': onchange, 'options': [ {'name':'scet', 'value': 'scet'}, {'name':'sclk', 'value': 'sclk'}, @@ -65,6 +65,7 @@ define( this.yAxisForm = { 'name':'y-axis', + 'onchange': onchange, 'sections': [{ // Will need to be repeated for each y-axis, with a // distinct name for each. Ideally the name of the axis @@ -74,28 +75,24 @@ define( { 'name': 'Autoscale', 'control': 'checkbox', - 'key': 'autoscale', - 'onchange': onchange + 'key': 'autoscale' }, { 'name': 'Min', 'control': 'textfield', 'key': 'min', - 'pattern': '[0-9]', - 'onchange': onchange + 'pattern': '[0-9]' }, { 'name': 'Max', 'control': 'textfield', 'key': 'max', - 'pattern': '[0-9]', - 'onchange': onchange + 'pattern': '[0-9]' }, { 'name': 'Range', 'control': 'select', 'key': 'key', - 'onchange': onchange, 'options': [ {'name':'eu', 'value': 'eu'}, {'name':'dn', 'value': 'dn'}, @@ -107,14 +104,14 @@ define( }; this.plotSeriesForm = { 'name':'Series Options', + 'onchange': onchange, 'sections': [ { rows: [ { 'name': 'Color', 'control': 'color', - 'key': 'color', - 'onchange': onchange + 'key': 'color' }] }, { @@ -122,8 +119,7 @@ define( { 'name': 'Markers', 'control': 'checkbox', - 'key': 'markers', - 'onchange': onchange + 'key': 'markers' } ] }, @@ -133,22 +129,19 @@ define( 'name': 'No Line', 'control': 'radio', 'key': 'lineType', - 'value': 'noLine', - 'onchange': onchange + 'value': 'noLine' }, { 'name': 'Step Line', 'control': 'radio', 'key': 'lineType', - 'value': 'stepLine', - 'onchange': onchange + 'value': 'stepLine' }, { 'name': 'Linear Line', 'control': 'radio', 'key': 'lineType', - 'value': 'linearLine', - 'onchange': onchange + 'value': 'linearLine' } ] } diff --git a/platform/forms/res/templates/controls/checkbox.html b/platform/forms/res/templates/controls/checkbox.html index 45b6915a36..c676fb85cd 100644 --- a/platform/forms/res/templates/controls/checkbox.html +++ b/platform/forms/res/templates/controls/checkbox.html @@ -23,7 +23,7 @@ diff --git a/platform/forms/res/templates/controls/radio.html b/platform/forms/res/templates/controls/radio.html index d9f4e36b04..d5fb7284aa 100644 --- a/platform/forms/res/templates/controls/radio.html +++ b/platform/forms/res/templates/controls/radio.html @@ -24,7 +24,7 @@ name="mctControl" ng-model="ngModel[field]" ng-disabled="ngDisabled" - ng-change="structure.onchange(ngModel[field])" + ng-change="ngChange()" ng-value="structure.value"> diff --git a/platform/forms/res/templates/controls/select.html b/platform/forms/res/templates/controls/select.html index d4b3ee50ef..9742bfb7d0 100644 --- a/platform/forms/res/templates/controls/select.html +++ b/platform/forms/res/templates/controls/select.html @@ -24,7 +24,7 @@ ng-model="ngModel[field]" ng-options="opt.value as opt.name for opt in options" ng-required="ngRequired" - ng-change="structure.onchange(ngModel[field])" + ng-change="ngChange()" name="mctControl"> diff --git a/platform/forms/res/templates/controls/textfield.html b/platform/forms/res/templates/controls/textfield.html index 948f7ef13d..c79cc83b90 100644 --- a/platform/forms/res/templates/controls/textfield.html +++ b/platform/forms/res/templates/controls/textfield.html @@ -25,7 +25,7 @@ ng-required="ngRequired" ng-model="ngModel[field]" ng-pattern="ngPattern" - ng-change="structure.onchange(ngModel[field])" + ng-change="ngChange()" size="{{structure.size}}" name="mctControl"> diff --git a/platform/forms/res/templates/form.html b/platform/forms/res/templates/form.html index b99e951aed..b2e9aa8d01 100644 --- a/platform/forms/res/templates/form.html +++ b/platform/forms/res/templates/form.html @@ -41,7 +41,7 @@