From c05f56d28c0c939eeaa21cd045d5ed17ef614310 Mon Sep 17 00:00:00 2001 From: Baris Usakli Date: Mon, 19 Aug 2013 14:28:51 -0400 Subject: [PATCH] fix for category view when its empty --- public/src/forum/topic.js | 10 ++++++++-- public/templates/category.tpl | 12 ++++++------ public/templates/topic.tpl | 2 +- src/posts.js | 3 ++- src/topics.js | 1 + 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index f1451b5912..85e6a24734 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -389,14 +389,20 @@ socket.on('api:posts.favourite', function(data) { if (data.status === 'ok' && data.pid) { var favEl = document.querySelector('.post_rep_' + data.pid).nextSibling; - if (favEl) favEl.className = 'icon-star'; + if (favEl) { + favEl.className = 'icon-star'; + $(favEl).parent().addClass('btn-warning'); + } } }); socket.on('api:posts.unfavourite', function(data) { if (data.status === 'ok' && data.pid) { var favEl = document.querySelector('.post_rep_' + data.pid).nextSibling; - if (favEl) favEl.className = 'icon-star-empty'; + if (favEl) { + favEl.className = 'icon-star-empty'; + $(favEl).parent().removeClass('btn-warning'); + } } }); diff --git a/public/templates/category.tpl b/public/templates/category.tpl index d49af806b8..bbaae0322d 100644 --- a/public/templates/category.tpl +++ b/public/templates/category.tpl @@ -10,13 +10,8 @@
-
- There are no topics in this category.
- Why don't you try posting one? -
-
@@ -27,7 +22,12 @@
-
+
+ +
+ There are no topics in this category.
+ Why don't you try posting one? +
diff --git a/public/templates/topic.tpl b/public/templates/topic.tpl index 4068c4c29b..aed8274cc9 100644 --- a/public/templates/topic.tpl +++ b/public/templates/topic.tpl @@ -42,7 +42,7 @@
- diff --git a/src/posts.js b/src/posts.js index c6033071fb..0943fad986 100644 --- a/src/posts.js +++ b/src/posts.js @@ -226,7 +226,8 @@ var RDB = require('./redis.js'), postData.content = postTools.markdownToHTML(postData.content); postData.post_rep = 0; - postData.relativeTime = utils.relativeTime(postData.timestamp) + postData.relativeTime = utils.relativeTime(postData.timestamp); + postData.fav_button_class = ''; postData.fav_star_class = 'icon-star-empty'; postData['edited-class'] = 'none'; postData.show_banned = 'hide'; diff --git a/src/topics.js b/src/topics.js index 29c435bde3..8ab3604734 100644 --- a/src/topics.js +++ b/src/topics.js @@ -79,6 +79,7 @@ marked.setOptions({ privileges = results[2]; for(var i=0; i