-
@@ -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];
});
},
},