travis-web/app/routes/abstract-builds.coffee
Piotr Sarnacki a4a75912b0 Implement ajax polling for things that are visible on the screen
We sometimes miss pusher updates, which started to be more common
lately. Until we investigate what's going on, this should be a good
workaround for keeping UI in sync with the DB.
2015-05-07 13:49:21 +02:00

31 lines
836 B
CoffeeScript

`import TravisRoute from 'travis/routes/basic'`
Route = TravisRoute.extend
titleToken: (model) ->
@get('contentType').replace('_', ' ').capitalize()
renderTemplate: ->
@render 'builds'
setupController: ->
@controllerFor('repo').activate(@get('contentType'))
@contentDidChange()
@controllerFor('repo').addObserver(@get('path'), this, 'contentDidChange')
@controllerFor('build').set('contentType', @get('contentType'))
deactivate: ->
@controllerFor('repo').removeObserver(@get('path'), this, 'contentDidChange')
@_super.apply(this, arguments)
contentDidChange: ->
path = @get('path')
@controllerFor('builds').set('model', @controllerFor('repo').get(path))
path: (->
type = @get('contentType')
"repo.#{type.camelize()}"
).property('contentType')
`export default Route`