Commit 105687bd authored by schneider210's avatar schneider210

Merge branch '#1-update-panels' into 'develop'

#1 update panels

Closes #1

See merge request !13
parents 8a8c7150 2986be50
Pipeline #115750 passed with stages
in 2 minutes
{
"textapi":"0.0.3",
"type":"page",
"language":[
"ger"
],
"content":"api/items/1/content.html",
"content_type":"text/html",
"image": {
"id":"api/test-image.png"
}
}
{
"textapi": "0.0.3",
"title": [{
"title": "The Example Collection",
"type": "main"
"title": [
{
"title": "The Example Collection",
"type": "main"
},
{
"title": "sampledata",
"type": "sub"
}],
}
],
"collector": {
"role": "collector",
"name": "Max Mustermann",
......@@ -15,7 +17,7 @@
"base": "https://d-nb.info/gnd/",
"id": "1143543866",
"type": "GND"
}
}
},
"description": "This collection is prepared for testing purposes.",
"sequence": [
......
{
"textapi":"0.0.3",
"type":"page",
"language":[
"textapi": "0.0.3",
"type": "page",
"language": [
"ger"
],
"content":"api/sampledata/document1/1/latest/content.html",
"content_type":"text/html",
"content": "api/sampledata/document1/1/latest/content.html",
"content_type": "text/html",
"image": {
"id":"api/test-image-text.png"
"id": "api/test-image-text.png"
}
}
{
"textapi":"0.0.3",
"type":"page",
"language":[
"textapi": "0.0.3",
"type": "page",
"language": [
"ger"
],
"content":"api/sampledata/document1/2/latest/content.html",
"content_type":"text/html",
"content": "api/sampledata/document1/2/latest/content.html",
"content_type": "text/html",
"image": {
"id":"api/test-image.png"
"id": "api/test-image.png"
}
}
{
"textapi":"0.0.3",
"id":"https://pages.gwdg.de/subugoe/emo/viewer/api/manifest.json",
"label":"Testdata Manifest 001",
"metadata":{
"Project":"EMO Viewer Project @ SUB Göttingen",
"Datum":"01.01.2001"
},
"actor": {
"role": "author",
"name": "Max Mustermann",
"idref": {
"base": "https://d-nb.info/gnd/",
"id": "1143543866",
"type": "GND"}
"textapi": "0.0.3",
"id": "https://pages.gwdg.de/subugoe/emo/viewer/api/manifest.json",
"label": "Testdata Manifest 001",
"metadata": {
"Project": "EMO Viewer Project @ SUB Göttingen",
"Datum": "01.01.2001"
},
"actor": {
"role": "recepient",
"name": "Martin Luther",
"idref": {
"base": "https://d-nb.info/gnd/",
"id": "118575449",
"type": "GND"
}
},
"sequence": [
{
"id": "api/sampledata/document1/1/latest/item.json",
"type": "item"
},
"actor": {
"role": "recepient",
"name": "Martin Luther",
"idref": {
"base": "https://d-nb.info/gnd/",
"id": "118575449",
"type": "GND"
}
},
"sequence":[
{
"id":"api/sampledata/document1/1/latest/item.json",
"type":"item"
},
{
"id":"api/sampledata/document1/2/latest/item.json",
"type":"item"
}
],
"support":[
{
"type":"css",
"mime":"text/css",
"url":"api/support.css"
}
],
"license":[
{"id": "CC-BY-NC-SA-4.0"}
]
{
"id": "api/sampledata/document1/2/latest/item.json",
"type": "item"
}
],
"support": [
{
"type": "css",
"mime": "text/css",
"url": "api/support.css"
}
],
"license": [
{
"id": "CC-BY-NC-SA-4.0"
}
]
}
{
"textapi":"0.0.3",
"type":"page",
"language":[
"textapi": "0.0.3",
"type": "page",
"language": [
"ger"
],
"content":"api/sampledata/document2/3/latest/content.html",
"content_type":"text/html",
"content": "api/sampledata/document2/3/latest/content.html",
"content_type": "text/html",
"image": {
"id":"api/test-image-text.png"
"id": "api/test-image-text.png"
}
}
{
"textapi":"0.0.3",
"type":"page",
"language":[
"textapi": "0.0.3",
"type": "page",
"language": [
"ger"
],
"content":"api/sampledata/document2/4/latest/content.html",
"content_type":"text/html"
"content": "api/sampledata/document2/4/latest/content.html",
"content_type": "text/html"
}
{
"textapi":"0.0.3",
"id":"https://pages.gwdg.de/subugoe/emo/viewer/api/manifest.json",
"label":"Testdata Manifest 002",
"metadata":{
"Project":"EMO Viewer Project @ SUB Göttingen",
"Datum":"02.02.2020"
},
"sequence":[
{
"id":"api/sampledata/document2/3/latest/item.json",
"type":"item"
},
{
"id":"api/sampledata/document2/4/latest/item.json",
"type":"item"
}
],
"support":[
{
"type":"css",
"mime":"text/css",
"url":"api/support.css"
}
],
"license":[
{"id": "CC-BY-NC-SA-4.0"}
]
"textapi": "0.0.3",
"id": "https://pages.gwdg.de/subugoe/emo/viewer/api/manifest.json",
"label": "Testdata Manifest 002 Briefwechsel",
"metadata": {
"Project": "EMO Viewer Project @ SUB Göttingen",
"Datum": "02.02.2002"
},
"actor": {
"role": "author",
"name": "Wilhelm Weber",
"idref": {
"base": "https://d-nb.info/gnd/",
"id": "1143543866",
"type": "GND"
}
},
"sequence": [
{
"id": "api/sampledata/document2/3/latest/item.json",
"type": "item"
},
{
"id": "api/sampledata/document2/4/latest/item.json",
"type": "item"
}
],
"support": [
{
"type": "css",
"mime": "text/css",
"url": "api/support.css"
}
],
"license": [
{
"id": "CC-BY-NC-SA-4.0"
}
]
}
{
"textapi":"0.0.3",
"type":"page",
"language":[
"textapi": "0.0.3",
"type": "page",
"language": [
"ger"
],
"content":"api/sampledata/document3/5/latest/content.html",
"content_type":"text/html",
"content": "api/sampledata/document3/5/latest/content.html",
"content_type": "text/html",
"image": {
"id":"api/test-image-text.png"
"id": "api/test-image-text.png"
}
}
{
"textapi":"0.0.2",
"title":{
"title":"Full Text made available via Text-API.",
"type":"main"
"textapi": "0.0.2",
"title": {
"title": "Full Text made available via Text-API.",
"type": "main"
},
"type":"full",
"language":[
"type": "full",
"language": [
"ger"
],
"content":"http://dev.gfl.sub.uni-goettingen.de/emo/gfl/Z_1822-07-31_k/content",
"content_type":"text/html"
"content": "http://dev.gfl.sub.uni-goettingen.de/emo/gfl/Z_1822-07-31_k/content",
"content_type": "text/html"
}
{
"textapi":"0.0.3",
"id":"https://pages.gwdg.de/subugoe/emo/viewer/api/manifest.json",
"label":"Testdata Manifest 003",
"metadata":{
"Project":"EMO Viewer Project @ SUB Göttingen",
"Datum":"03.03.2003"
},
"actor": {
"role": "author",
"name": "Max Mustermann",
"idref": {
"base": "https://d-nb.info/gnd/",
"id": "1143543866",
"type": "GND"}
"textapi": "0.0.3",
"id": "https://pages.gwdg.de/subugoe/emo/viewer/api/manifest.json",
"label": "Testdata Manifest 003",
"metadata": {
"Project": "EMO Viewer Project @ SUB Göttingen",
"Datum": "03.03.2003"
},
"actor": {
"role": "recepient",
"name": "Theodor Fontane",
"idref": {
"base": "https://d-nb.info/gnd/",
"id": "118575449",
"type": "GND"
}
},
"sequence": [
{
"id": "api/sampledata/document3/5/latest/item.json",
"type": "item"
},
"actor": {
"role": "recepient",
"name": "Martin Luther",
"idref": {
"base": "https://d-nb.info/gnd/",
"id": "118575449",
"type": "GND"
}
},
"sequence":[
{
"id":"api/sampledata/document3/5/latest/item.json",
"type":"item"
},
{
"id":"api/sampledata/document3/full/latest/full.json",
"type":"item"
}
],
"support":[
{
"type":"css",
"mime":"text/css",
"url":"api/support.css"
}
],
"license":[
{"id": "CC-BY-NC-SA-4.0"}
]
{
"id": "api/sampledata/document3/full/latest/full.json",
"type": "item"
}
],
"support": [
{
"type": "css",
"mime": "text/css",
"url": "api/support.css"
}
],
"license": [
{
"id": "CC-BY-NC-SA-4.0"
}
]
}
<template>
<div>
<Metadata
<Metadata v-if="manifests.length > 0"
:manifests="manifests"
:collection="collection">
</Metadata>
......@@ -13,7 +14,7 @@
<Item
:key="itemurl"
:itemurl="itemurl"
:collection="collection">
:manifests="manifests">
</Item>
</div>
</template>
......@@ -32,23 +33,23 @@ export default {
},
data() {
return {
collection: [],
config: {},
itemurl: '',
itemurls: [],
manifests: [],
collection: null,
sequences: [],
};
},
methods: {
getConfig() {
const config = document.getElementById('emo-config');
this.config = JSON.parse(config.text);
this.config = JSON.parse(document.getElementById('emo-config').text);
},
getManifest(url) {
fetch(url)
.then(response => response.json())
.then((data) => {
this.collection.push(data);
this.manifests.push(data);
this.sequences.push(data.sequence);
data.sequence.forEach(seq => this.itemurls.push(seq.id));
this.itemurl = this.$route.query.emo_itemurl || data.sequence[0].id;
......@@ -56,21 +57,23 @@ export default {
this.$router.push({ query: { emo_itemurl: this.itemurl } });
});
},
getCollection() {
fetch(this.config.entrypoint)
getCollection(url) {
fetch(url)
.then(response => response.json())
.then(data => data.sequence.forEach(seq => this.getManifest(seq.id)));
.then((data) => {
this.collection = data;
data.sequence.forEach(seq => this.getManifest(seq.id));
});
},
},
created() {
this.getConfig();
if (this.config.entrypoint.match(/manifest/) !== null) {
if (this.config.entrypoint.endsWith('manifest.json')) {
this.getManifest(this.config.entrypoint);
}
if (this.config.entrypoint.match(/collection/) !== null) {
this.getCollection();
if (this.config.entrypoint.endsWith('collection.json')) {
this.getCollection(this.config.entrypoint);
}
this.itemurls.sort((a, b) => a.localeCompare(b, undefined, { numeric: true }));
......
......@@ -8,8 +8,8 @@
export default {
name: 'Content',
props: {
collection: Array,
contenturl: String,
manifests: Array,
},
data() {
return {
......@@ -31,8 +31,8 @@ export default {
},
},
created() {
if (this.collection.length) {
this.collection.forEach((manifest) => {
if (this.manifests.length) {
this.manifests.forEach((manifest) => {
if (manifest.support) {
manifest.support.map(this.getSupport);
......
......@@ -2,8 +2,7 @@
<div class="__item">
<Content v-if="item.content"
:contenturl="item.content"
:imageurl="imageurl"
:collection="collection">
:manifests="manifests">
</Content>
<OpenSeadragon v-if="imageurl"
......@@ -23,14 +22,14 @@ export default {
OpenSeadragon,
},
props: {
collection: Array,
itemurl: String,
manifests: Array,
},
data() {
return {
item: {},
contenturl: '',
imageurl: null,
item: {},
};
},
mounted() {
......@@ -38,9 +37,7 @@ export default {
.then(response => response.json())
.then((data) => {
this.item = data;
if (data.image) {
this.imageurl = data.image.id;
}
this.imageurl = data.image ? data.image.id : null;
});
},
};
......
<template>
<div class="__metadata">
<h2>Collection contains {{ collection.length }} manifests</h2>
<h3>Collection <span class="badge">{{ manifests.length }}</span></h3>
<dl>
<dt>Collector</dt>
<dd>{{ collection.collector.name }}</dd>
<dt>Title</dt>
<dd>{{ title }}</dd>
<dt>Description</dt>
<dd>{{ collection.description }}</dd>
</dl>
<table border=1>
<tbody class="__custom">
<tr v-for="(manifest, index) in collection" :key="index">
<td>{{ manifest.label }}</td>
<td v-for="(metadata, idx) in manifest.metadata" :key="idx">{{ metadata }}</td>
</tr>
</tbody>
</table>
<p></p>
<h3>Manifest <span class="badge">{{ sequenceindex + 1 }}/{{ manifests.length }}</span></h3>
<dl>
<dt>Label</dt>
<dd>{{ label }}</dd>
<dt>Recipient</dt>
<dd>{{ recipient }}</dd>
<dt>Date</dt>
<dd>{{ manifestdate }}</dd>
<dt>Project</dt>
<dd>{{ projectname }}</dd>
</dl>
</div>
</template>
......@@ -19,7 +28,35 @@
export default {
name: 'Metadata',
props: {
collection: Array,
manifests: Array,
collection: Object,
},
data() {
return {
sequenceindex: 0,
};
},
computed: {
title() {
return this.collection.title[0].title;
},
label() {
return this.manifests[this.sequenceindex].label;
},
recipient() {
return this.manifests[this.sequenceindex].actor.name;
},
manifestdate() {
return this.manifests[this.sequenceindex].metadata.Datum;
},
projectname() {
return this.manifests[this.sequenceindex].metadata.Project;
},
},
mounted() {
this.$root.$on('update-metadata', (index) => {
this.sequenceindex = index;
});
},
};
</script>
......@@ -3,32 +3,54 @@
<button
title="First item"
:disabled="page <= 0"
@click="page = 0; chapter = 0; updateItem(itemurls[page]);">&#x23EE;
@click="page = 0; chapter = 0;
updateItem(itemurls[page]);
updateMetadata(chapter);"
>&#x23EE;
</button>
<button
title="Previous manifest"
:disabled="chapter <= 0"
@click="--chapter; page = updatePage; updateItem(itemurls[page]);">&#x23EE;
@click="--chapter;
page = updatePage;
updateItem(itemurls[page]);
updateMetadata(chapter);"
>&#x23EE;
</button>
<button
title="Previous item"
:disabled="page <= 0"
@click="--page; updateItem(itemurls[page]); chapter = updateChapter">&#x2BC7;
@click="--page;
updateItem(itemurls[page]);
chapter = updateChapter;
updateMetadata(chapter);"
>&#x2BC7;
</button>
<button
title="Next item"
:disabled="page >= itemurls.length - 1"
@click="++page; updateItem(itemurls[page]); chapter = updateChapter">&#x2BC8;
@click="++page;
updateItem(itemurls[page]);
chapter = updateChapter;
updateMetadata(chapter);"
>&#x2BC8;
</button>
<button
title="Next manifest"
:disabled="chapter >= sequences.length - 1"
@click="++chapter; page = updatePage; updateItem(itemurls[page]);">&#x23ED;
@click="++chapter;
page = updatePage;
updateItem(itemurls[page]);
updateMetadata(chapter);"
>&#x23ED;
</button>
<button
title="Last item"
:disabled="page >= itemurls.length - 1"
@click="page = itemurls.length - 1; chapter = chaptercount - 1; updateItem(itemurls[page]);"
@click="page = itemurls.length - 1;
chapter = chaptercount - 1;
updateItem(itemurls[page]);
updateMetadata(chapter);"
>&#x23ED;
</button>
</div>
......@@ -51,6 +73,9 @@ export default {
updateItem() {
this.$root.$emit('update-item', this.itemurls[this.page]);
},
updateMetadata() {
this.$root.$emit('update-metadata', this.chapter);
},
},
computed: {
chaptercount() {
......@@ -95,6 +120,9 @@ export default {
this.$root.$on('update-page', (currentpage) => {
this.page = currentpage;
});
this.$root.$on('update-sequence', (currentchapter) => {
this.chapter = currentchapter;
});
},
};
</script>
<template>
<div>
<div class="__treeview">
<div v-for="(chapters, index) in sequences" :key="index"
style="white-space: pre-wrap"
@click="clicked = !clicked; selected = index;"
>{{ selected === index ? '&#x2570;' : '[+]' }} Chapter: {{ index + 1 }}
<span v-show="selected === index" v-for="pages in chapters" :key="pages.id"
style="cursor: pointer;"
:class="[ pages.id === itemurl ? 'active' : '' ]"
@click="url = pages.id; updateItem(url); updatePage(getCurrentPage);"
>&#x2570;{{ pages.id }}
<div @click="sequenceclicked = !sequenceclicked">
{{ sequenceclicked ? '[-]' : '&#x2BC8;' }} Sequence
</div>
<div style="white-space: pre-wrap"
v-show="sequenceclicked"
v-for="(items, index) in sequences" :key="index"
@click="selected = index; itemclicked = !itemclicked;"
>{{ selected === index && itemclicked ? '[-]' : '[+]' }} Item: {{ index + 1 }}
<span style="cursor: pointer;"
v-show="selected === index && itemclicked"
v-for="item in items" :key="item.id"
:class="[ item.id === itemurl ? 'active' : '' ]"
@click="url = item.id;
updateItem(url);
updateMetadata(selected);
updatePage(getCurrentPage);
updateSequence(index);"
>&#x2570;{{ item.id }}
</span>
</div>
</div>
......@@ -26,8 +36,9 @@ export default {
},
data() {
return {
clicked: false,
itemclicked: false,