Add descriptions

This commit is contained in:
2020-10-03 18:00:48 +03:00
parent f1045fa2f0
commit 82d3366b80
5 changed files with 33 additions and 3 deletions

View File

@@ -1 +1 @@
[{"name":"Album 1 name","description":"Album 2 description","protected":false,"coverFileName":"IMG_20200811_060850.jpg","folderName":"album_1","files":["IMG_20200811_060850.jpg","IMG_20200811_074445.jpg","IMG_20200811_080037.jpg","IMG_20200811_081746.jpg","IMG_20200811_084017.jpg"],"files_360":["photo.jpg"]}] [{"name":"Album 1 name","description":"Album 2 description","protected":false,"coverFileName":"IMG_20200811_060850.jpg","photoDescription":{"IMG_20200811_060850.jpg":"Description 1","IMG_20200811_074445.jpg":"Description 2"},"folderName":"album_1","files":["IMG_20200811_060850.jpg","IMG_20200811_074445.jpg","IMG_20200811_080037.jpg","IMG_20200811_081746.jpg","IMG_20200811_084017.jpg"],"files_360":["photo.jpg"]}]

View File

@@ -3,3 +3,7 @@ description: Album 2 description
protected: false protected: false
coverFileName: 'IMG_20200811_060850.jpg' coverFileName: 'IMG_20200811_060850.jpg'
photoDescription:
IMG_20200811_060850.jpg: 'Description 1'
IMG_20200811_074445.jpg: 'Description 2'

View File

@@ -59,7 +59,17 @@ function processAlbum(folderName: string) {
} else { } else {
console.error(red(`Error: File ${albumPath}/album.yml does not contains "${item}" key!`)); console.error(red(`Error: File ${albumPath}/album.yml does not contains "${item}" key!`));
} }
}) });
if (parsedData['photoDescription']) {
Object.keys(parsedData['photoDescription']).forEach(item => {
if (!photos.includes(item)) {
console.warn(yellow(`Warning: Description for ${albumPath}/photos/${item} , but it doesn't exist!`));
}
});
config['photoDescription'] = parsedData['photoDescription'];
}
} }
} else { } else {
console.error(red(`Error: File ${albumPath}/album.yml does not exists!`)); console.error(red(`Error: File ${albumPath}/album.yml does not exists!`));

View File

@@ -5,7 +5,11 @@ export interface IAlbum {
protected: boolean; protected: boolean;
folderName: string; folderName: string;
files: string[]; files: string[];
files_360: string[];
photoDescription: {[key: string]: string};
} }
export default class AlbumsState { export default class AlbumsState {

View File

@@ -81,7 +81,13 @@ export default class AlbumPage extends Vue {
get images() { get images() {
return this.album!.files return this.album!.files
.map(item => `/pictures/albums/${this.album!.folderName}/photos/${item}`); .map((item, index) => {
return {
id: `${this.album!.folderName}/${item}`,
href: `/pictures/albums/${this.album!.folderName}/photos/${item}`,
description: this.album!.photoDescription[item] || ' ',
};
});
} }
updateFiles() { updateFiles() {
@@ -145,4 +151,10 @@ export default class AlbumPage extends Vue {
background: none; background: none;
color: white!important; color: white!important;
} }
.blueimp-gallery-controls > .description {
margin-top: calc(100vh - 5em);
width: 100vw;
text-align: center;
}
</style> </style>