mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-28 16:29:30 +00:00
Using chips for adding/viewing contact categories
This commit is contained in:
committed by
Francis Lachapelle
parent
8557b2a161
commit
a166d1b4cf
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user