Fix selected class on repos list

This commit is contained in:
Piotr Sarnacki 2013-02-27 12:39:42 +01:00
parent f1a767a09f
commit 0f89da6dea
2 changed files with 10 additions and 2 deletions

View File

@ -3,8 +3,14 @@ require 'travis/limited_array'
Travis.ReposController = Ember.ArrayController.extend
defaultTab: 'recent'
isLoadedBinding: 'content.isLoaded'
needs: ['currentUser']
needs: ['currentUser', 'repo']
currentUserBinding: 'controllers.currentUser'
selectedRepo: (->
# we need to observe also repo.content here, because we use
# ObjectProxy in repo controller
# TODO: get rid of ObjectProxy there
@get('controllers.repo.repo.content') || @get('controllers.repo.repo')
).property('controllers.repo.repo', 'controllers.repo.repo.content')
init: ->
Ember.run.later(@updateTimes.bind(this), Travis.INTERVALS.updateTimes)

View File

@ -13,7 +13,9 @@
repoBinding: 'content'
classNames: ['repo']
classNameBindings: ['color', 'selected']
selectedBinding: 'repo.selected'
selected: (->
@get('content') == @get('controller.selectedRepo')
).property('controller.selectedRepo')
color: (->
Travis.Helpers.colorForState(@get('repo.lastBuildState'))