From a86ddc9934a0a689444e2c21698f6a8386cce326 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Thu, 30 Jan 2014 19:46:25 -0500 Subject: [PATCH 1/2] closes #726 --- public/language/en_GB/global.json | 6 +- public/src/forum/recent.js | 36 +++++++---- public/templates/header.tpl | 7 +- public/templates/recent.tpl | 4 +- src/routes/api.js | 14 ++++ src/socket.io/topics.js | 14 +++- src/topics.js | 102 ++++++++++++++++++++---------- src/upgrade.js | 49 +++++++++++++- src/webserver.js | 2 +- 9 files changed, 179 insertions(+), 55 deletions(-) diff --git a/public/language/en_GB/global.json b/public/language/en_GB/global.json index 3cdef1742c..2796b08ed0 100644 --- a/public/language/en_GB/global.json +++ b/public/language/en_GB/global.json @@ -22,6 +22,7 @@ "header.admin": "Admin", "header.recent": "Recent", "header.unread": "Unread", + "header.popular": "Popular", "header.users": "Users", "header.chats": "Chats", "header.notifications": "Notifications", @@ -47,5 +48,8 @@ "alert.banned.message": "You are banned you will be logged out!", "alert.unfollow": "You are no longer following %1!", - "alert.follow": "You are now following %1!" + "alert.follow": "You are now following %1!", + + "posts": "Posts", + "views": "Views" } diff --git a/public/src/forum/recent.js b/public/src/forum/recent.js index 17d4602403..15e1d63ceb 100644 --- a/public/src/forum/recent.js +++ b/public/src/forum/recent.js @@ -7,27 +7,21 @@ define(function() { var active = ''; + function getActiveSection() { + var url = window.location.href, + parts = url.split('/'), + active = parts[parts.length - 1]; + return active; + } + Recent.init = function() { app.enterRoom('recent_posts'); Recent.watchForNewPosts(); - function getActiveSection() { - var url = window.location.href, - parts = url.split('/'), - active = parts[parts.length - 1]; - return active; - } - active = getActiveSection(); + active = Recent.selectActivePill(); - jQuery('.nav-pills li').removeClass('active'); - jQuery('.nav-pills li a').each(function() { - if (this.getAttribute('href').match(active)) { - jQuery(this.parentNode).addClass('active'); - return false; - } - }); $('#new-topics-alert').on('click', function() { $(this).addClass('hide'); @@ -41,6 +35,20 @@ define(function() { }); }; + Recent.selectActivePill = function() { + var active = getActiveSection(); + + jQuery('.nav-pills li').removeClass('active'); + jQuery('.nav-pills li a').each(function() { + if (this.getAttribute('href').match(active)) { + jQuery(this.parentNode).addClass('active'); + return false; + } + }); + + return active; + } + Recent.watchForNewPosts = function () { newPostCount = 0; diff --git a/public/templates/header.tpl b/public/templates/header.tpl index 1de45045aa..f7cd8f1ebc 100644 --- a/public/templates/header.tpl +++ b/public/templates/header.tpl @@ -57,11 +57,14 @@