diff --git a/src/components/Autocomplete.vue b/src/components/Autocomplete.vue index 5c44bc78c..85e8f31fb 100644 --- a/src/components/Autocomplete.vue +++ b/src/components/Autocomplete.vue @@ -96,7 +96,7 @@ export default { this.suggestion = false; this.selected = false; this.showSuggestions = false; - this.query = ''; + this.q = ''; }, select(suggestion) { this.selected = suggestion; diff --git a/src/components/IssuePage.vue b/src/components/IssuePage.vue index 31d86c75b..86395394c 100644 --- a/src/components/IssuePage.vue +++ b/src/components/IssuePage.vue @@ -1,18 +1,15 @@ - - - - -{ - "en": { - "placeholder": "filter or create new collection", - "create_new": "Create New", - "manage_collections": "Manage my Collections", - "created": "Created:", - "last_edited": "Last edited", - "items": "items" - }, - "de": { - "placeholder": "Filtern oder neue Sammlung erstellen", - "create_new": "Sammlung erstellen", - "manage_collections": "Sammlungen verwalten", - "created": "Erstellt:", - "last_edited": "Zuletzt bearbeitet", - "items": " Artikel" - } -} - diff --git a/src/components/modules/CollectionAddToList.vue b/src/components/modules/CollectionAddToList.vue new file mode 100644 index 000000000..a50d72e90 --- /dev/null +++ b/src/components/modules/CollectionAddToList.vue @@ -0,0 +1,235 @@ + + + + + + + +{ + "en": { + "placeholder": "filter or create new collection", + "create_new": "Create New", + "manage_collections": "Manage my Collections", + "created": "Created:", + "last_edited": "Last edited", + "items": "items" + }, + "de": { + "placeholder": "Filtern oder neue Sammlung erstellen", + "create_new": "Sammlung erstellen", + "manage_collections": "Sammlungen verwalten", + "created": "Erstellt:", + "last_edited": "Zuletzt bearbeitet", + "items": " Artikel" + } +} + diff --git a/src/components/modules/TableOfContents.vue b/src/components/modules/TableOfContents.vue index 026cbd44e..96fa7eeae 100644 --- a/src/components/modules/TableOfContents.vue +++ b/src/components/modules/TableOfContents.vue @@ -1,20 +1,32 @@ @@ -80,43 +92,35 @@ export default { @import "impresso-theme/src/scss/variables.sass"; #TableOfContents{ - .pagenumber { - font-size: 1.4em; - color: lighten($clr-primary, 75); - } - - ul.page { - list-style: none; + .page{ font-size: smaller; - margin-bottom: 0; - .article { - a{ - text-decoration: none; - display: flex; - flex-direction: row; - align-items: stretch; - .info{ - flex: auto; - .title{ - font-size: 1.2em; - font-weight: bold; - } - .excerpt{ - color: lighten($clr-primary, 25); - } - } - .page{ - flex: min-content; - font-size: 1.2em; + .pagenumber{ + text-align: center; + } + + .article{ + &.active{ + a{ + background: lighten($clr-primary, 88); font-weight: bold; - color: lighten($clr-primary, 75); } } - &.active{ - a { - background: lighten($clr-primary, 88); + a{ + text-decoration: none; + display: block; + .title{ font-weight: bold; } + .excerpt{ + color: lighten($clr-primary, 25); + } + .images{ + width:80px; + float:left; + .image{ + + } + } } } } diff --git a/src/store/Issue.js b/src/store/Issue.js index 62799e945..3afa123c3 100644 --- a/src/store/Issue.js +++ b/src/store/Issue.js @@ -70,7 +70,7 @@ export default { }); }, LOAD_TABLE_OF_CONTENTS(context, uid) { - return new Promise((resolve, reject) => { + const tocPromise = new Promise((resolve, reject) => { const q = { query: { filters: [{ @@ -120,9 +120,8 @@ export default { reject(error); }); }); - }, - LOAD_TABLE_OF_IMAGES(context, uid) { - return new Promise((resolve, reject) => { + + const toiPromise = new Promise((resolve, reject) => { const query = { filters: [{ type: 'issue', @@ -131,41 +130,19 @@ export default { limit: 500, }; - services.images.find({ query }).then((response) => { - const issue = new Issue(); - const articles = response.data.map(image => new Article({ - ...image, - })); - - articles.forEach((article) => { - article.pages.forEach((p1) => { - const page = issue.pages.find(p2 => p1.uid === p2.uid); - if (!page) { - issue.pages.push(new Page({ - ...p1, - articles: [article], - })); - } else { - page.articles.push(article); - } - }); - }); - - // sort by page number - issue.pages.sort((pageA, pageB) => { - if (pageA.num < pageB.num) { - return -1; - } - if (pageA.num > pageB.num) { - return 1; - } + services.images.find({ query }).then(resolve, reject); + }); - return 0; - }); - resolve(issue); - }, (error) => { - reject(error); - }); + return Promise.all([tocPromise, toiPromise]).then((values) => { + // merge the table of images into the table of articles + for (let i = 0; i < values[0].pages.length; i += 1) { + for (let j = 0; j < values[0].pages[i].articles.length; j += 1) { + values[0].pages[i].articles[j].images = + values[1].data.filter(image => image.article === values[0].pages[i].articles[j].uid) + .map(image => new Article(image)); + } + } + return values[0]; }); }, },