Refactor moderation page

This commit is contained in:
Wolfgang Huß 2019-10-07 09:31:24 +02:00
parent 43e401293d
commit 555159e171
3 changed files with 43 additions and 24 deletions

View File

@ -395,8 +395,10 @@
"reports": { "reports": {
"empty": "Glückwunsch, es gibt nichts zu moderieren.", "empty": "Glückwunsch, es gibt nichts zu moderieren.",
"name": "Meldungen", "name": "Meldungen",
"submitter": "gemeldet von", "reasonCategory": "Kategorie",
"disabledBy": "deaktiviert von" "reasonDescription": "Beschreibung",
"submitter": "Gemeldet von",
"disabledBy": "Deaktiviert von"
} }
}, },
"disable": { "disable": {

View File

@ -396,8 +396,10 @@
"reports": { "reports": {
"empty": "Congratulations, nothing to moderate.", "empty": "Congratulations, nothing to moderate.",
"name": "Reports", "name": "Reports",
"submitter": "reported by", "reasonCategory": "Category",
"disabledBy": "disabled by" "reasonDescription": "Description",
"submitter": "Reported by",
"disabledBy": "Disabled by"
} }
}, },
"disable": { "disable": {

View File

@ -2,7 +2,28 @@
<ds-card space="small"> <ds-card space="small">
<ds-heading tag="h3">{{ $t('moderation.reports.name') }}</ds-heading> <ds-heading tag="h3">{{ $t('moderation.reports.name') }}</ds-heading>
<ds-table v-if="Report && Report.length" :data="Report" :fields="fields" condensed> <ds-table v-if="Report && Report.length" :data="Report" :fields="fields" condensed>
<template slot="name" slot-scope="scope"> <!-- Icon -->
<template slot="type" slot-scope="scope">
<ds-text color="soft">
<ds-icon
v-if="scope.row.type === 'Post'"
v-tooltip="{ content: $t('report.contribution.type'), placement: 'right' }"
name="bookmark"
/>
<ds-icon
v-else-if="scope.row.type === 'Comment'"
v-tooltip="{ content: $t('report.comment.type'), placement: 'right' }"
name="comments"
/>
<ds-icon
v-else-if="scope.row.type === 'User'"
v-tooltip="{ content: $t('report.user.type'), placement: 'right' }"
name="user"
/>
</ds-text>
</template>
<!-- reported user or content -->
<template slot="reportedUserContent" slot-scope="scope">
<div v-if="scope.row.type === 'Post'"> <div v-if="scope.row.type === 'Post'">
<nuxt-link <nuxt-link
:to="{ :to="{
@ -42,25 +63,15 @@
</nuxt-link> </nuxt-link>
</div> </div>
</template> </template>
<template slot="type" slot-scope="scope"> <!-- reasonCategory -->
<ds-text color="soft"> <template slot="reasonCategory" slot-scope="scope">
<ds-icon {{ $t('report.reason.category.options.' + scope.row.reasonCategory) }}
v-if="scope.row.type === 'Post'"
v-tooltip="{ content: $t('report.contribution.type'), placement: 'right' }"
name="bookmark"
/>
<ds-icon
v-else-if="scope.row.type === 'Comment'"
v-tooltip="{ content: $t('report.comment.type'), placement: 'right' }"
name="comments"
/>
<ds-icon
v-else-if="scope.row.type === 'User'"
v-tooltip="{ content: $t('report.user.type'), placement: 'right' }"
name="user"
/>
</ds-text>
</template> </template>
<!-- reasonCategory -->
<template slot="reasonDescription" slot-scope="scope">
{{ scope.row.reasonDescription }}
</template>
<!-- submitter -->
<template slot="submitter" slot-scope="scope"> <template slot="submitter" slot-scope="scope">
<nuxt-link <nuxt-link
:to="{ :to="{
@ -71,6 +82,7 @@
{{ scope.row.submitter.name }} {{ scope.row.submitter.name }}
</nuxt-link> </nuxt-link>
</template> </template>
<!-- disabledBy -->
<template slot="disabledBy" slot-scope="scope"> <template slot="disabledBy" slot-scope="scope">
<nuxt-link <nuxt-link
v-if="scope.row.type === 'Post' && scope.row.post.disabledBy" v-if="scope.row.type === 'Post' && scope.row.post.disabledBy"
@ -102,6 +114,7 @@
> >
<b>{{ scope.row.user.disabledBy.name | truncate(50) }}</b> <b>{{ scope.row.user.disabledBy.name | truncate(50) }}</b>
</nuxt-link> </nuxt-link>
<b v-else></b>
</template> </template>
</ds-table> </ds-table>
<hc-empty v-else icon="alert" :message="$t('moderation.reports.empty')" /> <hc-empty v-else icon="alert" :message="$t('moderation.reports.empty')" />
@ -125,7 +138,9 @@ export default {
fields() { fields() {
return { return {
type: ' ', type: ' ',
name: ' ', reportedUserContent: ' ',
reasonCategory: this.$t('moderation.reports.reasonCategory'),
reasonDescription: this.$t('moderation.reports.reasonDescription'),
submitter: this.$t('moderation.reports.submitter'), submitter: this.$t('moderation.reports.submitter'),
disabledBy: this.$t('moderation.reports.disabledBy'), disabledBy: this.$t('moderation.reports.disabledBy'),
// actions: ' ' // actions: ' '