diff options
author | Benaka <diosmosis@users.noreply.github.com> | 2017-09-11 16:07:37 +0300 |
---|---|---|
committer | Matthieu Aubry <mattab@users.noreply.github.com> | 2017-09-11 16:07:37 +0300 |
commit | 1092e4d7290333591f0f9beead6580a1424bc99f (patch) | |
tree | 5637e6dae005d1f68eae3dd7deaba7b87c522f89 /plugins/CorePluginsAdmin | |
parent | c7bea894a7cbb0d70f9c22f5197123935f392475 (diff) |
Updating Angular to version 1.6 (#11857)
* Update angular to 1.6 and ngDialog to 1.3.
* Remove broken Function.bind polyfill from kartograph that clashes w/ angular 1.6.
* $http.method().success/error functions do not exist in angular 1.6, just use standard promise interface.
* Maintain empty hash prefix for existing Piwik links.
See https://docs.angularjs.org/guide/migration#commit-aa077e8 for more info.
* Make sure radio setting values match availableValue values exactly.
Angular 1.6 uses strict equals when matching ng-value values w/ ng-model values, and the available values for boolean radio settings is always '0' or '1'. So we have to make sure the field value is '0'/'1'.
* Feedback form UI test code to remove piwik version string selected wrong element.
* Update expected screenshots (minor changes + unexplained default SMS provider change).
Diffstat (limited to 'plugins/CorePluginsAdmin')
-rw-r--r-- | plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.js b/plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.js index 30d73fee7c..00fe79523f 100644 --- a/plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.js +++ b/plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.js @@ -274,11 +274,16 @@ field.defaultValue = defaultValue.join(','); } + // convert boolean values since angular 1.6 uses strict equals when determining if a model value + // matches the ng-value of an input. if (field.type === 'boolean') { - if (field.value && field.value > 0 && field.value !== '0') { - field.value = true; - } else { - field.value = false; + var valueIsTruthy = field.value && field.value > 0 && field.value !== '0'; + + // for checkboxes, the value MUST be either true or faluse + if (field.uiControl === 'checkbox') { + field.value = valueIsTruthy; + } else if (field.uiControl === 'radio') { + field.value = valueIsTruthy ? '1' : '0'; } } |