travis-web/app/components/caches-item.coffee
Lisa P 0b1bd7d090 style caches
some cache tweaks

add title attributes to settings interaction elements
2015-12-02 16:13:21 +01:00

28 lines
684 B
CoffeeScript

`import Ember from 'ember'`
`import Ajax from 'travis/utils/ajax'`
CachesItemComponent = Ember.Component.extend
tagName: 'li'
classNames: ['cache-item']
classNameBindings: ['cache.type']
isDeleting: false
actions:
delete: ->
return if @get('isDeleting')
if confirm('Are you sure?')
@set('isDeleting', true)
data = { branch: @get('cache.branch') }
deletingDone = => @set('isDeleting', false)
repo = @get('repo')
Ajax.ajax("/repos/#{repo.get('id')}/caches", "DELETE", data: data).then(deletingDone, deletingDone).then =>
@get('caches').removeObject(@get('cache'))
`export default CachesItemComponent`