mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Show topic and post counts by day/week/month/year on categories page
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
class CategoryDetailedSerializer < BasicCategorySerializer
|
||||
|
||||
attributes :post_count,
|
||||
attributes :topic_count,
|
||||
:post_count,
|
||||
:topics_day,
|
||||
:topics_week,
|
||||
:topics_month,
|
||||
:topics_year,
|
||||
:posts_day,
|
||||
:posts_week,
|
||||
:posts_month,
|
||||
:posts_year,
|
||||
:description_excerpt,
|
||||
:is_uncategorized,
|
||||
:subcategory_ids
|
||||
@@ -11,6 +17,7 @@ class CategoryDetailedSerializer < BasicCategorySerializer
|
||||
has_many :featured_users, serializer: BasicUserSerializer
|
||||
has_many :displayable_topics, serializer: ListableTopicSerializer, embed: :objects, key: :topics
|
||||
|
||||
|
||||
def topics_week
|
||||
object.topics_week || 0
|
||||
end
|
||||
@@ -23,6 +30,18 @@ class CategoryDetailedSerializer < BasicCategorySerializer
|
||||
object.topics_year || 0
|
||||
end
|
||||
|
||||
def posts_week
|
||||
object.posts_week || 0
|
||||
end
|
||||
|
||||
def posts_month
|
||||
object.posts_month || 0
|
||||
end
|
||||
|
||||
def posts_year
|
||||
object.posts_year || 0
|
||||
end
|
||||
|
||||
def is_uncategorized
|
||||
object.id == SiteSetting.uncategorized_category_id
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user