PERF: don't bind all these things
TODO - cleaner pattern and helper for this
This commit is contained in:
parent
3347a48275
commit
69cfab62b8
|
@ -5,11 +5,27 @@ export default Discourse.View.extend(StringBuffer, {
|
||||||
tagName: 'tr',
|
tagName: 'tr',
|
||||||
rawTemplate: 'list/topic_list_item.raw',
|
rawTemplate: 'list/topic_list_item.raw',
|
||||||
classNameBindings: ['controller.checked',
|
classNameBindings: ['controller.checked',
|
||||||
'content.archived',
|
|
||||||
':topic-list-item',
|
':topic-list-item',
|
||||||
'content.hasExcerpt:has-excerpt',
|
'unboundClassNames'
|
||||||
'content.liked:liked',
|
],
|
||||||
'content.bookmarked:bookmarked'],
|
|
||||||
|
unboundClassNames: function(){
|
||||||
|
var classes = [];
|
||||||
|
var topic = this.get('topic');
|
||||||
|
|
||||||
|
if(topic.get('hasExcerpt')){
|
||||||
|
classes.push('has-excerpt');
|
||||||
|
}
|
||||||
|
|
||||||
|
_.each(['liked', 'archived', 'bookmarked'],function(name){
|
||||||
|
if(topic.get(name)){
|
||||||
|
classes.push(name);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return classes.join(' ');
|
||||||
|
}.property(),
|
||||||
|
|
||||||
attributeBindings: ['data-topic-id'],
|
attributeBindings: ['data-topic-id'],
|
||||||
'data-topic-id': Em.computed.alias('content.id'),
|
'data-topic-id': Em.computed.alias('content.id'),
|
||||||
titleColSpan: function(){
|
titleColSpan: function(){
|
||||||
|
|
Loading…
Reference in New Issue