removed updateHeader, the header is using template values in from the
api, update menu partial in vanilla theme as well
This commit is contained in:
barisusakli
2014-05-06 18:42:38 -04:00
parent 678f0f436e
commit 883978007d
7 changed files with 76 additions and 156 deletions

View File

@@ -207,7 +207,7 @@ middleware.renderHeader = function(req, res, callback) {
csrf: res.locals.csrf_token,
navigation: custom_header.navigation,
allowRegistration: meta.config.allowRegistration === undefined || parseInt(meta.config.allowRegistration, 10) === 1,
searchEnabled: plugins.hasListeners('filter:search.query') ? true : false
searchEnabled: plugins.hasListeners('filter:search.query') && (uid || parseInt(meta.config.allowGuestSearching, 10) === 1)
},
escapeList = {
'&': '&',
@@ -264,13 +264,22 @@ middleware.renderHeader = function(req, res, callback) {
},
isAdmin: function(next) {
user.isAdministrator(uid, next);
},
user: function(next) {
if (uid) {
user.getUserFields(uid, ['username', 'userslug', 'picture', 'status'], next);
} else {
next();
}
}
}, function(err, results) {
if (err) {
return next(err);
}
templateValues.browserTitle = results.title;
templateValues.isAdmin = results.isAdmin || false;
templateValues.user = results.user;
app.render('header', templateValues, callback);
});