diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2018-12-10 04:14:27 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-10 04:14:27 +0300 |
commit | 7956ca7e8ea82a1b444c7f08b825fa4aca350388 (patch) | |
tree | 70f8fd3e7690d38cb54450152e3d5b8e1a435b6a /plugins/CorePluginsAdmin/angularjs | |
parent | 1b113aec10e43fceba07226621a83ba7f8aea52b (diff) |
Allow form select to show specific text for empty option that is not placeholder option… (#13763)
* Allow form select to show specific text for empty option that is not placeholder option & add missing translation.
* Add some code for new section
* Add explicit ability to set access for all websites to user permission edit component.
* Update expected screenshots.
Diffstat (limited to 'plugins/CorePluginsAdmin/angularjs')
-rw-r--r-- | plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.js b/plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.js index 5637c88902..3b92dcbc56 100644 --- a/plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.js +++ b/plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.js @@ -367,7 +367,10 @@ field.availableOptions = formatAvailableValues(field); // for selects w/ a placeholder, add an option to unset the select - if (field.uiControl === 'select' && field.uiControlAttributes.placeholder) { + if (field.uiControl === 'select' + && field.uiControlAttributes.placeholder + && !hasOption('') + ) { field.availableOptions.splice(0, 0, { key: '', value: '' }); } @@ -432,6 +435,15 @@ scope.templateLoaded = function () { $timeout(whenRendered(scope, element, inlineHelpNode)); }; + + function hasOption(key) { + for (var i = 0; i !== field.availableOptions.length; ++i) { + if (field.availableOptions[i].key === key) { + return true; + } + } + return false; + } }; } }; |