Set job and build on repo controller to null when leaving

We set job and build directly on repo controller for routes like job,
build and repo.index. We also need to clean that up when we exit to not
show for example download log button when we switch to different route.
This commit is contained in:
Piotr Sarnacki 2014-07-30 13:36:25 +02:00
parent cb4b385b2b
commit a5dae4acf3

View File

@ -187,6 +187,11 @@ Travis.BuildRoute = Travis.Route.extend
model: (params) ->
Travis.Build.fetch(params.build_id)
deactivate: ->
repo = @controllerFor('repo')
repo.set('build', null)
repo.set('job', null)
Travis.JobRoute = Travis.Route.extend
serialize: (model, params) ->
id = if model.get then model.get('id') else model
@ -207,6 +212,10 @@ Travis.JobRoute = Travis.Route.extend
model: (params) ->
Travis.Job.fetch(params.job_id)
deactivate: ->
repo = @controllerFor('repo')
repo.set('job', null)
Travis.RepoIndexRoute = Travis.Route.extend
setupController: (controller, model) ->
@_super.apply this, arguments
@ -218,6 +227,11 @@ Travis.RepoIndexRoute = Travis.Route.extend
else
@render 'builds/not_found'
deactivate: ->
repo = @controllerFor('repo')
repo.set('build', null)
repo.set('job', null)
Travis.RepoRoute = Travis.Route.extend
renderTemplate: ->
@render 'repo'