FEATURE: only expand globally pinned topics on front page

This commit is contained in:
Sam 2015-01-06 07:43:05 +11:00
parent c7d86f89e4
commit d036d461dc
6 changed files with 26 additions and 2 deletions

View file

@ -82,6 +82,7 @@ export default function(filter, params) {
noSubcategories: params && !!params.no_subcategories,
order: topics.get('params.order'),
ascending: topics.get('params.ascending'),
expandAllPinned: true
});
this.controllerFor('search').set('searchContext', model.get('searchContext'));

View file

@ -53,6 +53,7 @@ export default function(filter, extras) {
category: null,
period: periods.findBy('id', periodId),
selected: [],
expandGloballyPinned: true
};
var params = model.get('params');

View file

@ -47,6 +47,8 @@
ascending=ascending
bulkSelectEnabled=bulkSelectEnabled
selected=selected
expandGloballyPinned=expandGloballyPinned
expandAllPinned=expandAllPinned
topics=topics}}
{{/if}}
</div>

View file

@ -10,7 +10,9 @@
{{raw "topic-post-badges" unread=topic.unread newPosts=topic.displayNewPosts unseen=topic.unseen url=topic.lastUnreadUrl}}
{{/if}}
{{#if expandPinned}}
{{raw "list/topic-excerpt" topic=topic}}
{{/if}}
</td>
{{#unless controller.hideCategory}}

View file

@ -22,6 +22,23 @@ export default Discourse.View.extend(StringBuffer, {
return this.get('topic.op_like_count') > 0;
},
expandPinned: function(){
var pinned = this.get('topic.pinned');
if(!pinned){
return false;
}
if(this.get('controller.expandGloballyPinned') && this.get('topic.pinned_globally')){
return true;
}
if(this.get('controller.expandAllPinned')){
return true;
}
return false;
}.property(),
click: function(e){
var target = $(e.target);

View file

@ -7,7 +7,8 @@ class TopicListItemSerializer < ListableTopicSerializer
:archetype,
:last_poster_username,
:category_id,
:op_like_count
:op_like_count,
:pinned_globally
has_many :posters, serializer: TopicPosterSerializer, embed: :objects
has_many :participants, serializer: TopicPosterSerializer, embed: :objects