From 3b75734672af0118828f403055ebd63c473da3cf Mon Sep 17 00:00:00 2001 From: psychobunny Date: Thu, 5 Sep 2013 23:28:15 +0800 Subject: [PATCH] footer.less, added stats cards (ala soundsz) and replaced old footer --- public/css/category.less | 1 - public/css/footer.less | 18 ++++++++++++++++++ public/css/home.less | 3 ++- public/css/nodebb.less | 3 ++- public/src/forum/footer.js | 35 ++++++++--------------------------- public/templates/footer.tpl | 33 +++++++++++++++++++++++++-------- 6 files changed, 55 insertions(+), 38 deletions(-) create mode 100644 public/css/footer.less diff --git a/public/css/category.less b/public/css/category.less index 6894a99253..6a660ff29d 100644 --- a/public/css/category.less +++ b/public/css/category.less @@ -1,4 +1,3 @@ - .category { .span9 { margin-bottom: 50px; diff --git a/public/css/footer.less b/public/css/footer.less new file mode 100644 index 0000000000..7c7da91305 --- /dev/null +++ b/public/css/footer.less @@ -0,0 +1,18 @@ +.footer-stats { + .stats-card { + text-align: center; + + h2 { + font-size: 40px; + line-height: 25px; + } + + + .pointer; + } + padding-top: 15px; +} + +.footer { + padding-bottom: 10px; +} \ No newline at end of file diff --git a/public/css/home.less b/public/css/home.less index 47b90048cb..14d80e6782 100644 --- a/public/css/home.less +++ b/public/css/home.less @@ -1,5 +1,6 @@ - .categories { + padding-top: 10px; + h4 { font-weight: 700; text-align: left; diff --git a/public/css/nodebb.less b/public/css/nodebb.less index 2977bdfe56..5320222a10 100644 --- a/public/css/nodebb.less +++ b/public/css/nodebb.less @@ -9,4 +9,5 @@ @import "search"; @import "unread"; @import "admin"; -@import "users"; \ No newline at end of file +@import "users"; +@import "footer"; \ No newline at end of file diff --git a/public/src/forum/footer.js b/public/src/forum/footer.js index 24e2d66cd2..f9fd1115cf 100644 --- a/public/src/forum/footer.js +++ b/public/src/forum/footer.js @@ -1,47 +1,28 @@ (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'), + var stats_users = document.getElementById('stats_users'), + stats_topics = document.getElementById('stats_topics'), + stats_posts = document.getElementById('stats_posts'), + stats_online = document.getElementById('stats_online'), user_label = document.getElementById('user_label'), - active_record = document.getElementById('active_record'), right_menu = document.getElementById('right-menu'); socket.emit('user.count', {}); socket.on('user.count', function(data) { - num_users.innerHTML = "We currently have " + data.count + " registered users."; + stats_users.innerHTML = data.count; }); socket.emit('post.stats'); socket.on('post.stats', function(data) { - post_stats.innerHTML = "Our users have created " + data.topics + " topics and made " + data.posts + " posts."; - }); - - socket.emit('user.latest', {}); - socket.on('user.latest', function(data) { - if (data.username == '') { - latest_user.innerHTML = ''; - } else { - latest_user.innerHTML = "The most recent user to register is " + data.username + "."; - } + stats_topics.innerHTML = data.topics; + stats_posts.innerHTML = data.posts; }); socket.emit('api:user.active.get'); socket.on('api:user.active.get', function(data) { - - var plural_users = parseInt(data.users) !== 1, - plural_anon = parseInt(data.anon) !== 1; - - active_users.innerHTML = 'There ' + (plural_users ? 'are' : 'is') + ' ' + data.users + ' user' + (plural_users ? 's' : '') + ' and ' + data.anon + ' guest' + (plural_anon ? 's' : '') + ' online'; - }); - - socket.emit('api:user.active.get_record'); - socket.on('api:user.active.get_record', function(data) { - active_record.innerHTML = "most users ever online was " + data.record + " on " + (new Date(parseInt(data.timestamp,10))).toUTCString() + ""; + stats_online.innerHTML = data.users + data.anon; }); socket.emit('api:updateHeader', { fields: ['username', 'picture', 'userslug'] }); - socket.on('api:updateHeader', function(data) { jQuery('#search-button').on('click', function() { diff --git a/public/templates/footer.tpl b/public/templates/footer.tpl index 85e9938b84..850cfded4e 100644 --- a/public/templates/footer.tpl +++ b/public/templates/footer.tpl @@ -40,17 +40,34 @@
- -