From aecffecdf12b5fe65e06ee8337d3d68185c3c132 Mon Sep 17 00:00:00 2001 From: Baris Usakli Date: Fri, 28 Jun 2013 10:56:38 -0400 Subject: [PATCH 1/7] footer shows total topic post count --- public/src/forum/footer.js | 8 ++++++++ public/templates/footer.tpl | 2 +- src/posts.js | 19 +++++++++++++++++++ src/topics.js | 4 ++++ src/websockets.js | 4 ++++ 5 files changed, 36 insertions(+), 1 deletion(-) diff --git a/public/src/forum/footer.js b/public/src/forum/footer.js index fea53cec99..57a901689b 100644 --- a/public/src/forum/footer.js +++ b/public/src/forum/footer.js @@ -1,5 +1,6 @@ (function() { var num_users = document.getElementById('number_of_users'), + post_stats = document.getElementById('post_stats'), latest_user = document.getElementById('latest_user'), active_users = document.getElementById('active_users'), user_label = document.getElementById('user_label'), @@ -10,6 +11,12 @@ socket.on('user.count', function(data) { num_users.innerHTML = "We currently have " + data.count + " registered users."; }); + + socket.emit('post.stats'); + socket.on('post.stats', function(data) { + post_stats.innerHTML = "Our uses have created " + data.topics + " topics and made " + data.posts + " posts."; + }); + socket.emit('user.latest', {}); socket.on('user.latest', function(data) { if (data.username == '') { @@ -18,6 +25,7 @@ latest_user.innerHTML = "The most recent user to register is " + data.username + "."; } }); + socket.emit('api:user.active.get'); socket.on('api:user.active.get', function(data) { var plural_users = parseInt(data.users) !== 1, diff --git a/public/templates/footer.tpl b/public/templates/footer.tpl index e3c3cf2db9..22c79c588b 100644 --- a/public/templates/footer.tpl +++ b/public/templates/footer.tpl @@ -9,7 +9,7 @@