mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
FEATURE: only expand globally pinned topics on front page
This commit is contained in:
parent
c7d86f89e4
commit
d036d461dc
6 changed files with 26 additions and 2 deletions
|
@ -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'));
|
||||
|
|
|
@ -53,6 +53,7 @@ export default function(filter, extras) {
|
|||
category: null,
|
||||
period: periods.findBy('id', periodId),
|
||||
selected: [],
|
||||
expandGloballyPinned: true
|
||||
};
|
||||
|
||||
var params = model.get('params');
|
||||
|
|
|
@ -47,6 +47,8 @@
|
|||
ascending=ascending
|
||||
bulkSelectEnabled=bulkSelectEnabled
|
||||
selected=selected
|
||||
expandGloballyPinned=expandGloballyPinned
|
||||
expandAllPinned=expandAllPinned
|
||||
topics=topics}}
|
||||
{{/if}}
|
||||
</div>
|
||||
|
|
|
@ -10,7 +10,9 @@
|
|||
{{raw "topic-post-badges" unread=topic.unread newPosts=topic.displayNewPosts unseen=topic.unseen url=topic.lastUnreadUrl}}
|
||||
{{/if}}
|
||||
|
||||
{{raw "list/topic-excerpt" topic=topic}}
|
||||
{{#if expandPinned}}
|
||||
{{raw "list/topic-excerpt" topic=topic}}
|
||||
{{/if}}
|
||||
</td>
|
||||
|
||||
{{#unless controller.hideCategory}}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue