Albums: Use album slug in URL #15
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
parent
1213ee5f2a
commit
6f3593ec9a
5 changed files with 9 additions and 4 deletions
|
@ -90,7 +90,7 @@
|
|||
</v-list-tile>
|
||||
|
||||
<v-list-tile v-for="(album, index) in config.albums"
|
||||
:key="index" :to="{ name: 'albums_view', params: { id: album.ID } }">
|
||||
:key="index" :to="{ name: 'albums_view', params: { id: album.ID, slug: album.AlbumSlug } }">
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title v-if="album.AlbumName">{{ album.AlbumName }}</v-list-tile-title>
|
||||
<v-list-tile-title v-else>Untitled</v-list-tile-title>
|
||||
|
|
|
@ -156,7 +156,7 @@
|
|||
},
|
||||
openAlbum(index) {
|
||||
const album = this.results[index];
|
||||
this.$router.push({name: "albums_view", params: {id: album.ID}});
|
||||
this.$router.push({name: "albums_view", params: {id: album.ID, slug: album.AlbumSlug}});
|
||||
},
|
||||
loadMore() {
|
||||
if (this.scrollDisabled) return;
|
||||
|
|
|
@ -37,7 +37,7 @@ export default [
|
|||
},
|
||||
{
|
||||
name: "albums_view",
|
||||
path: "/albums/:id",
|
||||
path: "/albums/:id/:slug",
|
||||
component: AlbumsView,
|
||||
meta: {area: "View Album"},
|
||||
},
|
||||
|
|
|
@ -98,7 +98,7 @@ func UpdateAlbum(router *gin.RouterGroup, conf *config.Config) {
|
|||
return
|
||||
}
|
||||
|
||||
m.AlbumName = params.AlbumName
|
||||
m.Rename(params.AlbumName)
|
||||
conf.Db().Save(&m)
|
||||
|
||||
event.Publish("config.updated", event.Data(conf.ClientConfig()))
|
||||
|
|
|
@ -45,3 +45,8 @@ func NewAlbum(albumName string) *Album {
|
|||
|
||||
return result
|
||||
}
|
||||
|
||||
func (m *Album) Rename(albumName string) {
|
||||
m.AlbumName = strings.TrimSpace(albumName)
|
||||
m.AlbumSlug = slug.Make(m.AlbumName)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue