diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-07-08 23:52:06 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-07-08 23:52:06 +0200 |
| commit | 49fb1cf616b31792729a012eed9bf82e9fa91e8f (patch) | |
| tree | 627f150aa418202d7b443ef800dce16616b3739c /animism-align/frontend/views/align/components/annotations/annotation.form.js | |
| parent | 18472645a7879baf00332a7ee5be8c4338bb8d21 (diff) | |
displaying media annotations. delete annotations
Diffstat (limited to 'animism-align/frontend/views/align/components/annotations/annotation.form.js')
| -rw-r--r-- | animism-align/frontend/views/align/components/annotations/annotation.form.js | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/animism-align/frontend/views/align/components/annotations/annotation.form.js b/animism-align/frontend/views/align/components/annotations/annotation.form.js index 0a71233..eb5c0ad 100644 --- a/animism-align/frontend/views/align/components/annotations/annotation.form.js +++ b/animism-align/frontend/views/align/components/annotations/annotation.form.js @@ -23,6 +23,7 @@ class AnnotationForm extends Component { this.handleSettingsSelect = this.handleSettingsSelect.bind(this) this.handleKeyDown = this.handleKeyDown.bind(this) this.handleSubmit = this.handleSubmit.bind(this) + this.handleDestroy = this.handleDestroy.bind(this) this.textareaRef = React.createRef() } componentDidMount() { @@ -91,6 +92,18 @@ class AnnotationForm extends Component { }) } } + handleDestroy() { + const { annotation } = this.props + if (annotation.id === 'new') { + actions.align.hideAnnotationForm() + } else { + actions.annotation.destroy(annotation) + .then(response => { + console.log(response) + actions.align.hideAnnotationForm() + }) + } + } render() { const { timeline, annotation } = this.props if (!annotation.start_ts) return <div></div> @@ -122,7 +135,10 @@ class AnnotationForm extends Component { /> <div className='ts'>{timestamp(annotation.start_ts, 1, true)}</div> </div> - <button onClick={this.handleSubmit}>Save</button> + <div> + {annotation.id !== 'new' && <button onClick={this.handleDestroy}>Delete</button>} + <button onClick={this.handleSubmit}>Save</button> + </div> </div> ) } |
