mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 03:26:04 +01:00
started to add real data to the topics listing, got latest post working per topic
This commit is contained in:
@@ -170,23 +170,33 @@ footer.footer {
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 767px)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.category {
|
||||
ul {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
.topic-row {
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.latest-post {
|
||||
|
||||
.topic-row {
|
||||
border-radius: 5px;
|
||||
width: 100%;
|
||||
padding-left: 20px;
|
||||
|
||||
h3 {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
margin-top: 4px;
|
||||
line-height: 30px;
|
||||
color: rgb(0, 136, 204);
|
||||
|
||||
small {
|
||||
vertical-align: 2px;
|
||||
strong {
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.latest-post {
|
||||
float: right;
|
||||
padding-top: 2px;
|
||||
margin-right: 30px;
|
||||
@@ -214,26 +224,11 @@ footer.footer {
|
||||
height: 50px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.topic-row {
|
||||
width: 100%;
|
||||
padding-left: 20px;
|
||||
|
||||
h3 {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
margin-top: 4px;
|
||||
line-height: 30px;
|
||||
color: rgb(0, 136, 204);
|
||||
|
||||
small {
|
||||
vertical-align: 3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.post-container {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
|
||||
@@ -13,15 +13,17 @@
|
||||
<a href="../../topic/{topics.slug}"><li>
|
||||
<div class="row-fluid">
|
||||
<div class="span12 topic-row img-polaroid">
|
||||
<div class="latest-post visible-desktop visible-tablet">
|
||||
<div class="latest-post visible-desktop">
|
||||
<div class="pull-right">
|
||||
<img class="hidden-tablet" src="http://www.gravatar.com/avatar/fd37ce111f863c6665045c2d72d199bf?s=50" />
|
||||
<p><strong>psychobunny</strong>: Some post content goes here, the latest posts of course blah blahposts of course blah blahposts of course blah blahposts of course blah blah</p>
|
||||
<img src="{topics.recent_picture}?s=50" />
|
||||
<p><strong>{topics.recent_author}</strong>: {topics.recent_post}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h3><span class="badge {topics.badgeclass}">{topics.post_count}</span> {topics.title} <small>24<i class="icon-star"></i><br />Posted {topics.relativeTime} ago by
|
||||
<span class="username">{topics.username}</span>.</small></h3>
|
||||
<h3><span class="badge {topics.badgeclass}">{topics.post_count}</span> {topics.title} <small>24<i class="icon-star"></i><br />
|
||||
<strong><i class="{topics.pin-icon}"></i><i class="{topics.lock-icon}"></i></strong>
|
||||
Posted {topics.relativeTime} ago by
|
||||
<strong>{topics.username}</strong>.</small></h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -213,6 +213,14 @@ marked.setOptions({
|
||||
|
||||
RDB.incr('tid:' + tid + ':postcount');
|
||||
|
||||
|
||||
user.getUserFields(uid, ['username','picture'], function(data){
|
||||
RDB.set('tid:' + tid + ':recent:post', content);
|
||||
RDB.set('tid:' + tid + ':recent:author', data.username);
|
||||
RDB.set('tid:' + tid + ':recent:picture', data.picture);
|
||||
});
|
||||
|
||||
|
||||
// User Details - move this out later
|
||||
RDB.lpush('uid:' + uid + ':posts', pid);
|
||||
|
||||
|
||||
@@ -27,7 +27,10 @@ var RDB = require('./redis.js'),
|
||||
postcount = [],
|
||||
locked = [],
|
||||
deleted = [],
|
||||
pinned = [];
|
||||
pinned = [],
|
||||
recent_post = [],
|
||||
recent_author = [],
|
||||
recent_picture = [];
|
||||
|
||||
for (var i=0, ii=tids.length; i<ii; i++) {
|
||||
title.push('tid:' + tids[i] + ':title');
|
||||
@@ -38,6 +41,9 @@ var RDB = require('./redis.js'),
|
||||
locked.push('tid:' + tids[i] + ':locked');
|
||||
deleted.push('tid:' + tids[i] + ':deleted');
|
||||
pinned.push('tid:' + tids[i] + ':pinned');
|
||||
recent_post.push('tid:' + tids[i] + ':recent:post');
|
||||
recent_author.push('tid:' + tids[i] + ':recent:author');
|
||||
recent_picture.push('tid:' + tids[i] + ':recent:picture');
|
||||
}
|
||||
|
||||
var multi = RDB.multi()
|
||||
@@ -53,6 +59,9 @@ var RDB = require('./redis.js'),
|
||||
.mget(locked)
|
||||
.mget(deleted)
|
||||
.mget(pinned)
|
||||
.mget(recent_post)
|
||||
.mget(recent_author)
|
||||
.mget(recent_picture)
|
||||
}
|
||||
|
||||
|
||||
@@ -69,6 +78,9 @@ var RDB = require('./redis.js'),
|
||||
locked = replies[6];
|
||||
deleted = replies[7];
|
||||
pinned = replies[8];
|
||||
recent_post = replies[9];
|
||||
recent_author = replies[10];
|
||||
recent_picture = replies[11];
|
||||
|
||||
var usernames,
|
||||
has_read;
|
||||
@@ -76,6 +88,7 @@ var RDB = require('./redis.js'),
|
||||
function generate_topic() {
|
||||
if (!usernames || !has_read) return;
|
||||
|
||||
|
||||
for (var i=0, ii=title.length; i<ii; i++) {
|
||||
topics.push({
|
||||
'title' : title[i],
|
||||
@@ -89,7 +102,10 @@ var RDB = require('./redis.js'),
|
||||
'deleted': deleted[i],
|
||||
'pinned': parseInt(pinned[i] || 0), // For sorting purposes
|
||||
'pin-icon': pinned[i] === '1' ? 'icon-pushpin' : 'none',
|
||||
'badgeclass' : (has_read[i] && current_user !=0) ? '' : 'badge-important'
|
||||
'badgeclass' : (has_read[i] && current_user !=0) ? '' : 'badge-important',
|
||||
'recent_post' : recent_post[i],
|
||||
'recent_author' : recent_author[i],
|
||||
'recent_picture' : recent_picture[i]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user