clean up
This commit is contained in:
parent
e15b2d680f
commit
a6119caf3e
|
@ -31,6 +31,6 @@ Travis.Layout.Base = Em.Object.extend
|
||||||
@topController.set('tab', @get('name'))
|
@topController.set('tab', @get('name'))
|
||||||
|
|
||||||
activate: (action, params) ->
|
activate: (action, params) ->
|
||||||
@set('params', params)
|
|
||||||
this["view#{$.camelize(action)}"]()
|
this["view#{$.camelize(action)}"]()
|
||||||
|
@set('params', params)
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ require 'layout/base'
|
||||||
|
|
||||||
Travis.Layout.Home = Travis.Layout.Base.extend
|
Travis.Layout.Home = Travis.Layout.Base.extend
|
||||||
name: 'home'
|
name: 'home'
|
||||||
|
bindings: []
|
||||||
|
|
||||||
init: ->
|
init: ->
|
||||||
@_super('repositories', 'repository', 'tabs', 'builds', 'build', 'job')
|
@_super('repositories', 'repository', 'tabs', 'builds', 'build', 'job')
|
||||||
|
@ -14,56 +15,54 @@ Travis.Layout.Home = Travis.Layout.Base.extend
|
||||||
@set('repositories', Travis.Repository.find())
|
@set('repositories', Travis.Repository.find())
|
||||||
|
|
||||||
activate: (action, params) ->
|
activate: (action, params) ->
|
||||||
|
@_unbind()
|
||||||
@set('tab', if action == 'index' then 'current' else action)
|
@set('tab', if action == 'index' then 'current' else action)
|
||||||
@_super(action, params)
|
@_super(action, params)
|
||||||
|
|
||||||
viewIndex: ->
|
viewIndex: ->
|
||||||
@bindRepository('repositories.firstObject')
|
@_bind('repository', 'repositories.firstObject')
|
||||||
@bindBuild('repository.lastBuild')
|
@_bind('build', 'repository.lastBuild')
|
||||||
@connectTab('build')
|
@connectTab('build')
|
||||||
|
|
||||||
viewCurrent: ->
|
viewCurrent: ->
|
||||||
@bindRepository('repositoryByParams')
|
@_bind('repository', 'repositoriesByParams.firstObject')
|
||||||
@bindBuild('repository.lastBuild')
|
@_bind('build', 'repository.lastBuild')
|
||||||
@connectTab('build')
|
@connectTab('build')
|
||||||
|
|
||||||
viewBuilds: ->
|
viewBuilds: ->
|
||||||
@bind('repository', 'repositoriesByParams.firstObject')
|
@_bind('repository', 'repositoriesByParams.firstObject')
|
||||||
@bind('builds', 'repository.builds')
|
@_bind('builds', 'repository.builds')
|
||||||
@connectTab('builds')
|
@connectTab('builds')
|
||||||
|
|
||||||
viewBuild: ->
|
viewBuild: ->
|
||||||
@bindRepository('repositoryByParams')
|
@_bind('repository', 'repositoriesByParams.firstObject')
|
||||||
@bindBuild('buildById')
|
@_bind('build', 'buildById')
|
||||||
@connectTab('build')
|
@connectTab('build')
|
||||||
|
|
||||||
viewJob: ->
|
viewJob: ->
|
||||||
@bindRepository('repositoryByParams')
|
@_bind('repository', 'repositoriesByParams.firstObject')
|
||||||
@bindJob('jobById')
|
@_bind('build', 'job.build')
|
||||||
|
@_bind('job', 'jobById')
|
||||||
@connectTab('job')
|
@connectTab('job')
|
||||||
|
|
||||||
repositoryByParamsBinding: 'repositoriesByParams.firstObject'
|
|
||||||
|
|
||||||
repositoriesByParams: (->
|
repositoriesByParams: (->
|
||||||
console.log('repositoriesByParams', @getPath('params.owner'), @getPath('params.name'))
|
|
||||||
Travis.Repository.bySlug("#{params.owner}/#{params.name}") if params = @get('params')
|
Travis.Repository.bySlug("#{params.owner}/#{params.name}") if params = @get('params')
|
||||||
).property('params')
|
).property('params')
|
||||||
|
|
||||||
buildById: (->
|
buildById: (->
|
||||||
console.log('buildByParams', @getPath('params.id'))
|
|
||||||
Travis.Build.find(id) if id = @getPath('params.id')
|
Travis.Build.find(id) if id = @getPath('params.id')
|
||||||
).property('params.id')
|
).property('params.id')
|
||||||
|
|
||||||
jobById: (->
|
jobById: (->
|
||||||
console.log('jobByParams', @getPath('params.id'))
|
|
||||||
Travis.Job.find(id) if id = @getPath('params.id')
|
Travis.Job.find(id) if id = @getPath('params.id')
|
||||||
).property('params.id')
|
).property('params.id')
|
||||||
|
|
||||||
bindRepository: (from) ->
|
_bind: (to, from) ->
|
||||||
Ember.oneWay(this, 'repository', from)
|
@bindings.push Ember.oneWay(this, to, from)
|
||||||
|
|
||||||
bindBuild: (from) ->
|
_unbind: ->
|
||||||
Ember.oneWay(this, 'build', from)
|
binding.disconnect(this) for binding in @bindings
|
||||||
|
@bindings.length = 0
|
||||||
|
|
||||||
connectTab: (tab) ->
|
connectTab: (tab) ->
|
||||||
@controller.connectOutlet(outletName: 'tab', name: tab)
|
@controller.connectOutlet(outletName: 'tab', name: tab)
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user