summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-04-20 21:44:42 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2016-04-20 21:44:42 +0200
commit72bd8bf6779b144df64e6d56da94c28e9a8b81fe (patch)
tree192cde70e6bffd63562c9a15835f1f5cd0d96f48 /js
parentc8c0c9a9a6a5dcec9b4c946bf52d8c6ab5572062 (diff)
Add support for X-ABLABEL refs #204
Diffstat (limited to 'js')
-rw-r--r--js/components/detailsItem/detailsItem_controller.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/js/components/detailsItem/detailsItem_controller.js b/js/components/detailsItem/detailsItem_controller.js
index fdf970bb..1a5d606f 100644
--- a/js/components/detailsItem/detailsItem_controller.js
+++ b/js/components/detailsItem/detailsItem_controller.js
@@ -38,6 +38,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) {