mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Add Editor, cancel/submit buttons for comments
- to PagesPost_id_slugIndex.vue - handle simple comment creation using auto-generated resolver Co-authored-by: Joseph "Kachulio" Ngugi <jngugi88@gmail.com>
This commit is contained in:
parent
f6eb5474d1
commit
674cdddfc3
@ -106,7 +106,8 @@
|
|||||||
},
|
},
|
||||||
"takeAction": {
|
"takeAction": {
|
||||||
"name": "Take action"
|
"name": "Take action"
|
||||||
}
|
},
|
||||||
|
"submitComment": "Submit Comment"
|
||||||
},
|
},
|
||||||
"quotes": {
|
"quotes": {
|
||||||
"african": {
|
"african": {
|
||||||
|
|||||||
@ -96,34 +96,67 @@
|
|||||||
<ds-space margin="small" />
|
<ds-space margin="small" />
|
||||||
<!-- Comments -->
|
<!-- Comments -->
|
||||||
<ds-section slot="footer">
|
<ds-section slot="footer">
|
||||||
<h3 style="margin-top: 0;">
|
<ds-flex>
|
||||||
<span>
|
<ds-flex-item width="30%">
|
||||||
<ds-icon name="comments" />
|
<h3 style="margin-top: 0;">
|
||||||
<ds-tag
|
<span>
|
||||||
v-if="post.comments"
|
<ds-icon name="comments" />
|
||||||
style="margin-top: -4px; margin-left: -12px; position: absolute;"
|
<ds-tag
|
||||||
color="primary"
|
v-if="post.comments"
|
||||||
size="small"
|
style="margin-top: -4px; margin-left: -12px; position: absolute;"
|
||||||
round
|
color="primary"
|
||||||
>{{ post.commentsCount }}</ds-tag> Comments
|
size="small"
|
||||||
</span>
|
round
|
||||||
</h3>
|
>{{ post.commentsCount }}</ds-tag> Comments
|
||||||
<ds-space margin-bottom="large" />
|
</span>
|
||||||
<div
|
</h3>
|
||||||
v-if="post.comments"
|
</ds-flex-item>
|
||||||
id="comments"
|
<ds-flex-item width="70%">
|
||||||
class="comments"
|
<no-ssr>
|
||||||
>
|
<hc-editor
|
||||||
<comment
|
v-model="value"
|
||||||
v-for="comment in post.comments"
|
/>
|
||||||
:key="comment.id"
|
</no-ssr>
|
||||||
:comment="comment"
|
<ds-flex>
|
||||||
|
<ds-flex-item>
|
||||||
|
<ds-button
|
||||||
|
:disabled="loading || disabled"
|
||||||
|
ghost
|
||||||
|
@click.prevent="$router.back()"
|
||||||
|
>
|
||||||
|
{{ $t('actions.cancel') }}
|
||||||
|
</ds-button>
|
||||||
|
</ds-flex-item>
|
||||||
|
<ds-flex-item>
|
||||||
|
<ds-button
|
||||||
|
type="submit"
|
||||||
|
:loading="loading"
|
||||||
|
:disabled="disabled || errors"
|
||||||
|
primary
|
||||||
|
@click="handleSubmit"
|
||||||
|
>
|
||||||
|
{{ $t('post.submitComment') }}
|
||||||
|
</ds-button>
|
||||||
|
</ds-flex-item>
|
||||||
|
</ds-flex>
|
||||||
|
</ds-flex-item>
|
||||||
|
<ds-space margin-bottom="large" />
|
||||||
|
<div
|
||||||
|
v-if="post.comments"
|
||||||
|
id="comments"
|
||||||
|
class="comments"
|
||||||
|
>
|
||||||
|
<comment
|
||||||
|
v-for="comment in post.comments"
|
||||||
|
:key="comment.id"
|
||||||
|
:comment="comment"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<hc-empty
|
||||||
|
v-else
|
||||||
|
icon="messages"
|
||||||
/>
|
/>
|
||||||
</div>
|
</ds-flex>
|
||||||
<hc-empty
|
|
||||||
v-else
|
|
||||||
icon="messages"
|
|
||||||
/>
|
|
||||||
</ds-section>
|
</ds-section>
|
||||||
</ds-card>
|
</ds-card>
|
||||||
</transition>
|
</transition>
|
||||||
@ -139,6 +172,7 @@ import HcUser from '~/components/User'
|
|||||||
import HcShoutButton from '~/components/ShoutButton.vue'
|
import HcShoutButton from '~/components/ShoutButton.vue'
|
||||||
import HcEmpty from '~/components/Empty.vue'
|
import HcEmpty from '~/components/Empty.vue'
|
||||||
import Comment from '~/components/Comment.vue'
|
import Comment from '~/components/Comment.vue'
|
||||||
|
import HcEditor from '~/components/Editor/Editor.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
transition: {
|
transition: {
|
||||||
@ -152,7 +186,8 @@ export default {
|
|||||||
HcShoutButton,
|
HcShoutButton,
|
||||||
HcEmpty,
|
HcEmpty,
|
||||||
Comment,
|
Comment,
|
||||||
ContentMenu
|
ContentMenu,
|
||||||
|
HcEditor
|
||||||
},
|
},
|
||||||
head() {
|
head() {
|
||||||
return {
|
return {
|
||||||
@ -278,6 +313,20 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
isAuthor(id) {
|
isAuthor(id) {
|
||||||
return this.$store.getters['auth/user'].id === id
|
return this.$store.getters['auth/user'].id === id
|
||||||
|
},
|
||||||
|
handleSubmit() {
|
||||||
|
this.$apollo.mutate({
|
||||||
|
mutation: gql`
|
||||||
|
mutation($content: String!) {
|
||||||
|
CreateComment(content: $content) {
|
||||||
|
content
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
variables: {
|
||||||
|
content: this.value
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user