mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 11:05:54 +01:00 
			
		
		
		
	started to add real data to the topics listing, got latest post working per topic
This commit is contained in:
		| @@ -170,68 +170,63 @@ footer.footer { | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	@media (max-width: 767px)  |  | ||||||
| 	{ |  | ||||||
|  |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .category { |  | ||||||
| 	ul { | 	ul { | ||||||
| 		margin-left: 0; | 		margin-left: 0; | ||||||
| 	} | 	} | ||||||
| } |  | ||||||
| .topic-row { |  | ||||||
| 	border-radius: 5px; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .latest-post { |  | ||||||
| 	float: right; |  | ||||||
| 	padding-top: 2px; |  | ||||||
| 	margin-right: 30px; |  | ||||||
| 	width: 50%; |  | ||||||
|  |  | ||||||
| 	.pull-right { | 	.topic-row { | ||||||
|  | 		border-radius: 5px; | ||||||
| 		width: 100%; | 		width: 100%; | ||||||
| 		height: 50px; |  | ||||||
| 		line-height: 16px; |  | ||||||
| 		margin-left: 1px; |  | ||||||
| 		padding: 5px; |  | ||||||
| 		border-left: 1px solid #bbb; |  | ||||||
| 		padding-left: 20px; | 		padding-left: 20px; | ||||||
|  |  | ||||||
| 		img { | 		h3 { | ||||||
| 			display: block; | 			padding: 0; | ||||||
| 			float: left; | 			margin: 0; | ||||||
|  | 			margin-top: 4px; | ||||||
|  | 			line-height: 30px; | ||||||
|  | 			color: rgb(0, 136, 204); | ||||||
|  |  | ||||||
|  | 			small { | ||||||
|  | 				vertical-align: 2px; | ||||||
|  | 				strong { | ||||||
|  | 					color: #666; | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 		p { | 	} | ||||||
| 			display: block; |  | ||||||
| 			float: left; | 	.latest-post { | ||||||
| 			width: 70%; | 		float: right; | ||||||
| 			margin-left: 10px; | 		padding-top: 2px; | ||||||
| 			overflow: hidden; | 		margin-right: 30px; | ||||||
|  | 		width: 50%; | ||||||
|  |  | ||||||
|  | 		.pull-right { | ||||||
|  | 			width: 100%; | ||||||
| 			height: 50px; | 			height: 50px; | ||||||
|  | 			line-height: 16px; | ||||||
|  | 			margin-left: 1px; | ||||||
|  | 			padding: 5px; | ||||||
|  | 			border-left: 1px solid #bbb; | ||||||
|  | 			padding-left: 20px; | ||||||
|  |  | ||||||
|  | 			img { | ||||||
|  | 				display: block; | ||||||
|  | 				float: left; | ||||||
|  | 			} | ||||||
|  | 			p { | ||||||
|  | 				display: block; | ||||||
|  | 				float: left; | ||||||
|  | 				width: 70%; | ||||||
|  | 				margin-left: 10px; | ||||||
|  | 				overflow: hidden; | ||||||
|  | 				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 { | .post-container { | ||||||
|   | |||||||
| @@ -13,15 +13,17 @@ | |||||||
| 		<a href="../../topic/{topics.slug}"><li> | 		<a href="../../topic/{topics.slug}"><li> | ||||||
| 			<div class="row-fluid"> | 			<div class="row-fluid"> | ||||||
| 				<div class="span12 topic-row img-polaroid"> | 				<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"> | 						<div class="pull-right"> | ||||||
| 							<img class="hidden-tablet" src="http://www.gravatar.com/avatar/fd37ce111f863c6665045c2d72d199bf?s=50" /> | 							<img src="{topics.recent_picture}?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> | 							<p><strong>{topics.recent_author}</strong>: {topics.recent_post}</p> | ||||||
| 						</div> | 						</div> | ||||||
| 					</div> | 					</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  | 						<h3><span class="badge {topics.badgeclass}">{topics.post_count}</span> {topics.title} <small>24<i class="icon-star"></i><br /> | ||||||
| 							<span class="username">{topics.username}</span>.</small></h3>  | 							<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> | 				</div> | ||||||
| 			</div> | 			</div> | ||||||
|   | |||||||
| @@ -212,6 +212,14 @@ marked.setOptions({ | |||||||
| 					RDB.set('pid:' + pid + ':tid', tid); | 					RDB.set('pid:' + pid + ':tid', tid); | ||||||
| 					 | 					 | ||||||
| 					RDB.incr('tid:' + tid + ':postcount'); | 					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 | 					// User Details - move this out later | ||||||
| 					RDB.lpush('uid:' + uid + ':posts', pid); | 					RDB.lpush('uid:' + uid + ':posts', pid); | ||||||
|   | |||||||
| @@ -27,7 +27,10 @@ var	RDB = require('./redis.js'), | |||||||
| 				postcount = [], | 				postcount = [], | ||||||
| 				locked = [], | 				locked = [], | ||||||
| 				deleted = [], | 				deleted = [], | ||||||
| 				pinned = []; | 				pinned = [], | ||||||
|  | 				recent_post = [], | ||||||
|  | 				recent_author = [], | ||||||
|  | 				recent_picture = []; | ||||||
|  |  | ||||||
| 			for (var i=0, ii=tids.length; i<ii; i++) { | 			for (var i=0, ii=tids.length; i<ii; i++) { | ||||||
| 				title.push('tid:' + tids[i] + ':title'); | 				title.push('tid:' + tids[i] + ':title'); | ||||||
| @@ -38,6 +41,9 @@ var	RDB = require('./redis.js'), | |||||||
| 				locked.push('tid:' + tids[i] + ':locked'); | 				locked.push('tid:' + tids[i] + ':locked'); | ||||||
| 				deleted.push('tid:' + tids[i] + ':deleted'); | 				deleted.push('tid:' + tids[i] + ':deleted'); | ||||||
| 				pinned.push('tid:' + tids[i] + ':pinned'); | 				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() | 			var multi = RDB.multi() | ||||||
| @@ -53,6 +59,9 @@ var	RDB = require('./redis.js'), | |||||||
| 					.mget(locked) | 					.mget(locked) | ||||||
| 					.mget(deleted) | 					.mget(deleted) | ||||||
| 					.mget(pinned) | 					.mget(pinned) | ||||||
|  | 					.mget(recent_post) | ||||||
|  | 					.mget(recent_author) | ||||||
|  | 					.mget(recent_picture) | ||||||
| 			} | 			} | ||||||
| 				 | 				 | ||||||
| 			 | 			 | ||||||
| @@ -69,6 +78,9 @@ var	RDB = require('./redis.js'), | |||||||
| 					locked = replies[6]; | 					locked = replies[6]; | ||||||
| 					deleted = replies[7]; | 					deleted = replies[7]; | ||||||
| 					pinned = replies[8]; | 					pinned = replies[8]; | ||||||
|  | 					recent_post = replies[9]; | ||||||
|  | 					recent_author = replies[10]; | ||||||
|  | 					recent_picture = replies[11]; | ||||||
|  |  | ||||||
| 					var usernames, | 					var usernames, | ||||||
| 						has_read; | 						has_read; | ||||||
| @@ -76,6 +88,7 @@ var	RDB = require('./redis.js'), | |||||||
| 					function generate_topic() { | 					function generate_topic() { | ||||||
| 						if (!usernames || !has_read) return; | 						if (!usernames || !has_read) return; | ||||||
|  |  | ||||||
|  |  | ||||||
| 						for (var i=0, ii=title.length; i<ii; i++) {			 | 						for (var i=0, ii=title.length; i<ii; i++) {			 | ||||||
| 							topics.push({ | 							topics.push({ | ||||||
| 								'title' : title[i], | 								'title' : title[i], | ||||||
| @@ -89,7 +102,10 @@ var	RDB = require('./redis.js'), | |||||||
| 								'deleted': deleted[i], | 								'deleted': deleted[i], | ||||||
| 								'pinned': parseInt(pinned[i] || 0),	// For sorting purposes | 								'pinned': parseInt(pinned[i] || 0),	// For sorting purposes | ||||||
| 								'pin-icon': pinned[i] === '1' ? 'icon-pushpin' : 'none', | 								'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