Add minimal draft management tool

This commit is contained in:
tusooa 2023-03-10 12:10:39 -05:00
commit 02e2e6b1bf
No known key found for this signature in database
GPG key ID: 42AEC43D48433C51
10 changed files with 186 additions and 45 deletions

View file

@ -0,0 +1,42 @@
import PostStatusForm from 'src/components/post_status_form/post_status_form.vue'
const Draft = {
components: {
PostStatusForm
},
props: {
draft: {
type: Object,
required: true
}
},
data () {
return {
editing: false
}
},
computed: {
relAttrs () {
if (this.draft.type === 'edit') {
return { statusId: this.draft.refId }
} else if (this.draft.type === 'reply') {
return { replyTo: this.draft.refId }
} else {
return {}
}
},
postStatusFormProps () {
return {
draftId: this.draft.id,
...this.relAttrs
}
}
},
methods: {
toggleEditing () {
this.editing = !this.editing
}
}
}
export default Draft

View file

@ -0,0 +1,35 @@
<template>
<article class="Draft">
<div>
{{ draft.id }}
</div>
<div v-if="draft.inReplyToStatusId">
{{ draft.inReplyToStatusId }}
</div>
<div
class="draft-content"
>
{{ draft.status }}
</div>
<div>
<button
class="btn button-default"
:aria-expanded="editing"
@click.prevent.stop="toggleEditing"
>
{{ $t('drafts.continue') }}
</button>
</div>
<div v-if="editing">
<PostStatusForm v-bind="postStatusFormProps" />
</div>
</article>
</template>
<script src="./draft.js"></script>
<style lang="scss">
.Draft {
margin: 1em;
}
</style>