delete button working (#274)

Fixes #274.
This commit is contained in:
americool
2017-03-11 13:47:36 -05:00
committed by David Calavera
parent 8ffe6730fa
commit 3c7b8d2322
6 changed files with 68 additions and 2 deletions

View File

@ -13,6 +13,7 @@ class UnpublishedListing extends React.Component {
entries: ImmutablePropTypes.orderedMap,
handleChangeStatus: PropTypes.func.isRequired,
handlePublish: PropTypes.func.isRequired,
handleDelete: PropTypes.func.isRequired,
};
handleChangeStatus = (newStatus, dragProps) => {
@ -22,6 +23,11 @@ class UnpublishedListing extends React.Component {
this.props.handleChangeStatus(collection, slug, oldStatus, newStatus);
};
requestDelete = (collection, slug, ownStatus) => {
if (window.confirm('Are you sure you want to delete this entry?')) {
this.props.handleDelete(collection, slug, ownStatus);
}
};
requestPublish = (collection, slug, ownStatus) => {
if (ownStatus !== status.last()) return;
if (window.confirm('Are you sure you want to publish this entry?')) {
@ -82,6 +88,10 @@ class UnpublishedListing extends React.Component {
<Link to={link}>
<Button>Edit</Button>
</Link>
<Button
onClick={this.requestDelete.bind(this, collection, slug, ownStatus)}>
Delete
</Button>
{
(ownStatus === status.last() && !entry.get('isPersisting', false)) &&
<Button