See #432: display tags on artist, album and track pages

This commit is contained in:
Eliot Berriot 2019-07-16 14:04:19 +02:00
parent d2b7db2cac
commit 55cb7fc25d
No known key found for this signature in database
GPG Key ID: DD6965E2476E5C27
4 changed files with 53 additions and 3 deletions

View File

@ -13,6 +13,7 @@
<div v-html="subtitle"></div> <div v-html="subtitle"></div>
</div> </div>
</h2> </h2>
<tags-list v-if="object.tags && object.tags.length > 0" :tags="object.tags"></tags-list>
<div class="ui hidden divider"></div> <div class="ui hidden divider"></div>
<div class="header-buttons"> <div class="header-buttons">
@ -103,6 +104,7 @@ import backend from "@/audio/backend"
import PlayButton from "@/components/audio/PlayButton" import PlayButton from "@/components/audio/PlayButton"
import EmbedWizard from "@/components/audio/EmbedWizard" import EmbedWizard from "@/components/audio/EmbedWizard"
import Modal from '@/components/semantic/Modal' import Modal from '@/components/semantic/Modal'
import TagsList from "@/components/tags/List"
const FETCH_URL = "albums/" const FETCH_URL = "albums/"
@ -123,7 +125,8 @@ export default {
components: { components: {
PlayButton, PlayButton,
EmbedWizard, EmbedWizard,
Modal Modal,
TagsList,
}, },
data() { data() {
return { return {

View File

@ -21,6 +21,7 @@
</div> </div>
</div> </div>
</h2> </h2>
<tags-list v-if="object.tags && object.tags.length > 0" :tags="object.tags"></tags-list>
<div class="ui hidden divider"></div> <div class="ui hidden divider"></div>
<div class="header-buttons"> <div class="header-buttons">
<div class="ui buttons"> <div class="ui buttons">
@ -123,17 +124,20 @@ import PlayButton from "@/components/audio/PlayButton"
import EmbedWizard from "@/components/audio/EmbedWizard" import EmbedWizard from "@/components/audio/EmbedWizard"
import Modal from '@/components/semantic/Modal' import Modal from '@/components/semantic/Modal'
import RadioButton from "@/components/radios/Button" import RadioButton from "@/components/radios/Button"
import TagsList from "@/components/tags/List"
const FETCH_URL = "albums/" const FETCH_URL = "albums/"
export default { export default {
props: ["id"], props: ["id"],
components: { components: {
PlayButton, PlayButton,
EmbedWizard, EmbedWizard,
Modal, Modal,
RadioButton RadioButton,
TagsList,
}, },
data() { data() {
return { return {

View File

@ -17,6 +17,8 @@
<div class="sub header" v-html="subtitle"></div> <div class="sub header" v-html="subtitle"></div>
</div> </div>
</h2> </h2>
<tags-list v-if="track.tags && track.tags.length > 0" :tags="track.tags"></tags-list>
<div class="ui hidden divider"></div>
<div class="header-buttons"> <div class="header-buttons">
<div class="ui buttons"> <div class="ui buttons">
<play-button class="orange" :track="track"> <play-button class="orange" :track="track">
@ -121,6 +123,7 @@ import TrackFavoriteIcon from "@/components/favorites/TrackFavoriteIcon"
import TrackPlaylistIcon from "@/components/playlists/TrackPlaylistIcon" import TrackPlaylistIcon from "@/components/playlists/TrackPlaylistIcon"
import Modal from '@/components/semantic/Modal' import Modal from '@/components/semantic/Modal'
import EmbedWizard from "@/components/audio/EmbedWizard" import EmbedWizard from "@/components/audio/EmbedWizard"
import TagsList from "@/components/tags/List"
const FETCH_URL = "tracks/" const FETCH_URL = "tracks/"
@ -131,7 +134,8 @@ export default {
TrackPlaylistIcon, TrackPlaylistIcon,
TrackFavoriteIcon, TrackFavoriteIcon,
Modal, Modal,
EmbedWizard EmbedWizard,
TagsList,
}, },
data() { data() {
return { return {

View File

@ -0,0 +1,39 @@
<template>
<div>
<router-link
:to="{name: 'library.tags.detail', params: {id: tag}}"
class="ui circular hashtag label"
v-for="tag in toDisplay"
:key="tag">
#{{ tag }}
</router-link>
<div role="button" @click.prevent="honorLimit = false" class="ui circular inverted teal label" v-if="toDisplay.length < tags.length">
<translate translate-context="Content/*/Button/Label/Verb" :translate-params="{count: tags.length - toDisplay.length}" :translate-n="tags.length - toDisplay.length" translate-plural="Show %{ count } more tags">Show 1 more tag</translate>
</div>
</div>
</template>
<script>
export default {
props: ['tags'],
data () {
return {
limit: 5,
honorLimit: true,
}
},
computed: {
toDisplay () {
if (!this.honorLimit) {
return this.tags
}
return (this.tags || []).slice(0, this.limit)
}
}
}
</script>
<style lang="scss" scoped>
.ui.circular.label {
padding-left: 1em !important;
padding-right: 1em !important;
}
</style>