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

View File

@ -15,5 +15,17 @@
</thead>
{{/unless}}
<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>

View File

@ -1,4 +1,4 @@
{{#if controller.bulkSelectEnabled}}
{{#if bulkSelectEnabled}}
<td class='star'>
<input type="checkbox" class="bulk-select">
</td>
@ -8,7 +8,7 @@
{{raw "topic-status" topic=topic}}
{{topic-link topic}}
{{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}}
{{/if}}
{{#if topic.tags}}
@ -25,23 +25,23 @@
{{raw "list/action-list" topic=topic postNumbers=topic.liked_post_numbers className="likes" icon="heart"}}
</td>
{{#unless controller.hideCategory}}
{{#unless hideCategory}}
{{#unless topic.isPinnedUncategorized}}
{{raw "list/category-column" category=topic.category}}
{{/unless}}
{{/unless}}
{{#if controller.showPosters}}
{{#if showPosters}}
{{raw "list/posters-column" posters=topic.posters}}
{{/if}}
{{raw "list/posts-count-column" topic=topic}}
{{#if controller.showParticipants}}
{{#if showParticipants}}
{{raw "list/posters-column" posters=topic.participants}}
{{/if}}
{{#if controller.showLikes}}
{{#if showLikes}}
<td class="num likes">
{{#if hasLikes}}
<a href='{{topic.summaryUrl}}'>
@ -50,7 +50,7 @@
{{/if}}
{{/if}}
{{#if controller.showOpLikes}}
{{#if showOpLikes}}
<td class="num likes">
{{#if hasOpLikes}}
<a href='{{topic.summaryUrl}}'>