template changes to recent and unread

v1.18.x
Baris Usakli 12 years ago
parent 6b4520e526
commit 1ec6726459

@ -24,7 +24,6 @@
<div class="{topic_row_size}"> <div class="{topic_row_size}">
<ul id="topics-container"> <ul id="topics-container">
<!-- BEGIN topics --> <!-- BEGIN topics -->
<a href="../../topic/{topics.slug}" id="tid-{topics.tid}">
<li class="category-item {topics.deleted-class}"> <li class="category-item {topics.deleted-class}">
<div class="row"> <div class="row">
<div class="col-md-12 col-xs-12 topic-row img-thumbnail"> <div class="col-md-12 col-xs-12 topic-row img-thumbnail">
@ -39,6 +38,12 @@
<span class="topic-stats"> <span class="topic-stats">
<span class="badge {topics.badgeclass}">{topics.viewcount}</span> views <span class="badge {topics.badgeclass}">{topics.viewcount}</span> views
</span> </span>
|
<span> posted in
<a href="../../category/{topics.categorySlug}">
<i class="{topics.categoryIcon}"></i> {topics.categoryName}
</a>
</span>
<span class="pull-right hidden-xs"> <span class="pull-right hidden-xs">
<a href="/user/{topics.userslug}"> <a href="/user/{topics.userslug}">
@ -61,12 +66,9 @@
</a> </a>
</span> </span>
</small> </small>
</div> </div>
</div> </div>
</li> </li>
</a>
<!-- END topics --> <!-- END topics -->
</ul> </ul>
</div> </div>

@ -19,7 +19,6 @@
<div class="{topic_row_size}"> <div class="{topic_row_size}">
<ul id="topics-container" data-next-start="{nextStart}"> <ul id="topics-container" data-next-start="{nextStart}">
<!-- BEGIN topics --> <!-- BEGIN topics -->
<a href="../../topic/{topics.slug}" id="tid-{topics.tid}">
<li class="category-item {topics.deleted-class}"> <li class="category-item {topics.deleted-class}">
<div class="row"> <div class="row">
<div class="col-md-12 topic-row"> <div class="col-md-12 topic-row">
@ -33,6 +32,12 @@
<span class="topic-stats"> <span class="topic-stats">
<span class="badge {topics.badgeclass}">{topics.viewcount}</span> views <span class="badge {topics.badgeclass}">{topics.viewcount}</span> views
</span> </span>
|
<span> posted in
<a href="../../category/{topics.categorySlug}">
<i class="{topics.categoryIcon}"></i> {topics.categoryName}
</a>
</span>
<span class="pull-right hidden-xs"> <span class="pull-right hidden-xs">
<a href="/user/{topics.userslug}"> <a href="/user/{topics.userslug}">
@ -58,7 +63,6 @@
</div> </div>
</div> </div>
</li> </li>
</a>
<!-- END topics --> <!-- END topics -->
</ul> </ul>
<button id="load-more-btn" class="btn btn-primary hide">[[unread:load_more]]</button> <button id="load-more-btn" class="btn btn-primary hide">[[unread:load_more]]</button>

@ -310,13 +310,7 @@ var RDB = require('./redis.js'),
}; };
Categories.getCategoryFields = function(cid, fields, callback) { Categories.getCategoryFields = function(cid, fields, callback) {
RDB.hmgetObject('category:' + cid, fields, function(err, data) { RDB.hmgetObject('category:' + cid, fields, callback);
if (err === null) {
callback(data);
} else {
winston.err(err);
}
});
}; };
Categories.setCategoryField = function(cid, field, value) { Categories.setCategoryField = function(cid, field, value) {

@ -306,7 +306,14 @@ var RDB = require('./redis.js'),
}); });
} }
async.parallel([getUserInfo, hasReadTopic, getTeaserInfo, getPrivileges], function(err, results) { function getCategoryInfo(next) {
categories.getCategoryFields(topicData.cid, ['name', 'slug', 'icon'], function(err, categoryData) {
console.log(categoryData);
next(err, categoryData);
});
}
async.parallel([getUserInfo, hasReadTopic, getTeaserInfo, getPrivileges, getCategoryInfo], function(err, results) {
callback({ callback({
username: results[0].username, username: results[0].username,
userslug: results[0].userslug, userslug: results[0].userslug,
@ -314,7 +321,8 @@ var RDB = require('./redis.js'),
userbanned: results[0].banned, userbanned: results[0].banned,
hasread: results[1], hasread: results[1],
teaserInfo: results[2], teaserInfo: results[2],
privileges: results[3] privileges: results[3],
categoryData: results[4]
}); });
}); });
} }
@ -339,13 +347,15 @@ var RDB = require('./redis.js'),
topicData.username = topicInfo.username; topicData.username = topicInfo.username;
topicData.userslug = topicInfo.userslug; topicData.userslug = topicInfo.userslug;
topicData.picture = topicInfo.picture; topicData.picture = topicInfo.picture;
topicData.categoryIcon = topicInfo.categoryData.icon;
topicData.categoryName = topicInfo.categoryData.name;
topicData.categorySlug = topicInfo.categoryData.slug;
topicData.badgeclass = (topicInfo.hasread && current_user != 0) ? '' : 'badge-important'; topicData.badgeclass = (topicInfo.hasread && current_user != 0) ? '' : 'badge-important';
topicData.teaser_text = topicInfo.teaserInfo.text || '', topicData.teaser_text = topicInfo.teaserInfo.text || '',
topicData.teaser_username = topicInfo.teaserInfo.username || ''; topicData.teaser_username = topicInfo.teaserInfo.username || '';
topicData.teaser_userslug = topicInfo.teaserInfo.userslug || ''; topicData.teaser_userslug = topicInfo.teaserInfo.userslug || '';
topicData.teaser_userpicture = topicInfo.teaserInfo.picture || require('gravatar').url('', {}, https = nconf.get('https')); topicData.teaser_userpicture = topicInfo.teaserInfo.picture || require('gravatar').url('', {}, https = nconf.get('https'));
topicData.teaser_pid = topicInfo.teaserInfo.pid; topicData.teaser_pid = topicInfo.teaserInfo.pid;
topicData.teaser_timestamp = topicInfo.teaserInfo.timestamp ? (new Date(parseInt(topicInfo.teaserInfo.timestamp, 10)).toISOString()) : ''; topicData.teaser_timestamp = topicInfo.teaserInfo.timestamp ? (new Date(parseInt(topicInfo.teaserInfo.timestamp, 10)).toISOString()) : '';
if (isTopicVisible(topicData, topicInfo)) if (isTopicVisible(topicData, topicInfo))

Loading…
Cancel
Save