|
|
@ -84,8 +84,7 @@ middleware.checkAccountPermissions = function(req, res, next) {
|
|
|
|
middleware.buildHeader = function(req, res, next) {
|
|
|
|
middleware.buildHeader = function(req, res, next) {
|
|
|
|
async.parallel([
|
|
|
|
async.parallel([
|
|
|
|
function(next) {
|
|
|
|
function(next) {
|
|
|
|
// temp, don't forget to set metaTags and linkTags to res.locals.header
|
|
|
|
res.locals.renderHeader = true;
|
|
|
|
res.locals.header = true;
|
|
|
|
|
|
|
|
next();
|
|
|
|
next();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
function(next) {
|
|
|
|
function(next) {
|
|
|
@ -160,7 +159,7 @@ middleware.renderHeader = function (options, callback) {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var uid = '0';
|
|
|
|
var uid = '0';
|
|
|
|
// Meta Tags
|
|
|
|
|
|
|
|
templateValues.metaTags = defaultMetaTags.concat(options.res.locals.metaTags || []).map(function(tag) {
|
|
|
|
templateValues.metaTags = defaultMetaTags.concat(options.res.locals.metaTags || []).map(function(tag) {
|
|
|
|
if(!tag || typeof tag.content !== 'string') {
|
|
|
|
if(!tag || typeof tag.content !== 'string') {
|
|
|
|
winston.warn('Invalid meta tag. ', tag);
|
|
|
|
winston.warn('Invalid meta tag. ', tag);
|
|
|
@ -173,19 +172,17 @@ middleware.renderHeader = function (options, callback) {
|
|
|
|
return tag;
|
|
|
|
return tag;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// Link Tags
|
|
|
|
templateValues.linkTags = defaultLinkTags.concat(options.linkTags || []);
|
|
|
|
/*templateValues.linkTags = defaultLinkTags.concat(options.linkTags || []);
|
|
|
|
|
|
|
|
templateValues.linkTags.push({
|
|
|
|
templateValues.linkTags.push({
|
|
|
|
rel: "icon",
|
|
|
|
rel: "icon",
|
|
|
|
type: "image/x-icon",
|
|
|
|
type: "image/x-icon",
|
|
|
|
href: nconf.get('relative_path') + '/favicon.ico'
|
|
|
|
href: nconf.get('relative_path') + '/favicon.ico'
|
|
|
|
});*/
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if(options.req.user && options.req.user.uid) {
|
|
|
|
if(options.req.user && options.req.user.uid) {
|
|
|
|
uid = options.req.user.uid;
|
|
|
|
uid = options.req.user.uid;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Custom CSS
|
|
|
|
|
|
|
|
templateValues.useCustomCSS = false;
|
|
|
|
templateValues.useCustomCSS = false;
|
|
|
|
if (meta.config.useCustomCSS === '1') {
|
|
|
|
if (meta.config.useCustomCSS === '1') {
|
|
|
|
templateValues.useCustomCSS = true;
|
|
|
|
templateValues.useCustomCSS = true;
|
|
|
@ -216,9 +213,6 @@ middleware.renderHeader = function (options, callback) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
], function() {
|
|
|
|
], function() {
|
|
|
|
/*translator.translate(templates.header.parse(templateValues), function(template) {
|
|
|
|
|
|
|
|
callback(null, template);
|
|
|
|
|
|
|
|
});*/
|
|
|
|
|
|
|
|
app.render('header', templateValues, function(err, template) {
|
|
|
|
app.render('header', templateValues, function(err, template) {
|
|
|
|
callback(null, template);
|
|
|
|
callback(null, template);
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -255,7 +249,7 @@ middleware.processRender = function(req, res, next) {
|
|
|
|
str = str + res.locals.footer;
|
|
|
|
str = str + res.locals.footer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (res.locals.header) {
|
|
|
|
if (res.locals.renderHeader) {
|
|
|
|
middleware.renderHeader({
|
|
|
|
middleware.renderHeader({
|
|
|
|
req: req,
|
|
|
|
req: req,
|
|
|
|
res: res
|
|
|
|
res: res
|
|
|
|