Permalink
Browse files

Add prettySize helper.

Fix prettyDate helper for "1 week ago" instead of "1 weeks ago"
Add warning into router when admin is set but no permit.
Don't warn 401 when logging out.
Add escapeHtmlQuotes into Utils.
Add missing 403 error template page.
Upgrade to jquery 1.7.2
Add support for directory upload in chrome.
Fix perm routine for user menu.
Add mail-templates style for mail module.
Add formPopup style.
  • Loading branch information...
1 parent 98acdce commit 76602deb755711807539f78d2057f3053e020ecf @richtera richtera committed May 23, 2012
View
@@ -24,19 +24,11 @@ var Client = module.exports = function Client(options) {
this.scripts = [];
this.styles = [];
- // Shortcuts to core, must be included somewhere (module or theme) to be rendered
- this.coreScripts = {
- 'jquery': {
- key: 'jquery',
- url: 'jquery-1.6.4.min.js',
- weight: -100
- },
- 'calipso': {
- key: 'calipso',
- url: 'calipso.js',
- weight: -50
- }
- };
+ // Shortcuts to core, must be included somewhere (module or theme) to be rendered
+ this.coreScripts = {
+ 'jquery': {key:'jquery', url:'jquery-1.7.2.min.js', weight: -100},
+ 'calipso': {key:'calipso', url:'calipso.js', weight: -50}
+ }
};
Oops, something went wrong.
Oops, something went wrong.
View
@@ -215,7 +215,8 @@ me.defaultTagRenderer = function(field, value, bare){
+ ' id="' + (field.id ? field.id : field.name + (field.type=='radio' ? (++f.radioCount) : '')) + '"'
+ (field.src ? ' src="' + field.src + '"' : '') // for input type=image .. which should be avoided anyway.
+ (field.multiple ? ' multiple="' + field.multiple + '"' : '') // for input type=file
- + ' value="' + (value || field.value || (isCheckable && 'on') || '') + '"'
+ + (field.directory ? ' mozdirectory webkitdirectory directory' : '') //for input type=file
+ + ' value="' + calipso.utils.escapeHtmlQuotes(value || field.value || (isCheckable && 'on') || '') + '"'
+ (field.readonly || field.disabled ? ' disabled' : '')
+ (checked ? ' checked' : '')
+ f.tagClose;
@@ -1187,7 +1188,10 @@ function processSectionData(form, formData, next) {
if(form.sections) {
form.sections.forEach(function(section) {
- fields.push(section.fields);
+ // Ensure section isn't null
+ if(section) {
+ fields.push(section.fields);
+ }
});
}
if(form.fields) {
View
@@ -88,6 +88,15 @@ exports = module.exports = {
},
/**
+ * Pretty size helper
+ */
+ prettySize: function(req, res, calipso) {
+
+ var prettyFn = calipso.lib.prettySize.prettySize;
+ return prettyFn;
+ },
+
+ /**
* Hot date helper
*/
hotDate: function(req, res, calipso) {
View
@@ -21,6 +21,7 @@ module.exports = {
ejs: require('ejs'),
pager: require(rootpath + 'utils/pager'),
prettyDate: require(rootpath + 'utils/prettyDate.js'),
+ prettySize: require(rootpath + 'utils/prettySize.js'),
crypto: require(rootpath + 'utils/crypto.js'),
connect: require('connect'),
_: require('underscore'),
@@ -179,7 +179,7 @@ function PermissionFilter(options, permit) {
PermissionFilter.prototype.check = function(req) {
var self = this;
-
+ if (!self.permit && self.options.permit) self.permit = self.options.permit;
if (self.permit) {
var user = req.session.user;
View
@@ -139,6 +139,10 @@ var Router = function(moduleName, modulePath) {
// If admin, then set the route
if (route.admin) {
res.layout = "admin";
+ if(!route.permit){
+ calipso.debug("Route has admin only but no permit is defined!");
+ route.permit = calipso.permission.Helper.hasPermission("admin");
+ }
}
// TODO
@@ -155,8 +159,10 @@ var Router = function(moduleName, modulePath) {
};
if (!permit.allow) {
if (!allPages) {
- req.flash('error', req.t(permit.msg));
- res.statusCode = 401;
+ if (!req.cookies.logout) {
+ req.flash('error', req.t(permit.msg));
+ res.statusCode = 401;
+ }
res.redirect("/");
return group()();
} else {
View
@@ -67,5 +67,13 @@ module.exports = {
if (key !== '_id') copy.set(key, object.get(key));
});
+ },
+ escapeHtmlQuotes: function (string) {
+ if (string && string.replace) {
+ return string.replace(/\"/g, '"').replace(/\'/g, ''');
+ }
+ else {
+ return string;
+ }
}
};
Oops, something went wrong.

0 comments on commit 76602de

Please sign in to comment.