From e5d879f5937cc341dd9e636007da671d4fc26ca0 Mon Sep 17 00:00:00 2001 From: konrad Date: Fri, 10 Nov 2017 12:12:55 +0100 Subject: [PATCH] Added author display to books list --- frontend/src/components/Books.vue | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/Books.vue b/frontend/src/components/Books.vue index 1591372..895cf0b 100644 --- a/frontend/src/components/Books.vue +++ b/frontend/src/components/Books.vue @@ -8,7 +8,7 @@
@@ -36,6 +36,9 @@ }" > +
+ Viewing {{$refs.paginator.pageItemsCount}} results +
@@ -53,7 +56,7 @@ export default { booksTitle: 'Books Overview', books: [], searchQuery: '', - gridColumns: ['Title', 'ISBN', 'Year', 'Price', 'Status', 'Publisher'], + gridColumns: ['Title', 'ISBN', 'Year', 'Price', 'Author', 'Publisher', 'Status'], loading: false, paginate: ['books'] } @@ -92,8 +95,18 @@ export default { ISBN: bs[b].Isbn, Year: bs[b].Year, Price: bs[b].Price + '€', - Status: bs[b].Status, - Publisher: bs[b].PublisherFull.Name + Author: '', + Publisher: bs[b].PublisherFull.Name, + Status: bs[b].Status + } + + // Get all authors and concat them into one singe string + let authors = bs[b].Authors + for (const au in authors) { + this.books[i].Author += authors[au].Forename + ' ' + authors[au].Lastname + if (authors.length > au + 1) { + this.books[i].Author += ', ' + } } i++ }