v1.18.x
barisusakli 9 years ago
parent bf70f3764e
commit cb9b51e8a5

@ -175,9 +175,11 @@ accountsController.getAccount = function(req, res, next) {
userData.posts = results.posts.posts.filter(function (p) {
return p && parseInt(p.deleted, 10) !== 1;
});
userData.aboutme = results.aboutme;
userData.nextStart = results.posts.nextStart;
userData.isFollowing = results.isFollowing;
userData.breadcrumbs = helpers.buildBreadcrumbs([{text: userData.username}]);
if (!userData.profileviews) {
userData.profileviews = 1;
@ -224,25 +226,26 @@ function getFollow(tpl, name, req, res, callback) {
userData.users = users;
userData.nextStart = 50;
userData.title = '[[pages:' + tpl + ', ' + userData.username + ']]';
userData.breadcrumbs = helpers.buildBreadcrumbs([{text: userData.username, url: '/user/' + userData.userslug}, {text: '[[user:' + name + ']]'}]);
res.render(tpl, userData);
});
}
accountsController.getFavourites = function(req, res, next) {
getFromUserSet('account/favourites', 'favourites', posts.getPostSummariesFromSet, 'posts', req, res, next);
getFromUserSet('account/favourites', 'favourites', '[[user:favourites]]', posts.getPostSummariesFromSet, 'posts', req, res, next);
};
accountsController.getPosts = function(req, res, next) {
getFromUserSet('account/posts', 'posts', posts.getPostSummariesFromSet, 'posts', req, res, next);
getFromUserSet('account/posts', 'posts', '[[global:posts]]', posts.getPostSummariesFromSet, 'posts', req, res, next);
};
accountsController.getWatchedTopics = function(req, res, next) {
getFromUserSet('account/watched', 'followed_tids', topics.getTopicsFromSet, 'topics', req, res, next);
getFromUserSet('account/watched', 'followed_tids', '[[user:watched]]',topics.getTopicsFromSet, 'topics', req, res, next);
};
accountsController.getTopics = function(req, res, next) {
getFromUserSet('account/topics', 'topics', topics.getTopicsFromSet, 'topics', req, res, next);
getFromUserSet('account/topics', 'topics', '[[global:topics]]', topics.getTopicsFromSet, 'topics', req, res, next);
};
accountsController.getGroups = function(req, res, next) {
@ -259,12 +262,13 @@ accountsController.getGroups = function(req, res, next) {
userData.groups = groupsData[0];
userData.groups.forEach(groups.escapeGroupData);
userData.title = '[[pages:account/groups, ' + userData.username + ']]';
userData.breadcrumbs = helpers.buildBreadcrumbs([{text: userData.username, url: '/user/' + userData.userslug}, {text: '[[global:header.groups]]'}]);
res.render('account/groups', userData);
});
});
};
function getFromUserSet(tpl, set, method, type, req, res, next) {
function getFromUserSet(tpl, set, crumb, method, type, req, res, next) {
async.parallel({
settings: function(next) {
user.getSettings(req.uid, next);
@ -310,6 +314,7 @@ function getFromUserSet(tpl, set, method, type, req, res, next) {
userData.pagination = pagination.create(page, pageCount);
userData.title = '[[pages:' + tpl + ', ' + userData.username + ']]';
userData.breadcrumbs = helpers.buildBreadcrumbs([{text: userData.username, url: '/user/' + userData.userslug}, {text: crumb}]);
res.render(tpl, userData);
});
@ -371,6 +376,7 @@ accountsController.accountEdit = function(req, res, callback) {
userData.hasPassword = !!password;
userData.title = '[[pages:account/edit, ' + userData.username + ']]';
userData.breadcrumbs = helpers.buildBreadcrumbs([{text: userData.username, url: '/user/' + userData.userslug}, {text: '[[user:edit]]'}]);
res.render('account/edit', userData);
});
};
@ -457,6 +463,7 @@ accountsController.accountSettings = function(req, res, callback) {
userData.disableCustomUserSkins = parseInt(meta.config.disableCustomUserSkins, 10) === 1;
userData.title = '[[pages:account/settings]]';
userData.breadcrumbs = helpers.buildBreadcrumbs([{text: userData.username, url: '/user/' + userData.userslug}, {text: '[[user:settings]]'}]);
res.render('account/settings', userData);
});
@ -587,7 +594,7 @@ accountsController.getChats = function(req, res, callback) {
messages: data.messages,
allowed: data.allowed,
title: '[[pages:chat, ' + data.toUser.username + ']]',
breadcrumbs: helpers.buildBreadcrumbs([{text: '[[pages:chats]]', url: nconf.get('relative_path') + '/chats'}, {text: data.toUser.username}])
breadcrumbs: helpers.buildBreadcrumbs([{text: '[[pages:chats]]', url: '/chats'}, {text: data.toUser.username}])
});
});
});

@ -66,6 +66,9 @@ categoriesController.list = function(req, res, next) {
}
data.title = '[[pages:categories]]';
if (req.path.startsWith('/api/categories') || req.path.startsWith('/categories')) {
data.breadcrumbs = helpers.buildBreadcrumbs([{text: data.title}]);
}
plugins.fireHook('filter:categories.build', {req: req, res: res, templateData: data}, function(err, data) {
if (err) {

@ -17,6 +17,7 @@ groupsController.list = function(req, res, next) {
return next(err);
}
data.title = '[[pages:groups]]';
data.breadcrumbs = helpers.buildBreadcrumbs([{text: '[[pages:groups]]'}]);
res.render('groups/list', data);
});
};
@ -90,6 +91,7 @@ groupsController.details = function(req, res, callback) {
}
results.title = '[[pages:group, ' + results.group.displayName + ']]';
results.breadcrumbs = helpers.buildBreadcrumbs([{text: '[[pages:groups]]', url: '/groups' }, {text: results.group.slug}]);
res.render('groups/details', results);
});
});
@ -108,10 +110,17 @@ groupsController.members = function(req, res, next) {
return next(err);
}
var breadcrumbs = helpers.buildBreadcrumbs([
{text: '[[pages:groups]]', url: '/groups' },
{text: req.params.slug, url: '/groups/' + req.params.slug},
{text: '[[groups:details.members]]'}
]);
res.render('groups/members', {
users: users,
nextStart: 50,
loadmore_display: users.length > 50 ? 'block' : 'hide',
breadcrumbs: breadcrumbs
});
});
};

@ -36,10 +36,13 @@ popularController.get = function(req, res, next) {
topics: topics,
'feeds:disableRSS': parseInt(meta.config['feeds:disableRSS'], 10) === 1,
rssFeedUrl: nconf.get('relative_path') + '/popular/' + (req.params.term || 'daily') + '.rss',
breadcrumbs: helpers.buildBreadcrumbs([{text: '[[global:header.popular]]'}]),
title: '[[pages:popular-' + term + ']]'
};
if (req.path.startsWith('/api/popular') || req.path.startsWith('/popular')) {
data.breadcrumbs = helpers.buildBreadcrumbs([{text: '[[global:header.popular]]'}]);
}
if (!req.uid) {
anonCache[term] = data;
lastUpdateTime = Date.now();

@ -20,8 +20,10 @@ recentController.get = function(req, res, next) {
data['feeds:disableRSS'] = parseInt(meta.config['feeds:disableRSS'], 10) === 1;
data.rssFeedUrl = nconf.get('relative_path') + '/recent.rss';
data.breadcrumbs = helpers.buildBreadcrumbs([{text: '[[recent:title]]'}]);
data.title = '[[pages:recent]]';
if (req.path.startsWith('/api/recent') || req.path.startsWith('/recent')) {
data.breadcrumbs = helpers.buildBreadcrumbs([{text: '[[recent:title]]'}]);
}
plugins.fireHook('filter:recent.build', {req: req, res: res, templateData: data}, function(err, data) {
if (err) {

Loading…
Cancel
Save