diff --git a/app/assets/javascripts/discourse/controllers/list_categories_controller.js b/app/assets/javascripts/discourse/controllers/list_categories_controller.js
index 39d7b0c3b8d..7462757ce9b 100644
--- a/app/assets/javascripts/discourse/controllers/list_categories_controller.js
+++ b/app/assets/javascripts/discourse/controllers/list_categories_controller.js
@@ -32,7 +32,12 @@ Discourse.ListCategoriesController = Discourse.ObjectController.extend({
canEdit: function() {
var u = Discourse.User.current();
return u && u.admin;
- }.property()
+ }.property(),
+
+ // clear a pinned topic
+ clearPin: function(topic) {
+ topic.clearPin();
+ }
});
diff --git a/app/assets/javascripts/discourse/templates/featured_topics.js.handlebars b/app/assets/javascripts/discourse/templates/featured_topics.js.handlebars
index d9c81ceb368..ea70805673e 100644
--- a/app/assets/javascripts/discourse/templates/featured_topics.js.handlebars
+++ b/app/assets/javascripts/discourse/templates/featured_topics.js.handlebars
@@ -28,6 +28,19 @@
{{#if unseen}}
{{/if}}
+
+ {{#if hasExcerpt}}
+
+ {{/if}}
+
{{number posts_count}} |
diff --git a/app/serializers/category_detailed_serializer.rb b/app/serializers/category_detailed_serializer.rb
index a7a51c001ae..a11ae6b971c 100644
--- a/app/serializers/category_detailed_serializer.rb
+++ b/app/serializers/category_detailed_serializer.rb
@@ -13,7 +13,7 @@ class CategoryDetailedSerializer < ApplicationSerializer
:is_uncategorized
has_many :featured_users, serializer: BasicUserSerializer
- has_many :displayable_topics, serializer: CategoryTopicSerializer, embed: :objects, key: :topics
+ has_many :displayable_topics, serializer: ListableTopicSerializer, embed: :objects, key: :topics
def topics_week
object.topics_week || 0
diff --git a/app/serializers/category_topic_serializer.rb b/app/serializers/category_topic_serializer.rb
deleted file mode 100644
index 7bd91d8b33d..00000000000
--- a/app/serializers/category_topic_serializer.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-require_dependency 'pinned_check'
-
-class CategoryTopicSerializer < ListableTopicSerializer
-
- attributes :visible, :closed, :archived, :pinned
-
- def pinned
- PinnedCheck.new(object, object.user_data).pinned?
- end
-
-end
diff --git a/app/serializers/listable_topic_serializer.rb b/app/serializers/listable_topic_serializer.rb
index f53a7ef1362..8b66469201d 100644
--- a/app/serializers/listable_topic_serializer.rb
+++ b/app/serializers/listable_topic_serializer.rb
@@ -1,4 +1,5 @@
require_dependency 'age_words'
+require_dependency 'pinned_check'
class ListableTopicSerializer < BasicTopicSerializer
@@ -15,7 +16,12 @@ class ListableTopicSerializer < BasicTopicSerializer
:last_read_post_number,
:unread,
:new_posts,
- :title
+ :title,
+ :pinned,
+ :excerpt,
+ :visible,
+ :closed,
+ :archived
def age
AgeWords.age_words(Time.now - (object.created_at || Time.now))
@@ -58,10 +64,23 @@ class ListableTopicSerializer < BasicTopicSerializer
end
alias :include_new_posts? :seen
+ def include_excerpt?
+ pinned
+ end
+
+ def excerpt
+ object.posts.by_post_number.first.try(:excerpt, 220, strip_links: true) || nil
+ end
+
+ def pinned
+ PinnedCheck.new(object, object.user_data).pinned?
+ end
+
protected
def unread_helper
@unread_helper ||= Unread.new(object, object.user_data)
end
+
end
diff --git a/app/serializers/topic_list_item_serializer.rb b/app/serializers/topic_list_item_serializer.rb
index 7a994d9cdf6..38c9bdd70c7 100644
--- a/app/serializers/topic_list_item_serializer.rb
+++ b/app/serializers/topic_list_item_serializer.rb
@@ -1,18 +1,11 @@
-require_dependency 'pinned_check'
-
class TopicListItemSerializer < ListableTopicSerializer
attributes :views,
:like_count,
- :visible,
- :pinned,
- :closed,
- :archived,
:starred,
:has_best_of,
:archetype,
- :rank_details,
- :excerpt
+ :rank_details
has_one :category, serializer: BasicCategorySerializer
has_many :posters, serializer: TopicPosterSerializer, embed: :objects
@@ -51,16 +44,4 @@ class TopicListItemSerializer < ListableTopicSerializer
object.posters || []
end
- def pinned
- PinnedCheck.new(object, object.user_data).pinned?
- end
-
- def include_excerpt?
- pinned
- end
-
- def excerpt
- object.posts.by_post_number.first.try(:excerpt, 220, strip_links: true) || nil
- end
-
end