Skip to content

Node.js based forum software built for the modern web

footer.less, added stats cards (ala soundsz) and replaced old footer

psychobunny3b75734672af
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 <b>" + data.count + "</b> registered users.";
+ stats_users.innerHTML = data.count;
});
socket.emit('post.stats');
socket.on('post.stats', function(data) {
- post_stats.innerHTML = "Our users have created <b>" + data.topics + "</b> topics and made <b>" + data.posts + "</b> 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 <b><a href='/users/"+data.userslug+"'>" + data.username + "</a></b>.";
- }
+ 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') + ' <strong>' + data.users + '</strong> user' + (plural_users ? 's' : '') + ' and <strong>' + data.anon + '</strong> 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 <strong>" + data.record + "</strong> on <strong>" + (new Date(parseInt(data.timestamp,10))).toUTCString() + "</strong>";
+ 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 @@
<div id="alert_window"></div>
- <!-- START Forum Info -->
- <div id="footer" class="container" style="padding-top: 50px; display: none">
- <div class="alert alert-info">
- <span id="active_users"></span>; <span id="active_record"></span><br />
- <span id="number_of_users"></span> <span id="post_stats"></span><br />
- <span id="latest_user"></span>
+
+ <div class="container footer-stats">
+ <div class="row">
+ <div class="col-md-3 col-xs-6">
+ <div class="stats-card well">
+ <h2><span id="stats_online"></span><br /><small>Online</small></h2>
+ </div>
+ </div>
+ <div class="col-md-3 col-xs-6">
+ <div class="stats-card well">
+ <h2><span id="stats_users"></span><br /><small>Users</small></h2>
+ </div>
+ </div>
+ <div class="col-md-3 col-xs-6">
+ <div class="stats-card well">
+ <h2><span id="stats_topics"></span><br /><small>Topics</small></h2>
+ </div>
+ </div>
+ <div class="col-md-3 col-xs-6">
+ <div class="stats-card well">
+ <h2><span id="stats_posts"></span><br /><small>Posts</small></h2>
+ </div>
+ </div>
</div>
- <footer class="footer">Copyright &copy; 2013 <a target="_blank" href="http://www.nodebb.org">NodeBB</a> by <a target="_blank" href="https://github.com/psychobunny">psychobunny</a>, <a href="https://github.com/julianlam" target="_blank">julianlam</a>, <a href="https://github.com/barisusakli" target="_blank">barisusakli</a> from <a target="_blank" href="http://www.designcreateplay.com">designcreateplay</a></footer>
</div>
- <!-- END Forum Info -->
+ <footer class="footer">Copyright &copy; 2013 <a target="_blank" href="http://www.nodebb.org">NodeBB</a> by <a target="_blank" href="https://github.com/psychobunny">psychobunny</a>, <a href="https://github.com/julianlam" target="_blank">julianlam</a>, <a href="https://github.com/barisusakli" target="_blank">barisusakli</a> from <a target="_blank" href="http://www.designcreateplay.com">designcreateplay</a></footer>
+
<script>
$.getScript(RELATIVE_PATH + '/src/forum/footer.js');
</script>