Deprecation: Remove `{{each itemView=}}`

This commit is contained in:
Robin Ward 2016-05-03 16:13:31 -04:00
parent 9ea32bf7d8
commit 4e5831c43f
No known key found for this signature in database
GPG Key ID: 0E091E2B4ED1B83D
3 changed files with 27 additions and 27 deletions

View File

@ -1,22 +1,14 @@
import StringBuffer from 'discourse/mixins/string-buffer'; import StringBuffer from 'discourse/mixins/string-buffer';
export default Ember.View.extend(StringBuffer, { export default Ember.Component.extend(StringBuffer, {
topic: Em.computed.alias("content"), rerenderTriggers: ['bulkSelectEnabled', 'topic.pinned'],
rerenderTriggers: ['controller.bulkSelectEnabled', 'topic.pinned'],
tagName: 'tr', tagName: 'tr',
rawTemplate: 'list/topic-list-item.raw', rawTemplate: 'list/topic-list-item.raw',
classNameBindings: ['controller.checked', classNameBindings: [':topic-list-item', 'unboundClassNames'],
':topic-list-item',
'unboundClassNames',
'selected'],
attributeBindings: ['data-topic-id'], attributeBindings: ['data-topic-id'],
'data-topic-id': Em.computed.alias('topic.id'), 'data-topic-id': Em.computed.alias('topic.id'),
actions: { actions: {
select() {
this.set('controller.selectedRow', this);
},
toggleBookmark() { toggleBookmark() {
const self = this; const self = this;
this.get('topic').toggleBookmark().finally(function() { this.get('topic').toggleBookmark().finally(function() {
@ -25,10 +17,6 @@ export default Ember.View.extend(StringBuffer, {
} }
}, },
selected: function() {
return this.get('controller.selectedRow')===this;
}.property('controller.selectedRow'),
unboundClassNames: function() { unboundClassNames: function() {
let classes = []; let classes = [];
const topic = this.get('topic'); const topic = this.get('topic');
@ -51,7 +39,7 @@ export default Ember.View.extend(StringBuffer, {
}.property(), }.property(),
titleColSpan: function() { titleColSpan: function() {
return (!this.get('controller.hideCategory') && return (!this.get('hideCategory') &&
this.get('topic.isPinnedUncategorized') ? 2 : 1); this.get('topic.isPinnedUncategorized') ? 2 : 1);
}.property("topic.isPinnedUncategorized"), }.property("topic.isPinnedUncategorized"),
@ -70,11 +58,11 @@ export default Ember.View.extend(StringBuffer, {
return false; return false;
} }
if (this.get('controller.expandGloballyPinned') && this.get('topic.pinned_globally')) { if (this.get('expandGloballyPinned') && this.get('topic.pinned_globally')) {
return true; return true;
} }
if (this.get('controller.expandAllPinned')) { if (this.get('expandAllPinned')) {
return true; return true;
} }
@ -96,7 +84,7 @@ export default Ember.View.extend(StringBuffer, {
} }
if (target.hasClass('bulk-select')) { if (target.hasClass('bulk-select')) {
const selected = this.get('controller.selected'); const selected = this.get('selected');
const topic = this.get('topic'); const topic = this.get('topic');
if (target.is(':checked')) { if (target.is(':checked')) {

View File

@ -15,5 +15,17 @@
</thead> </thead>
{{/unless}} {{/unless}}
<tbody> <tbody>
{{each topic in topics itemView="topic-list-item"}} {{#each topics as |topic|}}
{{topic-list-item topic=topic
bulkSelectEnabled=bulkSelectEnabled
showTopicPostBadges=showTopicPostBadges
hideCategory=hideCategory
showPosters=showPosters
showParticipants=showParticipants
showLikes=showLikes
showOpLikes=showOpLikes
expandGloballyPinned=expandGloballyPinned
expandAllPinned=expandAllPinned
selected=selected}}
{{/each}}
</tbody> </tbody>

View File

@ -1,4 +1,4 @@
{{#if controller.bulkSelectEnabled}} {{#if bulkSelectEnabled}}
<td class='star'> <td class='star'>
<input type="checkbox" class="bulk-select"> <input type="checkbox" class="bulk-select">
</td> </td>
@ -8,7 +8,7 @@
{{raw "topic-status" topic=topic}} {{raw "topic-status" topic=topic}}
{{topic-link topic}} {{topic-link topic}}
{{plugin-outlet "topic-list-after-title"}} {{plugin-outlet "topic-list-after-title"}}
{{#if controller.showTopicPostBadges}} {{#if showTopicPostBadges}}
{{raw "topic-post-badges" unread=topic.unread newPosts=topic.displayNewPosts unseen=topic.unseen url=topic.lastUnreadUrl}} {{raw "topic-post-badges" unread=topic.unread newPosts=topic.displayNewPosts unseen=topic.unseen url=topic.lastUnreadUrl}}
{{/if}} {{/if}}
{{#if topic.tags}} {{#if topic.tags}}
@ -25,23 +25,23 @@
{{raw "list/action-list" topic=topic postNumbers=topic.liked_post_numbers className="likes" icon="heart"}} {{raw "list/action-list" topic=topic postNumbers=topic.liked_post_numbers className="likes" icon="heart"}}
</td> </td>
{{#unless controller.hideCategory}} {{#unless hideCategory}}
{{#unless topic.isPinnedUncategorized}} {{#unless topic.isPinnedUncategorized}}
{{raw "list/category-column" category=topic.category}} {{raw "list/category-column" category=topic.category}}
{{/unless}} {{/unless}}
{{/unless}} {{/unless}}
{{#if controller.showPosters}} {{#if showPosters}}
{{raw "list/posters-column" posters=topic.posters}} {{raw "list/posters-column" posters=topic.posters}}
{{/if}} {{/if}}
{{raw "list/posts-count-column" topic=topic}} {{raw "list/posts-count-column" topic=topic}}
{{#if controller.showParticipants}} {{#if showParticipants}}
{{raw "list/posters-column" posters=topic.participants}} {{raw "list/posters-column" posters=topic.participants}}
{{/if}} {{/if}}
{{#if controller.showLikes}} {{#if showLikes}}
<td class="num likes"> <td class="num likes">
{{#if hasLikes}} {{#if hasLikes}}
<a href='{{topic.summaryUrl}}'> <a href='{{topic.summaryUrl}}'>
@ -50,7 +50,7 @@
{{/if}} {{/if}}
{{/if}} {{/if}}
{{#if controller.showOpLikes}} {{#if showOpLikes}}
<td class="num likes"> <td class="num likes">
{{#if hasOpLikes}} {{#if hasOpLikes}}
<a href='{{topic.summaryUrl}}'> <a href='{{topic.summaryUrl}}'>