more cleanup and changes to topics

This commit is contained in:
Baris Soner Usakli
2014-02-26 16:43:21 -05:00
parent d149622f0b
commit ea6cf3bbd5
12 changed files with 119 additions and 148 deletions

View File

@@ -59,39 +59,27 @@ var db = require('./database'),
Categories.markAsRead(cid, uid);
}
function getCategoryData(next) {
Categories.getCategoryData(cid, next);
}
function getTopics(next) {
Categories.getCategoryTopics(cid, start, end, uid, next);
}
function getPageCount(next) {
Categories.getPageCount(cid, uid, next);
}
async.parallel({
'category': getCategoryData,
'topics': getTopics,
'pageCount': getPageCount
category: function(next) {
Categories.getCategoryData(cid, next);
},
topics : function(next) {
Categories.getCategoryTopics(cid, start, end, uid, next);
},
pageCount: function(next) {
Categories.getPageCount(cid, uid, next);
}
}, function(err, results) {
if(err) {
return callback(err);
}
var category = {
'category_name': results.category.name,
'category_description': results.category.description,
'link': results.category.link,
'disabled': results.category.disabled,
'topic_row_size': 'col-md-9',
'category_id': cid,
'topics': results.topics.topics,
'nextStart': results.topics.nextStart,
'pageCount': results.pageCount,
'disableSocialButtons': meta.config.disableSocialButtons !== undefined ? parseInt(meta.config.disableSocialButtons, 10) !== 0 : false,
};
var category = results.category;
category.topics = results.topics.topics;
category.nextStart = results.topics.nextStart;
category.pageCount = results.pageCount;
category.disableSocialButtons = meta.config.disableSocialButtons !== undefined ? parseInt(meta.config.disableSocialButtons, 10) !== 0 : false;
category.topic_row_size = 'col-md-9';
callback(null, category);
});