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
|
||||
Loading…
Add table
Add a link
Reference in a new issue