diff options
author | Thomas Müller <DeepDiver1975@users.noreply.github.com> | 2016-08-25 00:40:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-25 00:40:12 +0200 |
commit | 10fa229d7a1463d417c10ac3e11f49aeaa09073c (patch) | |
tree | 47a976666aeb8f33db9216cc1e8102220c0dcf2f /js | |
parent | 81f7975e8d8cd2e32cf77d5cb8fbeb8da05c8355 (diff) |
Add support for X-ABLABEL refs #204 (#377)
Diffstat (limited to 'js')
-rw-r--r-- | js/components/detailsItem/detailsItem_controller.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/js/components/detailsItem/detailsItem_controller.js b/js/components/detailsItem/detailsItem_controller.js index e296da43..1eef2ac0 100644 --- a/js/components/detailsItem/detailsItem_controller.js +++ b/js/components/detailsItem/detailsItem_controller.js @@ -43,6 +43,18 @@ angular.module('contactsApp') ctrl.availableOptions = ctrl.availableOptions.concat([{id: ctrl.type, name: displayName}]); } } + if (!_.isUndefined(ctrl.data) && !_.isUndefined(ctrl.data.namespace)) { + if (!_.isUndefined(ctrl.model.contact.props['X-ABLABEL'])) { + var val = _.find(this.model.contact.props['X-ABLABEL'], function(x) { return x.namespace === ctrl.data.namespace; }); + ctrl.type = val.value; + if (!_.isUndefined(val)) { + // in case the type is not yet in the default list of available options we add it + if (!ctrl.availableOptions.some(function(e) { return e.id === val.value; } )) { + ctrl.availableOptions = ctrl.availableOptions.concat([{id: val.value, name: val.value}]); + } + } + } + } ctrl.availableGroups = []; ContactService.getGroups().then(function(groups) { |