Add minimal draft management tool
This commit is contained in:
parent
1edada7e9d
commit
02e2e6b1bf
10 changed files with 186 additions and 45 deletions
42
src/components/draft/draft.js
Normal file
42
src/components/draft/draft.js
Normal 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
|
||||
35
src/components/draft/draft.vue
Normal file
35
src/components/draft/draft.vue
Normal 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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue