diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-04-15 11:50:52 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-04-15 11:50:52 +0200 |
commit | 246dc972c470a62eaaa9ffababbbe39e1bbd9f25 (patch) | |
tree | 34fa97f9cd9c7f0a0efa905a73c26995671a98e5 /js | |
parent | 5a8b7860e3186127ed3509e837e9a0db23c21a42 (diff) |
In case there is not fullName we use the company name - fixes #335
Diffstat (limited to 'js')
-rw-r--r-- | js/components/contactList/contactList_controller.js | 5 | ||||
-rw-r--r-- | js/models/contact_model.js | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/js/components/contactList/contactList_controller.js b/js/components/contactList/contactList_controller.js index 4ecd1713..33f4f786 100644 --- a/js/components/contactList/contactList_controller.js +++ b/js/components/contactList/contactList_controller.js @@ -27,7 +27,6 @@ angular.module('contactsApp') } if (ev.event === 'changeSearch') { ctrl.searchTerm = ev.searchTerm; - ctrl.t.emptySearch; ctrl.t.emptySearch = t('contacts', 'No search result for {query}', {query: ctrl.searchTerm} @@ -151,8 +150,8 @@ angular.module('contactsApp') }); // Watch if we have an invalid contact - $scope.$watch('ctrl.contactList[0].fullName()', function(fullName) { - ctrl.invalid = fullName === ''; + $scope.$watch('ctrl.contactList[0].displayName()', function(displayName) { + ctrl.invalid = (displayName === ''); }); ctrl.createContact = function() { diff --git a/js/models/contact_model.js b/js/models/contact_model.js index cc2579fc..6954b590 100644 --- a/js/models/contact_model.js +++ b/js/models/contact_model.js @@ -19,6 +19,10 @@ angular.module('contactsApp') } }, + displayName: function() { + return this.fullName() || this.org() || ''; + }, + fullName: function(value) { var model = this; if (angular.isDefined(value)) { |