This commit is contained in:
barisusakli
2015-09-16 14:45:39 -04:00
parent 00f2778534
commit ade9a44b11
6 changed files with 42 additions and 47 deletions

View File

@@ -19,7 +19,14 @@ var terms = {
popularController.get = function(req, res, next) {
var term = terms[req.params.term] || 'day';
var term = terms[req.params.term] || 'alltime';
var termToBreadcrumb = {
day: '[[recent:day]]',
week: '[[recent:week]]',
month: '[[recent:month]]',
alltime: '[[global:header.popular]]'
};
if (!req.uid) {
if (anonCache[term] && (Date.now() - lastUpdateTime) < 60 * 60 * 1000) {
@@ -40,7 +47,13 @@ popularController.get = function(req, res, next) {
};
if (req.path.startsWith('/api/popular') || req.path.startsWith('/popular')) {
data.breadcrumbs = helpers.buildBreadcrumbs([{text: '[[global:header.popular]]'}]);
var breadcrumbs = [{text: termToBreadcrumb[term]}];
if (req.params.term) {
breadcrumbs.unshift({text: '[[global:header.popular]]', url: '/popular'});
}
data.breadcrumbs = helpers.buildBreadcrumbs(breadcrumbs);
}
if (!req.uid) {