mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-09 05:25:26 +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) {
|
||||
|
||||
Reference in New Issue
Block a user