Move topic list extensibility to `topic-list` component

This commit is contained in:
Robin Ward 2017-10-12 12:02:53 -04:00
parent eb85922083
commit 4d8619f62c
5 changed files with 20 additions and 12 deletions

View File

@ -52,7 +52,8 @@ export default Ember.Component.extend(bufferedRender({
classes.push('has-excerpt');
}
_.each(['liked', 'archived', 'bookmarked'],function(name) {
['liked', 'archived', 'bookmarked', 'pinned'].forEach(name => {
if (topic.get(name)) {
classes.push(name);
}

View File

@ -5,6 +5,9 @@ export default Ember.Component.extend({
classNames: ['topic-list'],
showTopicPostBadges: true,
// Overwrite this to perform client side filtering of topics, if desired
filteredTopics: Ember.computed.alias('topics'),
_init: function(){
this.addObserver('hideCategory', this.rerender);
this.addObserver('order', this.rerender);

View File

@ -25,9 +25,6 @@ const controllerOpts = {
this.setProperties({ order: "default", ascending: false });
},
// Overwrite this to perform client side filtering of topics, if desired
filteredTopics: Ember.computed.alias('model.topics'),
actions: {
changeSort(sortBy) {

View File

@ -14,8 +14,20 @@
bulkSelectEnabled=bulkSelectEnabled}}
</thead>
{{/unless}}
{{plugin-outlet
name="before-topic-list-body"
args=(hash
topics=topics
selected=selected
bulkSelectEnabled=bulkSelectEnabled
lastVisitedTopic=lastVisitedTopic
discoveryList=discoveryList)
tagName=""
connectorTagName=""}}
<tbody>
{{#each topics as |topic|}}
{{#each filteredTopics as |topic|}}
{{topic-list-item topic=topic
bulkSelectEnabled=bulkSelectEnabled
showTopicPostBadges=showTopicPostBadges

View File

@ -32,12 +32,6 @@
{{/if}}
{{#if hasTopics}}
{{plugin-outlet
name="discovery-before-topic-list"
tagName=""
args=(hash model=model category=category)}}
{{topic-list
highlightLastVisited=true
top=top
@ -54,7 +48,8 @@
expandGloballyPinned=expandGloballyPinned
expandAllPinned=expandAllPinned
category=category
topics=filteredTopics}}
topics=model.topics
discoveryList=true}}
{{/if}}
{{/discovery-topics-list}}