mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 03:26:04 +01:00
made breadcrumbs regular function
less db calls as well
This commit is contained in:
@@ -123,6 +123,26 @@ topicsController.get = function(req, res, next) {
|
||||
next(null, topicData);
|
||||
});
|
||||
},
|
||||
function (topicData, next) {
|
||||
var breadcrumbs = [
|
||||
{
|
||||
text: topicData.category.name,
|
||||
url: nconf.get('relative_path') + '/category/' + topicData.category.slug
|
||||
},
|
||||
{
|
||||
text: topicData.title,
|
||||
url: nconf.get('relative_path') + '/topic/' + topicData.slug
|
||||
}
|
||||
];
|
||||
|
||||
helpers.buildBreadcrumbs(topicData.category.parentCid, function(err, crumbs) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
topicData.breadcrumbs = crumbs.concat(breadcrumbs);
|
||||
next(null, topicData);
|
||||
});
|
||||
},
|
||||
function (topicData, next) {
|
||||
var description = '';
|
||||
|
||||
@@ -245,7 +265,6 @@ topicsController.get = function(req, res, next) {
|
||||
}
|
||||
}
|
||||
|
||||
data.breadcrumbs = res.locals.breadcrumbs;
|
||||
res.render('topic', data);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user