diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2018-08-02 18:24:50 +0300 |
---|---|---|
committer | Stefan Giehl <stefan@piwik.org> | 2018-08-02 18:24:50 +0300 |
commit | 1fb40acdc12307d33ba3c550b60b9c0e46721a8d (patch) | |
tree | f4d93be20ef959120f2dd058f2bdc05e25e8b17f /plugins/CorePluginsAdmin | |
parent | 1268cbf385d667950b191810bbd3fcc2d2501a42 (diff) |
Do not show default value when default value is an array (#12824)
* Do not show default value when default value is an array
* make sure a pretty value is actually set
* do not show default value for multituple
Diffstat (limited to 'plugins/CorePluginsAdmin')
-rw-r--r-- | plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.html | 4 | ||||
-rw-r--r-- | plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.js | 15 |
2 files changed, 15 insertions, 4 deletions
diff --git a/plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.html b/plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.html index 1fca1b63fe..86acb985a1 100644 --- a/plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.html +++ b/plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.html @@ -18,11 +18,11 @@ <span class="inline-help" ng-bind-html="formField.inlineHelp"></span> - <span ng-show="formField.defaultValue && formField.uiControl != 'checkbox' && formField.uiControl != 'radio'"> + <span ng-show="formField.defaultValuePretty && formField.uiControl != 'checkbox' && formField.uiControl != 'radio'"> <br /> {{ 'General_Default'|translate }}: <span>{{formField.defaultValuePretty|limitTo:50}}</span> </span> </div> </div> -</div>
\ No newline at end of file +</div> diff --git a/plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.js b/plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.js index 3df7a6ef20..ff4419d4fd 100644 --- a/plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.js +++ b/plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.js @@ -279,8 +279,19 @@ } function formatPrettyDefaultValue(defaultValue, availableOptions) { - + if (angular.isString(defaultValue) && defaultValue) { + // eg default value for multi tuple + var defaultParsed = JSON.parse(defaultValue); + if (angular.isObject(defaultParsed)) { + return null; + } + } + if (!angular.isArray(availableOptions)) { + if (angular.isArray(defaultValue)) { + return null; + } + return defaultValue; } @@ -391,4 +402,4 @@ } }; } -})();
\ No newline at end of file +})(); |