dynamically update post count in post footer on new post

v1.18.x
psychobunny 11 years ago
parent f9e2b50826
commit d7a444d9ab

@ -482,7 +482,21 @@ define(function() {
adjust_rep(-1, data.pid, data.uid);
});
socket.on('event:new_post', createNewPosts);
socket.on('event:new_post', function(data) {
var posts = data.posts;
for (var p in posts) {
if (posts.hasOwnProperty(p)) {
var post = posts[p],
postcount = jQuery('.user_postcount_' + post.uid),
ptotal = parseInt(postcount.html(), 10);
ptotal += 1;
postcount.html(ptotal);
}
}
createNewPosts(data);
});
socket.on('event:topic_deleted', function(data) {
if (data.tid === tid && data.status === 'ok') {

@ -109,7 +109,7 @@
<div class="post-info">
<span class="pull-left">
[[topic:reputation]]: <i class='fa fa-star'></i> <span class='formatted-number post_rep_{posts.uid}'>{posts.user_rep}</span>&nbsp;|&nbsp;[[topic:posts]]: <i class='fa fa-pencil'></i> <span class='formatted-number'>{posts.user_postcount}</span>
[[topic:reputation]]: <i class='fa fa-star'></i> <span class='formatted-number post_rep_{posts.uid}'>{posts.user_rep}</span>&nbsp;|&nbsp;[[topic:posts]]: <i class='fa fa-pencil'></i> <span class='formatted-number user_postcount_{posts.uid}'>{posts.user_postcount}</span>
{posts.additional_profile_info}
</span>
<span class="pull-right">

Loading…
Cancel
Save