diff --git a/app/assets/stylesheets/desktop/topic-list.scss b/app/assets/stylesheets/desktop/topic-list.scss index 57d8c832d6c..e9abe83cf9b 100644 --- a/app/assets/stylesheets/desktop/topic-list.scss +++ b/app/assets/stylesheets/desktop/topic-list.scss @@ -197,15 +197,42 @@ } } - -#topic-list tbody tr.has-excerpt .star - { - - +#topic-list tbody tr.has-excerpt .star { vertical-align: top; margin-top: 3px; } +#topic-list.categories { + th.latest, td.latest { + padding-left: 12px; + } + th.num { + width: 45px; + } + .last-user-info { + font-size: 12px; + margin-top: 3px; + } + tbody td { + padding-bottom: 20px; + } + .category{ + position: relative; + width: 55%; + .featured-users { + position: absolute; + right: 18px; + top: 3px; + } + .category-description { + margin-top: 10px; + } + .badge-category { + padding: 6px 10px; + font-size: 14px; + } + } +} diff --git a/app/models/category.rb b/app/models/category.rb index 5cf290eac2c..9b39dd6598e 100644 --- a/app/models/category.rb +++ b/app/models/category.rb @@ -114,8 +114,9 @@ class Category < ActiveRecord::Base .visible topics_with_post_count = Topic - .select("topics.category_id, topics.id topic_id, COUNT(*) topic_count, SUM(topics.posts_count) post_count") - .group("topics.category_id, topics.id") + .select("topics.category_id, COUNT(*) topic_count, SUM(topics.posts_count) post_count") + .where("topics.id NOT IN (select cc.topic_id from categories cc)") + .group("topics.category_id") .visible.to_sql topics_year = topics.created_since(1.year.ago).to_sql @@ -129,8 +130,7 @@ class Category < ActiveRecord::Base post_count = x.post_count FROM (#{topics_with_post_count}) x WHERE x.category_id = c.id AND - (c.topic_count <> x.topic_count OR c.post_count <> x.post_count) AND - x.topic_id <> c.topic_id + (c.topic_count <> x.topic_count OR c.post_count <> x.post_count) SQL