See #890: UI for reporting libraries
This commit is contained in:
parent
05e36c745c
commit
08eeab4d99
|
@ -1,7 +1,7 @@
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
methods: {
|
methods: {
|
||||||
getReportableObjs ({track, album, artist, playlist, account}) {
|
getReportableObjs ({track, album, artist, playlist, account, library}) {
|
||||||
let reportableObjs = []
|
let reportableObjs = []
|
||||||
if (account) {
|
if (account) {
|
||||||
let accountLabel = this.$pgettext('*/Moderation/*/Verb', "Report @%{ username }…")
|
let accountLabel = this.$pgettext('*/Moderation/*/Verb', "Report @%{ username }…")
|
||||||
|
@ -57,17 +57,28 @@ export default {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (this.playlist) {
|
if (playlist) {
|
||||||
reportableObjs.push({
|
reportableObjs.push({
|
||||||
label: this.$pgettext('*/Moderation/*/Verb', "Report this playlist…"),
|
label: this.$pgettext('*/Moderation/*/Verb', "Report this playlist…"),
|
||||||
target: {
|
target: {
|
||||||
type: 'playlist',
|
type: 'playlist',
|
||||||
id: this.playlist.id,
|
id: playlist.id,
|
||||||
label: this.playlist.name,
|
label: playlist.name,
|
||||||
typeLabel: this.$pgettext("*/*/*", 'Playlist'),
|
typeLabel: this.$pgettext("*/*/*", 'Playlist'),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
if (library) {
|
||||||
|
reportableObjs.push({
|
||||||
|
label: this.$pgettext('*/Moderation/*/Verb', "Report this library…"),
|
||||||
|
target: {
|
||||||
|
type: 'library',
|
||||||
|
uuid: library.uuid,
|
||||||
|
label: library.name,
|
||||||
|
typeLabel: this.$pgettext("*/*/*", 'Library'),
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
return reportableObjs
|
return reportableObjs
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,7 +184,7 @@ body {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.ellipsis {
|
.ellipsis:not(.icon) {
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
@ -250,6 +250,9 @@ a {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.nomargin {
|
||||||
|
margin: 0 !important;
|
||||||
|
}
|
||||||
button.reset {
|
button.reset {
|
||||||
border: none;
|
border: none;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
|
@ -3,17 +3,30 @@
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
{{ library.name }}
|
{{ library.name }}
|
||||||
|
<div class="ui right floated dropdown">
|
||||||
|
<i class="ellipsis vertical grey large icon nomargin"></i>
|
||||||
|
<div class="menu">
|
||||||
|
<div
|
||||||
|
role="button"
|
||||||
|
v-for="obj in getReportableObjs({library, account: library.actor})"
|
||||||
|
:key="obj.target.type + obj.target.id"
|
||||||
|
class="item basic"
|
||||||
|
@click.stop.prevent="$store.dispatch('moderation/report', obj.target)">
|
||||||
|
<i class="share icon" /> {{ obj.label }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<span
|
<span
|
||||||
v-if="library.privacy_level === 'me'"
|
v-if="library.privacy_level === 'me'"
|
||||||
class="right floated"
|
class="right floated"
|
||||||
:data-tooltip="labels.tooltips.me">
|
:data-tooltip="labels.tooltips.me">
|
||||||
<i class="small lock icon"></i>
|
<i class="small lock grey icon"></i>
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
v-else-if="library.privacy_level === 'everyone'"
|
v-else-if="library.privacy_level === 'everyone'"
|
||||||
class="right floated"
|
class="right floated"
|
||||||
:data-tooltip="labels.tooltips.everyone">
|
:data-tooltip="labels.tooltips.everyone">
|
||||||
<i class="small globe icon"></i>
|
<i class="small globe grey icon"></i>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="meta">
|
<div class="meta">
|
||||||
|
@ -120,8 +133,11 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
import ReportMixin from '@/components/mixins/Report'
|
||||||
|
import jQuery from 'jquery'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
mixins: [ReportMixin],
|
||||||
props: {
|
props: {
|
||||||
library: {type: Object, required: true},
|
library: {type: Object, required: true},
|
||||||
displayFollow: {type: Boolean, default: true},
|
displayFollow: {type: Boolean, default: true},
|
||||||
|
@ -136,6 +152,18 @@ export default {
|
||||||
latestScan: this.library.latest_scan,
|
latestScan: this.library.latest_scan,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
mounted () {
|
||||||
|
let self = this
|
||||||
|
jQuery(this.$el).find('.ui.dropdown').dropdown({
|
||||||
|
selectOnKeydown: false,
|
||||||
|
action: function (text, value, $el) {
|
||||||
|
// used ton ensure focusing the dropdown and clicking via keyboard
|
||||||
|
// works as expected
|
||||||
|
self.$refs[$el.data('ref')].click()
|
||||||
|
jQuery(self.$el).find('.ui.dropdown').dropdown('hide')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
labels () {
|
labels () {
|
||||||
let me = this.$pgettext('Content/Library/Card.Help text', 'This library is private and your approval from its owner is needed to access its content')
|
let me = this.$pgettext('Content/Library/Card.Help text', 'This library is private and your approval from its owner is needed to access its content')
|
||||||
|
|
Loading…
Reference in New Issue