changesto category.tpl

v1.18.x
Baris Usakli 12 years ago
parent bbb045698d
commit 4da819b02b

@ -85,9 +85,9 @@ var ajaxify = {};
callback(); callback();
} }
jQuery('#content, #footer').stop(true, true).fadeIn(200, function () { app.process_page();
app.process_page(); jQuery('#content, #footer').stop(true, true).fadeIn(200, function () {
if (window.location.hash) if (window.location.hash)
hash = window.location.hash; hash = window.location.hash;
if (hash) if (hash)

@ -32,30 +32,47 @@
<li class="category-item {topics.deleted-class}" itemprop="itemListElement"> <li class="category-item {topics.deleted-class}" itemprop="itemListElement">
<div class="row"> <div class="row">
<div class="col-md-12 topic-row"> <div class="col-md-12 topic-row">
<div class="latest-post visible-lg visible-md"> <div>
<a href="../../topic/{topics.slug}#{topics.teaser_pid}"> <a href="../../topic/{topics.slug}" itemprop="url">
<div class="pull-right">
<img class="img-rounded" style="width: 48px; height: 48px; /*temporary*/" src="{topics.teaser_userpicture}" />
<p>{topics.teaser_text}</p>
<p class="meta">
<strong>{topics.teaser_username}</strong> posted <span class="timeago" title="{topics.teaser_timestamp}"></span>
</p>
</div>
</a>
</div>
<a href="../../topic/{topics.slug}" itemprop="url">
<div>
<h3> <h3>
<meta itemprop="name" content="{topics.title}"> <meta itemprop="name" content="{topics.title}">
<span class="topic-title"><span class="badge {topics.badgeclass}">{topics.postcount}</span>{topics.title}</span>
<span class="topic-title">
<strong><i class="{topics.pin-icon}"></i> <i class="{topics.lock-icon}"></i></strong>
{topics.title}</span>
</h3> </h3>
<small> </a>
<strong><i class="{topics.pin-icon}"></i> <i class="{topics.lock-icon}"></i></strong> <small>
Posted <span class="timeago" title="{topics.relativeTime}"></span> by <span class="topic-stats">
<strong>{topics.username}</strong>. <span class="badge {topics.badgeclass}">{topics.postcount}</span> posts
</small> </span>
</div> <span class="topic-stats">
</a> <span class="badge {topics.badgeclass}">{topics.viewcount}</span> views
</span>
<span class="pull-right hidden-xs">
<a href="/user/{topics.userslug}">
<img class="img-rounded teaser-pic" src="{topics.picture}" title="{topics.username}"/>
</a>
<a href="../../topic/{topics.slug}">
<span>
posted <span class="timeago" title="{topics.relativeTime}"></span>
</span>
</a>
|
<a href="/user/{topics.teaser_userslug}">
<img class="img-rounded teaser-pic" src="{topics.teaser_userpicture}" title="{topics.teaser_username}"/>
</a>
<a href="../../topic/{topics.slug}#{topics.teaser_pid}">
<span>
replied <span class="timeago" title="{topics.teaser_timestamp}"></span>
</span>
</a>
</span>
</small>
</div>
</div> </div>
</div> </div>
</li> </li>

@ -36,10 +36,12 @@ var RDB = require('./redis.js'),
}); });
} }
Topics.getTopicDataWithUsername = function(tid, callback) { Topics.getTopicDataWithUser = function(tid, callback) {
Topics.getTopicData(tid, function(topic) { Topics.getTopicData(tid, function(topic) {
user.getUserField(topic.uid, 'username', function(err, username) { user.getUserFields(topic.uid, ['username', 'userslug', 'picture'] , function(err, userData) {
topic.username = username; topic.username = userData.username;
topic.userslug = userData.userslug
topic.picture = userData.picture;
callback(topic); callback(topic);
}); });
}); });
@ -281,7 +283,7 @@ var RDB = require('./redis.js'),
function getTopicInfo(topicData, callback) { function getTopicInfo(topicData, callback) {
function getUserInfo(next) { function getUserInfo(next) {
user.getUserFields(topicData.uid, ['username'], next); user.getUserFields(topicData.uid, ['username', 'userslug', 'picture'], next);
} }
function hasReadTopic(next) { function hasReadTopic(next) {
@ -307,6 +309,8 @@ var RDB = require('./redis.js'),
async.parallel([getUserInfo, hasReadTopic, getTeaserInfo, getPrivileges], function(err, results) { async.parallel([getUserInfo, hasReadTopic, getTeaserInfo, getPrivileges], function(err, results) {
callback({ callback({
username: results[0].username, username: results[0].username,
userslug: results[0].userslug,
picture: results[0].picture,
userbanned: results[0].banned, userbanned: results[0].banned,
hasread: results[1], hasread: results[1],
teaserInfo: results[2], teaserInfo: results[2],
@ -333,9 +337,12 @@ var RDB = require('./redis.js'),
topicData['deleted-class'] = topicData.deleted === '1' ? 'deleted' : ''; topicData['deleted-class'] = topicData.deleted === '1' ? 'deleted' : '';
topicData.username = topicInfo.username; topicData.username = topicInfo.username;
topicData.userslug = topicInfo.userslug;
topicData.picture = topicInfo.picture;
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_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;
@ -427,7 +434,7 @@ var RDB = require('./redis.js'),
Topics.getTopicForCategoryView = function(tid, uid, callback) { Topics.getTopicForCategoryView = function(tid, uid, callback) {
function getTopicData(next) { function getTopicData(next) {
Topics.getTopicDataWithUsername(tid, function(topic) { Topics.getTopicDataWithUser(tid, function(topic) {
next(null, topic); next(null, topic);
}); });
} }
@ -461,6 +468,7 @@ var RDB = require('./redis.js'),
topicData.badgeclass = hasRead ? '' : 'badge-important'; topicData.badgeclass = hasRead ? '' : 'badge-important';
topicData.teaser_text = teaser.text || ''; topicData.teaser_text = teaser.text || '';
topicData.teaser_username = teaser.username || ''; topicData.teaser_username = teaser.username || '';
topicData.teaser_userslug = teaser.userslug || '';
topicData.userslug = teaser.userslug || ''; topicData.userslug = teaser.userslug || '';
topicData.teaser_timestamp = teaser.timestamp ? (new Date(parseInt(teaser.timestamp,10)).toISOString()) : ''; topicData.teaser_timestamp = teaser.timestamp ? (new Date(parseInt(teaser.timestamp,10)).toISOString()) : '';
topicData.teaser_userpicture = teaser.picture; topicData.teaser_userpicture = teaser.picture;
@ -501,7 +509,7 @@ var RDB = require('./redis.js'),
}); });
async.each(tids, function(tid, next) { async.each(tids, function(tid, next) {
Topics.getTopicDataWithUsername(tid, function(topicData) { Topics.getTopicDataWithUser(tid, function(topicData) {
topics.push(topicData); topics.push(topicData);
next(); next();
}); });

Loading…
Cancel
Save