mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 22:15:48 +01:00
dynamically update post count in post footer on new post
This commit is contained in:
@@ -482,7 +482,21 @@ define(function() {
|
|||||||
adjust_rep(-1, data.pid, data.uid);
|
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) {
|
socket.on('event:topic_deleted', function(data) {
|
||||||
if (data.tid === tid && data.status === 'ok') {
|
if (data.tid === tid && data.status === 'ok') {
|
||||||
|
|||||||
@@ -109,7 +109,7 @@
|
|||||||
|
|
||||||
<div class="post-info">
|
<div class="post-info">
|
||||||
<span class="pull-left">
|
<span class="pull-left">
|
||||||
[[topic:reputation]]: <i class='fa fa-star'></i> <span class='formatted-number post_rep_{posts.uid}'>{posts.user_rep}</span> | [[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> | [[topic:posts]]: <i class='fa fa-pencil'></i> <span class='formatted-number user_postcount_{posts.uid}'>{posts.user_postcount}</span>
|
||||||
{posts.additional_profile_info}
|
{posts.additional_profile_info}
|
||||||
</span>
|
</span>
|
||||||
<span class="pull-right">
|
<span class="pull-right">
|
||||||
|
|||||||
Reference in New Issue
Block a user