Initial AngularJS version of Webmail (desktop)

This commit is contained in:
Francis Lachapelle
2014-11-25 16:09:55 -05:00
parent 1c9da902d3
commit 2f17e94fef
14 changed files with 995 additions and 169 deletions
+20 -8
View File
@@ -117,6 +117,24 @@
return deferred.promise;
};
/**
* @function post
* @memberof Resource.prototype
* @desc Post a resource attributes on the server.
* @return a promise
*/
Resource.prototype.post = function(id, action, data) {
var deferred = this._q.defer(),
path = this._path + '/' + id + '/' + action;
this._http
.post(path, data)
.success(deferred.resolve)
.error(deferred.reject);
return deferred.promise;
};
/**
* @function save
* @memberof Resource.prototype
@@ -125,15 +143,9 @@
*/
Resource.prototype.save = function(id, newValue, options) {
var deferred = this._q.defer(),
action = (options && options.action)? options.action : 'save',
path = this._path + '/' + id + '/' + action;
action = (options && options.action)? options.action : 'save';
this._http
.post(path, newValue)
.success(deferred.resolve)
.error(deferred.reject);
return deferred.promise;
return this.post(id, action, newValue);
};
/**