travis-web/assets/scripts/app/controllers/caches.coffee
2015-01-30 09:10:48 +01:00

20 lines
523 B
CoffeeScript

Controller = Ember.ArrayController.extend
isDeleting: false
needs: ['repo']
repo: Ember.computed.alias('controllers.repo.repo')
actions:
deleteRepoCache: ->
return if @get('isDeleting')
if confirm('Are you sure?')
@set('isDeleting', true)
deletingDone = => @set('isDeleting', false)
repo = @get('repo')
Travis.ajax.ajax("/repos/#{repo.get('id')}/caches", "DELETE").then(deletingDone, deletingDone).then =>
@clear()
Travis.CachesController = Controller