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'); classes.push('has-excerpt');
} }
_.each(['liked', 'archived', 'bookmarked'],function(name) {
['liked', 'archived', 'bookmarked', 'pinned'].forEach(name => {
if (topic.get(name)) { if (topic.get(name)) {
classes.push(name); classes.push(name);
} }

View File

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

View File

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

View File

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

View File

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