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);
};
/**
+1 -1
View File
@@ -1,5 +1,5 @@
/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* JavaScript for common UI services for mobile theme */
/* JavaScript for common UI services */
(function() {
'use strict';
@@ -199,7 +199,6 @@
// link.on('dblclick', function() {
// });
scope.$on('sgSelectFolder', function(event, folderId) {
console.debug('select folder ' + folderId + ' = ' + scope.folder.id);
if (folderId == scope.folder.id) {
var list = iElement.parent();
while (list[0].tagName != 'UL') {
@@ -367,7 +366,6 @@
});
};
$scope.selectFolder = function(folder) {
console.debug("select folder " + folder.displayName);
$scope.onFolderSelect(folder);
};
}],
@@ -55,9 +55,10 @@
* @memberof User.prototype
* @return the fullname along with the email address
*/
User.prototype.$shortFormat = function() {
User.prototype.$shortFormat = function(options) {
var fullname = this.cn || this.c_email;
if (this.c_email && fullname != this.c_email) {
var no_email = options && options.email === false;
if (!no_email && this.c_email && fullname != this.c_email) {
fullname += ' (' + this.c_email + ')';
}
return fullname;
+19
View File
@@ -71,6 +71,25 @@ String.prototype.base64decode = function() {
return output;
};
String.prototype.asCSSIdentifier = function() {
var characters = [ '_' , '\\.', '#' , '@' , '\\*', ':' , ',' , ' '
, "'", '&', '\\+' ];
var escapeds = [ '_U_', '_D_', '_H_', '_A_', '_S_', '_C_', '_CO_',
'_SP_', '_SQ_', '_AM_', '_P_' ];
var newString = this;
for (var i = 0; i < characters.length; i++) {
var re = new RegExp(characters[i], 'g');
newString = newString.replace(re, escapeds[i]);
}
if (/^\d+/.test(newString)) {
newString = '_' + newString;
}
return newString;
};
function l() {
var key = arguments[0];
var value = key;