Fix job links on the sidebar

This commit is contained in:
Piotr Sarnacki 2012-10-01 16:47:08 +02:00
parent 8b90440f7b
commit be19251ff3
3 changed files with 14 additions and 4 deletions

View File

@ -19,8 +19,8 @@ require 'travis/model'
).property('state')
repository: (->
@get('payload.repository.slug')
).property('payload.repository.slug')
Travis.Repository.find(@get('payload.repository.id'))
).property('payload.repository.id')
job_id: (->
@get('payload.job.id')

View File

@ -214,11 +214,21 @@ Travis.Router = Ember.Router.extend
router.get('repositoryController').activate 'branches'
job: Ember.Route.extend
route: '/jobs/:job_id'
connectOutlets: (router, job) ->
unless job.get
# In case I use id
job = Travis.Job.find(job)
router.get('repositoryController').set 'job', job
router.get('repositoryController').activate 'job'
serialize: (router, job) ->
if job.get
{ job_id: job.get('id') }
else
{ job_id: job }
deserialize: (router, params) ->
job = Travis.Job.find params.job_id
deferred = $.Deferred()

View File

@ -16,8 +16,8 @@
<li class="worker">
<div class="status"></div>
{{#if worker.isWorking}}
{{#if view.job.id}}
<a {{bindAttr title="worker.lastSeenAt"}} {{action showJob view.job href=true}}>
{{#if worker.job_id}}
<a {{action showJob worker.repository worker.job_id target="Travis.app.router" href=true}} {{bindAttr title="worker.lastSeenAt"}}>
{{view.display}}
</a>
{{/if}}