Entry deletion for the simple workflow (#485)

This commit is contained in:
Benaiah Mischenko
2017-07-21 23:40:33 -07:00
committed by GitHub
parent 1d08f1a33b
commit dac57c60a0
12 changed files with 167 additions and 17 deletions

View File

@ -47,6 +47,8 @@ class EntryEditor extends Component {
fieldsErrors,
getAsset,
onChange,
showDelete,
onDelete,
onValidate,
onAddAsset,
onRemoveAsset,
@ -127,6 +129,8 @@ class EntryEditor extends Component {
isPersisting={entry.get('isPersisting')}
onPersist={this.handleOnPersist}
onCancelEdit={onCancelEdit}
onDelete={onDelete}
showDelete={showDelete}
/>
</div>
</div>
@ -145,6 +149,8 @@ EntryEditor.propTypes = {
onChange: PropTypes.func.isRequired,
onValidate: PropTypes.func.isRequired,
onPersist: PropTypes.func.isRequired,
showDelete: PropTypes.bool.isRequired,
onDelete: PropTypes.func.isRequired,
onRemoveAsset: PropTypes.func.isRequired,
onCancelEdit: PropTypes.func.isRequired,
};

View File

@ -5,6 +5,8 @@ const EntryEditorToolbar = (
{
isPersisting,
onPersist,
showDelete,
onDelete,
onCancelEdit,
}) => {
const disabled = isPersisting;
@ -19,6 +21,12 @@ const EntryEditorToolbar = (
{ isPersisting ? 'Saving...' : 'Save' }
</Button>
{' '}
{ showDelete
? (<Button accent onClick={onDelete}>
Delete
</Button>)
: '' }
{ showDelete ? ' ' : '' }
<Button onClick={onCancelEdit}>
Cancel
</Button>
@ -29,6 +37,8 @@ const EntryEditorToolbar = (
EntryEditorToolbar.propTypes = {
isPersisting: PropTypes.bool,
onPersist: PropTypes.func.isRequired,
showDelete: PropTypes.bool.isRequired,
onDelete: PropTypes.func.isRequired,
onCancelEdit: PropTypes.func.isRequired,
};

View File

@ -8,6 +8,7 @@ describe('EntryEditorToolbar', () => {
<EntryEditorToolbar
onPersist={() => {}}
onCancelEdit={() => {}}
onDelete={() => {}}
/>
);
const tree = component.html();
@ -20,6 +21,7 @@ describe('EntryEditorToolbar', () => {
isPersisting
onPersist={() => {}}
onCancelEdit={() => {}}
onDelete={() => {}}
/>
);
const tree = component.html();