mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Improved content menu
This commit is contained in:
parent
35d609a50f
commit
a134d33b28
@ -54,7 +54,7 @@ export default {
|
||||
placement: { type: String, default: 'top-end' },
|
||||
itemId: { type: String, required: true },
|
||||
name: { type: String, required: true },
|
||||
isAuthor: { type: Boolean, default: false },
|
||||
isOwner: { type: Boolean, default: false },
|
||||
context: {
|
||||
type: String,
|
||||
required: true,
|
||||
@ -67,16 +67,15 @@ export default {
|
||||
routes() {
|
||||
let routes = []
|
||||
|
||||
if (this.isAuthor && this.context === 'contribution') {
|
||||
const link = this.$router.resolve({
|
||||
name: 'post-edit-id',
|
||||
params: {
|
||||
id: this.itemId
|
||||
}
|
||||
}).href
|
||||
if (this.isOwner && this.context === 'contribution') {
|
||||
// const link = this.$router.resolve({
|
||||
// name: 'post-edit-id',
|
||||
// params: {
|
||||
// id: this.itemId
|
||||
// }
|
||||
// }).href
|
||||
routes.push({
|
||||
name: this.$t(`contribution.edit`),
|
||||
path: link,
|
||||
callback: () => {
|
||||
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
||||
return this.$router.push('/post/edit/p1')
|
||||
@ -85,8 +84,17 @@ export default {
|
||||
icon: 'edit'
|
||||
})
|
||||
}
|
||||
if (this.isOwner && this.context === 'comment') {
|
||||
routes.push({
|
||||
name: this.$t(`comment.edit`),
|
||||
callback: () => {
|
||||
console.log('EDIT COMMENT')
|
||||
},
|
||||
icon: 'edit'
|
||||
})
|
||||
}
|
||||
|
||||
if (!this.isAuthor) {
|
||||
if (!this.isOwner) {
|
||||
routes.push({
|
||||
name: this.$t(`report.${this.context}.title`),
|
||||
callback: this.openReportDialog,
|
||||
@ -94,13 +102,22 @@ export default {
|
||||
})
|
||||
}
|
||||
|
||||
if (this.isModerator) {
|
||||
if (!this.isOwner && this.isModerator) {
|
||||
routes.push({
|
||||
name: this.$t(`disable.${this.context}.title`),
|
||||
callback: () => {},
|
||||
icon: 'eye-slash'
|
||||
})
|
||||
}
|
||||
|
||||
if (this.isOwner && this.context === 'user') {
|
||||
routes.push({
|
||||
name: this.$t(`settings.data.name`),
|
||||
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
||||
callback: () => this.$router.push('/settings'),
|
||||
icon: 'edit'
|
||||
})
|
||||
}
|
||||
return routes
|
||||
},
|
||||
isModerator() {
|
||||
|
||||
@ -55,6 +55,7 @@
|
||||
context="contribution"
|
||||
:item-id="post.id"
|
||||
:name="post.title"
|
||||
:is-owner="isAuthor"
|
||||
/>
|
||||
</no-ssr>
|
||||
</div>
|
||||
@ -93,6 +94,9 @@ export default {
|
||||
}
|
||||
|
||||
return excerpt
|
||||
},
|
||||
isAuthor() {
|
||||
return this.$store.getters['auth/user'].id === this.post.author.id
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
@ -104,6 +104,10 @@
|
||||
"edit": "Beitrag bearbeiten",
|
||||
"delete": "Beitrag löschen"
|
||||
},
|
||||
"comment": {
|
||||
"edit": "Kommentar bearbeiten",
|
||||
"delete": "Kommentar löschen"
|
||||
},
|
||||
"disable": {
|
||||
"user": {
|
||||
"title": "Nutzer sperren",
|
||||
|
||||
@ -104,6 +104,10 @@
|
||||
"edit": "Edit Contribution",
|
||||
"delete": "Delete Contribution"
|
||||
},
|
||||
"comment": {
|
||||
"edit": "Edit Comment",
|
||||
"delete": "Delete Comment"
|
||||
},
|
||||
"disable": {
|
||||
"user": {
|
||||
"title": "Disable User",
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
context="contribution"
|
||||
:item-id="post.id"
|
||||
:name="post.title"
|
||||
:is-author="isAuthor"
|
||||
:is-owner="isAuthor(post.author.id)"
|
||||
/>
|
||||
</no-ssr>
|
||||
<ds-space margin-bottom="small" />
|
||||
@ -98,6 +98,7 @@
|
||||
style="float-right"
|
||||
:item-id="comment.id"
|
||||
:name="comment.author.name"
|
||||
:is-owner="isAuthor(comment.author.id)"
|
||||
/>
|
||||
</no-ssr>
|
||||
<!-- eslint-disable vue/no-v-html -->
|
||||
@ -155,17 +156,17 @@ export default {
|
||||
title: 'loading'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
isAuthor() {
|
||||
return this.$store.getters['auth/user'].id === this.post.author.id
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
Post(post) {
|
||||
this.post = post[0]
|
||||
this.title = this.post.title
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
isAuthor(id) {
|
||||
return this.$store.getters['auth/user'].id === id
|
||||
}
|
||||
},
|
||||
apollo: {
|
||||
Post: {
|
||||
query() {
|
||||
|
||||
@ -70,7 +70,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
post() {
|
||||
return this.Post ? this.Post[0] : {}
|
||||
return this.Post ? this.Post[0] || {} : {}
|
||||
}
|
||||
},
|
||||
apollo: {
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
context="user"
|
||||
:item-id="user.id"
|
||||
:name="user.name"
|
||||
:is-owner="myProfile"
|
||||
/>
|
||||
</no-ssr>
|
||||
<ds-space margin="small">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user