Use collection instead of each
I'm not sure why, but this fixes a problem that occures in builds/show. It's probably some kind of weird behavior that's happening when ember manages views insterted with each as opposed to collection management.
This commit is contained in:
parent
5a077d3646
commit
c297033f84
|
@ -15,10 +15,8 @@
|
|||
</ul>
|
||||
|
||||
<div class="tab">
|
||||
<ul id="repositories">
|
||||
{{#each repository in controller}}
|
||||
{{#view Travis.RepositoriesItemView contextBinding="repository"}}
|
||||
<li {{bindAttr class="view.classes"}}>
|
||||
{{#collection Travis.RepositoriesListView contentBinding="controller"}}
|
||||
{{#with view.repository}}
|
||||
<a {{bindAttr href="view.urlRepository"}} {{action route}} class="current">{{slug}}</a>
|
||||
<a {{bindAttr href="view.urlLastBuild"}} {{action route}} class="last_build">#{{lastBuildNumber}}</a>
|
||||
|
||||
|
@ -32,12 +30,6 @@
|
|||
<p class="description">{{description}}</p>
|
||||
{{/if}}
|
||||
<span class="indicator"></span>
|
||||
</li>
|
||||
{{/view}}
|
||||
{{else}}
|
||||
<div class="loading">
|
||||
<span>Loading</span>
|
||||
</div>
|
||||
{{/each}}
|
||||
<ul>
|
||||
{{/with}}
|
||||
{{/collection}}
|
||||
</div>
|
||||
|
|
|
@ -18,21 +18,24 @@
|
|||
'active' if @get('tab') == 'search'
|
||||
).property('tab')
|
||||
|
||||
RepositoriesItemView: Travis.View.extend
|
||||
repositoryBinding: 'context'
|
||||
RepositoriesListView: Em.CollectionView.extend
|
||||
elementId: 'repositories'
|
||||
repositoryBinding: 'content'
|
||||
tagName: 'ul'
|
||||
|
||||
classes: (->
|
||||
$.compact(['repository', @get('color'), @get('selected')]).join(' ')
|
||||
).property('color', 'selected')
|
||||
emptyView: Ember.View.extend
|
||||
template: Ember.Handlebars.compile('<div class="loading"><span>Loading</span></div>')
|
||||
|
||||
itemViewClass: Travis.View.extend
|
||||
repositoryBinding: 'content'
|
||||
classNames: ['repository']
|
||||
classNameBindings: ['color', 'selected']
|
||||
selectedBinding: 'repository.selected'
|
||||
|
||||
color: (->
|
||||
Travis.Helpers.colorForResult(@get('repository.lastBuildResult'))
|
||||
).property('repository.lastBuildResult')
|
||||
|
||||
selected: (->
|
||||
'selected' if @get('repository.selected')
|
||||
).property('repository.selected')
|
||||
|
||||
urlRepository: (->
|
||||
Travis.Urls.repository(@get('repository.slug'))
|
||||
).property('repository.slug')
|
||||
|
|
Loading…
Reference in New Issue
Block a user