travis-web/app/controllers/caches.coffee
Piotr Sarnacki bfb4946df8 Show caches also if there're no caches for push builds
This commit fixes caches view to show caches also if only PR caches
exist. Previous version checked for pushes only.
2015-05-06 11:34:02 +02:00

28 lines
735 B
CoffeeScript

`import Ember from 'ember'`
`import Ajax from 'travis/utils/ajax'`
Controller = Ember.Controller.extend
needs: ['repo']
repo: Ember.computed.alias('controllers.repo.repo')
isDeleting: false
cachesExist: (->
@get('model.pushes.length') || @get('model.pullRequests.length')
).property('model.pushes.length', 'model.pullRequests.length')
actions:
deleteRepoCache: ->
return if @get('isDeleting')
if confirm('Are you sure?')
@set('isDeleting', true)
deletingDone = => @set('isDeleting', false)
repo = @get('repo')
Ajax.ajax("/repos/#{@get('repo.id')}/caches", "DELETE").then(deletingDone, deletingDone).then =>
@set('model', {})
`export default Controller`