Enable search by fullname and email

This commit is contained in:
Alexandre Cloutier
2015-06-11 15:27:09 -04:00
committed by Francis Lachapelle
parent 7e43b13f21
commit 5b83b0c7b6
4 changed files with 91 additions and 50 deletions
@@ -0,0 +1,28 @@
(function() {
'use strict';
function User() {}
/* The factory we'll use to register with Angular */
User.factory = ['sgSettings', 'sgResource', function(Settings, Resource) {
angular.extend(User, {
$$resource: new Resource(Settings.baseURL)
});
return User; // return constructor
}];
/* Factory registration in Angular module */
angular.module('SOGo.Common').factory('sgUser', User.factory);
/* Instance methods
* Public method, assigned to prototype
*/
User.prototype.$filter = function(search) {
// return a collections of users for a filter
var param = {search: search};
return User.$$resource.fetch(null, "usersSearch", param).then(function(results) {
return results;
})
};
})();