diff --git a/public/src/forum/recent.js b/public/src/forum/recent.js index 5fed07107e..a29b183631 100644 --- a/public/src/forum/recent.js +++ b/public/src/forum/recent.js @@ -5,6 +5,8 @@ define(function() { Recent.newPostCount = 0; Recent.loadingMoreTopics = false; + var active = ''; + Recent.init = function() { app.enter_room('recent_posts'); @@ -13,6 +15,24 @@ define(function() { 'event:new_post' ]); + + function getActiveSection() { + var url = window.location.href, + parts = url.split('/'), + active = parts[parts.length - 1]; + return active; + } + + 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; + } + }); + $('#new-topics-alert').on('click', function() { $(this).hide(); }); @@ -75,7 +95,8 @@ define(function() { Recent.loadMoreTopics = function() { Recent.loadingMoreTopics = true; socket.emit('api:topics.loadMoreRecentTopics', { - after: $('#topics-container').children().length + after: $('#topics-container').children().length, + term: active }, function(data) { if (data.topics && data.topics.length) { Recent.onTopicsLoaded(data.topics); diff --git a/public/templates/config.json b/public/templates/config.json index f41ecdaf19..7e0be8d93d 100644 --- a/public/templates/config.json +++ b/public/templates/config.json @@ -26,6 +26,8 @@ "^user.*favourites": "favourites", "^user/.*": "account", + "^recent/.*": "recent", + "reset/.*": "reset_code" }, "force_refresh": { diff --git a/public/templates/recent.tpl b/public/templates/recent.tpl index 8cf6127874..25f6cd1c34 100644 --- a/public/templates/recent.tpl +++ b/public/templates/recent.tpl @@ -4,6 +4,15 @@
+ + +