Skip to content
Snippets Groups Projects
Verified Commit eefb500f authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Fix #725: Merged artist/album buttons with title text on artist and album pages

parent a82fb45c
No related branches found
No related tags found
No related merge requests found
Merged artist/album buttons with title text on artist and album pages (#725)
...@@ -93,6 +93,18 @@ export default { ...@@ -93,6 +93,18 @@ export default {
handler: this.incrementNotificationCountInSidebar handler: this.incrementNotificationCountInSidebar
}) })
}, },
mounted () {
let self = this
// slight hack to allow use to have internal links in <translate> tags
// while preserving router behaviour
document.documentElement.addEventListener('click', function (event) {
if (!event.target.matches('a.internal')) return;
self.$router.push(event.target.getAttribute('href'))
event.preventDefault();
}, false);
},
destroyed () { destroyed () {
this.$store.commit('ui/removeWebsocketEventHandler', { this.$store.commit('ui/removeWebsocketEventHandler', {
eventName: 'inbox.item_added', eventName: 'inbox.item_added',
......
...@@ -12,11 +12,6 @@ ...@@ -12,11 +12,6 @@
{{ album.title }} {{ album.title }}
<div v-html="subtitle"></div> <div v-html="subtitle"></div>
</div> </div>
<div class="ui buttons">
<router-link class="ui button" :to="{name: 'library.artists.detail', params: {id: album.artist.id }}">
<translate :translate-context="'Content/*/Button.Label/Name'">Artist page</translate>
</router-link>
</div>
</h2> </h2>
<div class="ui hidden divider"></div> <div class="ui hidden divider"></div>
<play-button class="orange" :tracks="album.tracks"> <play-button class="orange" :tracks="album.tracks">
...@@ -181,8 +176,9 @@ export default { ...@@ -181,8 +176,9 @@ export default {
) )
}, },
subtitle () { subtitle () {
let msg = this.$npgettext('Content/Album/Header.Title', 'Album containing %{ count } track, by %{ artist }', 'Album containing %{ count } tracks, by %{ artist }', this.album.tracks.length) let route = this.$router.resolve({name: 'library.artists.detail', params: {id: this.album.artist.id }})
return this.$gettextInterpolate(msg, {count: this.album.tracks.length, artist: this.album.artist.name}) let msg = this.$npgettext('Content/Album/Header.Title', 'Album containing %{ count } track, by <a class="internal" href="%{ artistUrl }">%{ artist }</a>', 'Album containing %{ count } tracks, by <a class="internal" href="%{ artistUrl }">%{ artist }</a>', this.album.tracks.length)
return this.$gettextInterpolate(msg, {count: this.album.tracks.length, artist: this.album.artist.name, artistUrl: route.location.path})
} }
}, },
watch: { watch: {
......
...@@ -15,24 +15,9 @@ ...@@ -15,24 +15,9 @@
<div class="content"> <div class="content">
{{ track.title }} {{ track.title }}
<div class="sub header"> <div class="sub header">
<translate :translate-context="'Content/Track/Paragraph'" <div :translate-context="'Content/Track/Paragraph'"
:translate-params="{album: track.album.title, artist: track.artist.name}" v-translate="{album: track.album.title, artist: track.artist.name, albumUrl: albumUrl, artistUrl: artistUrl}"
>From album %{ album } by %{ artist }</translate> >From album <a class="internal" href="%{ albumUrl }">%{ album }</a> by <a class="internal" href="%{ artistUrl }">%{ artist }</a></div>
</div>
<br>
<div class="ui basic buttons">
<router-link
class="ui button"
:to="{name: 'library.albums.detail', params: {id: track.album.id }}"
>
<translate :translate-context="'Content/Track/Button.Label'">Album page</translate>
</router-link>
<router-link
class="ui button"
:to="{name: 'library.artists.detail', params: {id: track.artist.id }}"
>
<translate :translate-context="'Content/Track/Button.Label'">Artist page</translate>
</router-link>
</div> </div>
</div> </div>
</h2> </h2>
...@@ -299,6 +284,14 @@ export default { ...@@ -299,6 +284,14 @@ export default {
cover() { cover() {
return null return null
}, },
albumUrl () {
let route = this.$router.resolve({name: 'library.albums.detail', params: {id: this.track.album.id }})
return route.location.path
},
artistUrl () {
let route = this.$router.resolve({name: 'library.artists.detail', params: {id: this.track.artist.id }})
return route.location.path
},
headerStyle() { headerStyle() {
if (!this.cover) { if (!this.cover) {
return "" return ""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment