
Till now, when switching between different views, we were switching different bindings on repo controller. This was quite innefficient, because then we needed to add bindings also from other controllers and it's hard to manage such structure when we would like to add specialized controllers (like LogController). The new setup is more declarative, meaning that we do such things on the router and set things on proper controllers. The only drawback is that now we need to setup a few observers instead of bindings for "current" views (ie. when viewing the newest repo or when viewing the last build in current repo). At this point it may not look like huge improvement, but it will open a way to more refactorings.
24 lines
643 B
CoffeeScript
24 lines
643 B
CoffeeScript
Travis.BuildController = Ember.Controller.extend
|
|
needs: ['repo']
|
|
repoBinding: 'controllers.repo.repo'
|
|
commitBinding: 'build.commit'
|
|
lineNumberBinding: 'controllers.repo.lineNumber'
|
|
|
|
currentItemBinding: 'build'
|
|
|
|
loading: (->
|
|
@get('build.isLoading')
|
|
).property('build.isLoading')
|
|
|
|
urlGithubCommit: (->
|
|
Travis.Urls.githubCommit(@get('repo.slug'), @get('commit.sha'))
|
|
).property('repo.slug', 'commit.sha')
|
|
|
|
urlAuthor: (->
|
|
Travis.Urls.email(@get('commit.authorEmail'))
|
|
).property('commit.authorEmail')
|
|
|
|
urlCommitter: (->
|
|
Travis.Urls.email(@get('commit.committerEmail'))
|
|
).property('commit.committerEmail')
|