1.4.4 #84
4 changed files with 33 additions and 12 deletions
|
@ -21,7 +21,7 @@ Vue.createApp({
|
||||||
showModalDelete: false,
|
showModalDelete: false,
|
||||||
showModalShare: false,
|
showModalShare: false,
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
shareLink: `${protocol}//${host}/collection/${userId}`,
|
shareLink: `/collection/${userId}`,
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
isPublicCollection,
|
isPublicCollection,
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
|
@ -67,7 +67,7 @@ Vue.createApp({
|
||||||
|
|
||||||
let url = `/api/v1/albums?page=${this.page}&limit=${this.limit}&sort=${this.sort}&order=${this.order}`;
|
let url = `/api/v1/albums?page=${this.page}&limit=${this.limit}&sort=${this.sort}&order=${this.order}`;
|
||||||
if (this.artist) {
|
if (this.artist) {
|
||||||
url += `&artists_sort=${this.formatParams(this.artist)}`;
|
url += `&artist=${this.formatParams(this.artist)}`;
|
||||||
}
|
}
|
||||||
if (this.format) {
|
if (this.format) {
|
||||||
url += `&format=${this.formatParams(this.format)}`;
|
url += `&format=${this.formatParams(this.format)}`;
|
||||||
|
@ -218,5 +218,20 @@ Vue.createApp({
|
||||||
this.toggleModalShare();
|
this.toggleModalShare();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
renderAlbumTitle(item) {
|
||||||
|
let render = '';
|
||||||
|
|
||||||
|
for ( let i = 0 ; i < item.artists.length ; i += 1 ) {
|
||||||
|
const {
|
||||||
|
name,
|
||||||
|
join,
|
||||||
|
} = item.artists[i];
|
||||||
|
render += `${name} ${join ? `${join} ` : ''}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
render += `- ${item.title}`;
|
||||||
|
|
||||||
|
return render;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}).mount("#collection");
|
}).mount("#collection");
|
|
@ -80,7 +80,7 @@ class Albums extends Pages {
|
||||||
exportFormat = "json",
|
exportFormat = "json",
|
||||||
sort = "artists_sort",
|
sort = "artists_sort",
|
||||||
order = "asc",
|
order = "asc",
|
||||||
artists_sort,
|
artist,
|
||||||
format,
|
format,
|
||||||
year,
|
year,
|
||||||
genre,
|
genre,
|
||||||
|
@ -92,8 +92,8 @@ class Albums extends Pages {
|
||||||
|
|
||||||
const where = {};
|
const where = {};
|
||||||
|
|
||||||
if (artists_sort) {
|
if (artist) {
|
||||||
where.artists_sort = artists_sort;
|
where["artists.name"] = artist;
|
||||||
}
|
}
|
||||||
if (format) {
|
if (format) {
|
||||||
where["formats.name"] = format;
|
where["formats.name"] = format;
|
||||||
|
@ -236,7 +236,7 @@ class Albums extends Pages {
|
||||||
*/
|
*/
|
||||||
async loadMyCollection() {
|
async loadMyCollection() {
|
||||||
const artists = await Albums.getAllDistincts(
|
const artists = await Albums.getAllDistincts(
|
||||||
"artists_sort",
|
"artists.name",
|
||||||
this.req.user._id
|
this.req.user._id
|
||||||
);
|
);
|
||||||
const formats = await Albums.getAllDistincts(
|
const formats = await Albums.getAllDistincts(
|
||||||
|
@ -301,7 +301,7 @@ class Albums extends Pages {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const artists = await Albums.getAllDistincts("artists_sort", userId);
|
const artists = await Albums.getAllDistincts("artists.name", userId);
|
||||||
const formats = await Albums.getAllDistincts("formats.name", userId);
|
const formats = await Albums.getAllDistincts("formats.name", userId);
|
||||||
const years = await Albums.getAllDistincts("year", userId);
|
const years = await Albums.getAllDistincts("year", userId);
|
||||||
const genres = await Albums.getAllDistincts("genres", userId);
|
const genres = await Albums.getAllDistincts("genres", userId);
|
||||||
|
|
|
@ -11,9 +11,11 @@
|
||||||
} %>
|
} %>
|
||||||
</h1>
|
</h1>
|
||||||
<% if ( pageType === 'private' ) { %>
|
<% if ( pageType === 'private' ) { %>
|
||||||
|
<div>
|
||||||
<a :href="shareLink" v-if="isPublicCollection" target="_blank">
|
<a :href="shareLink" v-if="isPublicCollection" target="_blank">
|
||||||
<i class="icon-share"></i> Voir ma collection partagée
|
<i class="icon-share"></i> Voir ma collection partagée
|
||||||
</a>
|
</a>
|
||||||
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
<%- include('../components/filters/index') %>
|
<%- include('../components/filters/index') %>
|
||||||
|
@ -28,7 +30,7 @@
|
||||||
<div class="item" v-if="!loading" v-for="item in items">
|
<div class="item" v-if="!loading" v-for="item in items">
|
||||||
<span class="title">
|
<span class="title">
|
||||||
<% if ( pageType === 'private' ) { %>
|
<% if ( pageType === 'private' ) { %>
|
||||||
<a :href="'/ma-collection/' + item._id">{{ item.artists_sort}} - {{ item.title }}</a>
|
<a :href="'/ma-collection/' + item._id">{{ renderAlbumTitle(item) }}</a>
|
||||||
<i class="icon-trash" @click="showConfirmDelete(item._id)"></i>
|
<i class="icon-trash" @click="showConfirmDelete(item._id)"></i>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
{{ item.artists_sort}} - {{ item.title }}
|
{{ item.artists_sort}} - {{ item.title }}
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
<main class="layout-maxed ma-collection-details" id="ma-collection-details" v-cloak @keyup="changeImage">
|
<main class="layout-maxed ma-collection-details" id="ma-collection-details" v-cloak @keyup="changeImage">
|
||||||
|
|
||||||
<h1>
|
<h1>
|
||||||
<a :href="`/ma-collection?page=1&limit=16&sort=year&order=asc&artists_sort=${item.artists_sort}`">{{item.artists_sort}}</a> - {{item.title}}
|
<template v-for="artist in item.artists">
|
||||||
|
<a :href="`/ma-collection?page=1&limit=16&sort=year&order=asc&artist=${artist.name}`">{{artist.name}}</a>
|
||||||
|
<template v-if="artist.join"> {{artist.join}} </template>
|
||||||
|
</template>
|
||||||
|
- {{item.title}}
|
||||||
<i class="icon-trash" title="Supprimer cette fiche" @click="showConfirmDelete()"></i>
|
<i class="icon-trash" title="Supprimer cette fiche" @click="showConfirmDelete()"></i>
|
||||||
<i class="icon-refresh" title="Mettre à jour les données de cette fiche" @click="updateItem()"></i>
|
<i class="icon-refresh" title="Mettre à jour les données de cette fiche" @click="updateItem()"></i>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
Loading…
Reference in a new issue