Verified Commit 0df70340 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

QoL improvements for moderation UI

parent 0905a87b
......@@ -120,6 +120,10 @@
<div v-if="!obj.target" class="ui warning message">
<translate translate-context="Content/Moderation/Message">The object associated with this report was deleted.</translate>
</div>
<router-link class="ui basic button" v-if="target && configs[target.type].urls.getDetail" :to="configs[target.type].urls.getDetail(obj.target_state)">
<i class="eye icon"></i>
<translate translate-context="Content/Moderation/Link">View public page</translate>
</router-link>
<router-link class="ui basic button" v-if="target && configs[target.type].urls.getAdminDetail" :to="configs[target.type].urls.getAdminDetail(obj.target_state)">
<i class="wrench icon"></i>
<translate translate-context="Content/Moderation/Link">Open in moderation interface</translate>
......@@ -223,7 +227,7 @@
</button>
<template v-for="action in actions">
<dangerous-button
v-if="action.dangerous"
v-if="action.dangerous && action.show(obj)"
:class="['ui', {loading: isLoading}, 'button']"
color=""
:action="action.handler">
......@@ -352,15 +356,17 @@ export default {
actions.push({
label: this.$pgettext('Content/Moderation/Button/Verb', 'Delete reported object'),
modalHeader: this.$pgettext('Content/Moderation/Popup/Header', 'Delete reported object?'),
modalContent: this.$pgettext('Content/Moderation/Popup,Paragraph', 'This will delete the object associated with this report. This action is irreversible.'),
modalContent: this.$pgettext('Content/Moderation/Popup,Paragraph', 'This will delete the object associated with this report and mark the report as resolved. The deletion is irreversible.'),
modalConfirmLabel: this.$pgettext('*/*/*/Verb', 'Delete'),
icon: 'x',
iconColor: 'red',
show: (obj) => { return !!obj.target },
dangerous: true,
handler: () => {
axios.delete(deleteUrl).then((response) => {
console.log('Target deleted')
self.obj.target = null
self.resolve(true)
}, error => {
console.log('Error while deleting target')
})
......
......@@ -15,7 +15,8 @@ export default {
return `manage/library/artists/${obj.id}/`
},
urls: {
getAdminDetail: (obj) => { return {name: 'manage.library.artists.detail', params: {id: obj.id}}}
getDetail: (obj) => { return {name: 'library.artists.detail', params: {id: obj.id}}},
getAdminDetail: (obj) => { return {name: 'manage.library.artists.detail', params: {id: obj.id}}},
},
moderatedFields: [
{
......@@ -49,6 +50,7 @@ export default {
return `manage/library/albums/${obj.id}/`
},
urls: {
getDetail: (obj) => { return {name: 'library.albums.detail', params: {id: obj.id}}},
getAdminDetail: (obj) => { return {name: 'manage.library.albums.detail', params: {id: obj.id}}}
},
moderatedFields: [
......@@ -89,6 +91,7 @@ export default {
return `manage/library/tracks/${obj.id}/`
},
urls: {
getDetail: (obj) => { return {name: 'library.tracks.detail', params: {id: obj.id}}},
getAdminDetail: (obj) => { return {name: 'manage.library.tracks.detail', params: {id: obj.id}}}
},
moderatedFields: [
......@@ -156,6 +159,7 @@ export default {
label: this.$pgettext('*/*/*', 'Playlist'),
icon: 'list',
urls: {
getDetail: (obj) => { return {name: 'library.playlists.detail', params: {id: obj.id}}},
// getAdminDetail: (obj) => { return {name: 'manage.playlists.detail', params: {id: obj.id}}}
},
moderatedFields: [
......
......@@ -55,7 +55,7 @@
<empty-state @refresh="fetchData()" :refresh="true"></empty-state>
</div>
<div v-else-if="mode === 'card'">
<report-card :obj="obj" v-for="obj in result.results" :key="obj.uuid" />
<report-card @handled="fetchData" :obj="obj" v-for="obj in result.results" :key="obj.uuid" />
</div>
</section>
</main>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment