style change

v1.18.x
Barış Soner Uşaklı 7 years ago
parent 9d7e0775aa
commit 9c59abefbf

@ -8,7 +8,7 @@ var topics = require('../topics');
var pagination = require('../pagination'); var pagination = require('../pagination');
var helpers = require('./helpers'); var helpers = require('./helpers');
var tagsController = {}; var tagsController = module.exports;
tagsController.getTag = function (req, res, next) { tagsController.getTag = function (req, res, next) {
var tag = validator.escape(String(req.params.tag)); var tag = validator.escape(String(req.params.tag));
@ -33,7 +33,7 @@ tagsController.getTag = function (req, res, next) {
templateData.nextStart = stop + 1; templateData.nextStart = stop + 1;
async.parallel({ async.parallel({
topicCount: function (next) { topicCount: function (next) {
topics.getTagTopicCount(tag, next); topics.getTagTopicCount(req.params.tag, next);
}, },
tids: function (next) { tids: function (next) {
topics.getTagTids(req.params.tag, start, stop, next); topics.getTagTids(req.params.tag, start, stop, next);
@ -47,11 +47,7 @@ tagsController.getTag = function (req, res, next) {
topicCount = results.topicCount; topicCount = results.topicCount;
topics.getTopics(results.tids, req.uid, next); topics.getTopics(results.tids, req.uid, next);
}, },
], function (err, topics) { function (topics) {
if (err) {
return next(err);
}
res.locals.metaTags = [ res.locals.metaTags = [
{ {
name: 'title', name: 'title',
@ -68,14 +64,16 @@ tagsController.getTag = function (req, res, next) {
templateData.pagination = pagination.create(page, pageCount); templateData.pagination = pagination.create(page, pageCount);
res.render('tag', templateData); res.render('tag', templateData);
}); },
], next);
}; };
tagsController.getTags = function (req, res, next) { tagsController.getTags = function (req, res, next) {
topics.getTags(0, 99, function (err, tags) { async.waterfall([
if (err) { function (next) {
return next(err); topics.getTags(0, 99, next);
} },
function (tags) {
tags = tags.filter(Boolean); tags = tags.filter(Boolean);
var data = { var data = {
tags: tags, tags: tags,
@ -84,7 +82,6 @@ tagsController.getTags = function (req, res, next) {
title: '[[pages:tags]]', title: '[[pages:tags]]',
}; };
res.render('tags', data); res.render('tags', data);
}); },
], next);
}; };
module.exports = tagsController;

Loading…
Cancel
Save