Skip to content

Commit

Permalink
Add support for X-ABLABEL refs #204 (#377)
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepDiver1975 authored Aug 24, 2016
1 parent 81f7975 commit 10fa229
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions js/components/detailsItem/detailsItem_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 10fa229

Please sign in to comment.