@@ -120,29 +118,20 @@
-
-
-
-
-
+
+
+
+ {{$chip.value}}
+
+
+ {{category}}
+
+
@@ -287,7 +276,6 @@
-
diff --git a/UI/Templates/ContactsUI/UIxContactViewTemplate.wox b/UI/Templates/ContactsUI/UIxContactViewTemplate.wox
index d0aece3af..1d0b4b134 100644
--- a/UI/Templates/ContactsUI/UIxContactViewTemplate.wox
+++ b/UI/Templates/ContactsUI/UIxContactViewTemplate.wox
@@ -17,9 +17,13 @@
diff --git a/UI/WebServerResources/js/Contacts/card-model.js b/UI/WebServerResources/js/Contacts/card-model.js
index a4bf0ac02..69b0a2703 100644
--- a/UI/WebServerResources/js/Contacts/card-model.js
+++ b/UI/WebServerResources/js/Contacts/card-model.js
@@ -48,7 +48,8 @@
Card.$factory = ['$timeout', 'sgSettings', 'sgResource', function($timeout, Settings, Resource) {
angular.extend(Card, {
$$resource: new Resource(Settings.activeUser.folderURL + 'Contacts', Settings.activeUser),
- $timeout: $timeout
+ $timeout: $timeout,
+ $categories: window.UserDefaults.SOGoContactsCategories
});
return Card; // return constructor
@@ -103,6 +104,20 @@
return Card.$unwrapCollection(futureCardData); // a collection of cards
};
+ /**
+ * @function filterCategories
+ * @memberof Card.prototype
+ * @desc Search for categories matching some criterias
+ * @param {string} search - the search string to match
+ * @returns a collection of strings
+ */
+ Card.filterCategories = function(query) {
+ var re = new RegExp(query, 'i');
+ return _.filter(Card.$categories, function(category) {
+ return category.search(re) != -1;
+ });
+ };
+
/**
* @memberof Card
* @desc Unwrap to a collection of Card instances.
@@ -301,7 +316,6 @@
if (i == this.categories.length)
this.categories.push({value: category});
}
- return this.categories.length - 1;
};
Card.prototype.$addEmail = function(type) {
diff --git a/UI/WebServerResources/js/ContactsUI.js b/UI/WebServerResources/js/ContactsUI.js
index b4a479c55..c533f3992 100644
--- a/UI/WebServerResources/js/ContactsUI.js
+++ b/UI/WebServerResources/js/ContactsUI.js
@@ -350,15 +350,12 @@
$scope.allTelTypes = Card.$TEL_TYPES;
$scope.allUrlTypes = Card.$URL_TYPES;
$scope.allAddressTypes = Card.$ADDRESS_TYPES;
+ $scope.categories = {};
$scope.addOrgUnit = function() {
var i = $scope.card.$addOrgUnit('');
focus('orgUnit_' + i);
};
- $scope.addCategory = function() {
- var i = $scope.card.$addCategory('');
- focus('category_' + i);
- };
$scope.addEmail = function() {
var i = $scope.card.$addEmail('');
focus('email_' + i);