2015-07-10 04:28:02 +08:00
|
|
|
React = require "react/addons"
|
|
|
|
classNames = require 'classnames'
|
|
|
|
{RetinaImg} = require 'nylas-component-kit'
|
2015-10-23 07:13:37 +08:00
|
|
|
{Actions, FocusedContentStore, DestroyDraftTask} = require "nylas-exports"
|
2015-07-10 04:28:02 +08:00
|
|
|
|
|
|
|
class DraftDeleteButton extends React.Component
|
|
|
|
@displayName: 'DraftDeleteButton'
|
|
|
|
@containerRequired: false
|
|
|
|
|
|
|
|
@propTypes:
|
|
|
|
selection: React.PropTypes.object.isRequired
|
|
|
|
|
|
|
|
render: ->
|
|
|
|
<button style={order:-100}
|
|
|
|
className="btn btn-toolbar"
|
2015-10-22 02:03:27 +08:00
|
|
|
title="Delete"
|
2015-10-22 01:38:00 +08:00
|
|
|
onClick={@_destroySelected}>
|
2015-07-10 04:28:02 +08:00
|
|
|
<RetinaImg name="icon-composer-trash.png" mode={RetinaImg.Mode.ContentIsMask} />
|
|
|
|
</button>
|
|
|
|
|
2015-10-22 01:38:00 +08:00
|
|
|
_destroySelected: =>
|
|
|
|
for item in @props.selection.items()
|
2016-02-05 06:14:24 +08:00
|
|
|
Actions.destroyDraft(item.clientId)
|
2015-10-22 01:38:00 +08:00
|
|
|
@props.selection.clear()
|
2016-01-26 09:08:38 +08:00
|
|
|
return
|
2015-07-10 04:28:02 +08:00
|
|
|
|
|
|
|
module.exports = {DraftDeleteButton}
|