show day/week/month/year popular topics

This commit is contained in:
barisusakli
2014-07-11 18:43:22 -04:00
parent 13f94ee32a
commit 0362c1a3b0
7 changed files with 58 additions and 33 deletions

View File

@@ -22,17 +22,15 @@ categoriesController.recent = function(req, res, next) {
categoriesController.popular = function(req, res, next) {
var uid = req.user ? req.user.uid : 0;
var set = 'topics:' + req.params.set;
if(!req.params.set) {
set = 'topics:posts';
}
topics.getTopicsFromSet(uid, set, 0, 19, function(err, data) {
var term = req.params.term || 'daily';
topics.getPopular(term, uid, function(err, data) {
if(err) {
return next(err);
}
res.render('popular', data);
res.render('popular', {topics: data});
});
};