Commit ffcb7ce5 authored by schneider210's avatar schneider210
Browse files

feat: filter contenturls according to a matching mime-type "application/xhtml+xml" and "text/html"

parent 9313da55
Pipeline #176276 passed with stages
in 2 minutes and 45 seconds
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<router-view <router-view
:collection="collection" :collection="collection"
:config="config" :config="config"
:contenturls="contenturls"
:fontsize="fontsize" :fontsize="fontsize"
:imageurl="imageurl" :imageurl="imageurl"
:item="item" :item="item"
...@@ -23,8 +24,6 @@ ...@@ -23,8 +24,6 @@
:manifests="manifests" :manifests="manifests"
:panels="panels" :panels="panels"
:request="request" :request="request"
:transcription="transcription"
:transliteration="transliteration"
:tree="tree" :tree="tree"
/> />
</q-page-container> </q-page-container>
...@@ -55,6 +54,7 @@ export default { ...@@ -55,6 +54,7 @@ export default {
collection: {}, collection: {},
collectiontitle: '', collectiontitle: '',
config: {}, config: {},
contenturls: [],
fontsize: 14, fontsize: 14,
imageurl: '', imageurl: '',
isCollection: false, isCollection: false,
...@@ -62,8 +62,6 @@ export default { ...@@ -62,8 +62,6 @@ export default {
itemurl: '', itemurl: '',
itemurls: [], itemurls: [],
manifests: [], manifests: [],
transcription: '',
transliteration: '',
tree: [], tree: [],
}; };
}, },
...@@ -167,16 +165,24 @@ export default { ...@@ -167,16 +165,24 @@ export default {
this.config = JSON.parse(document.getElementById('tido-config').text); this.config = JSON.parse(document.getElementById('tido-config').text);
}, },
/** /**
* filter all urls that match either of the MIME types "application/xhtml+xml" and "text/html"
* caller: *getItemData()* * caller: *getItemData()*
* *
* @param string array * @param string array
* *
* @return array * @return array
*/ */
getContent(content) { getContentUrl(content) {
return [ const urls = [];
content[0].url, content[1].url,
]; if (Array.isArray(content) && content.length) {
content.forEach((c) => {
if (c.type.match(/(application\/xhtml\+xml|text\/html)/)) {
urls.push(c.url);
}
});
}
return urls;
}, },
/** /**
* fetch all data provided on 'item level' * fetch all data provided on 'item level'
...@@ -189,8 +195,7 @@ export default { ...@@ -189,8 +195,7 @@ export default {
.then((data) => { .then((data) => {
this.item = data; this.item = data;
[this.transcription, this.transliteration] = this.getContent(data.content); this.contenturls = this.getContentUrl(data.content);
this.imageurl = data.image.id || ''; this.imageurl = data.image.id || '';
}); });
}, },
......
...@@ -57,6 +57,10 @@ export default { ...@@ -57,6 +57,10 @@ export default {
type: Object, type: Object,
default: () => {}, default: () => {},
}, },
contenturls: {
type: Array,
default: () => [],
},
fontsize: { fontsize: {
type: Number, type: Number,
default: () => 14, default: () => 14,
...@@ -90,7 +94,7 @@ export default { ...@@ -90,7 +94,7 @@ export default {
this.fasSearchPlus = fasSearchPlus; this.fasSearchPlus = fasSearchPlus;
this.fasSearchMinus = fasSearchMinus; this.fasSearchMinus = fasSearchMinus;
this.content = await this.request(this.transcription, 'text').then((data) => data); this.content = await this.request(this.contenturls[0], 'text').then((data) => data);
}, },
mounted() { mounted() {
this.$refs.contentsize.style.fontSize = `${this.fontsize}px`; this.$refs.contentsize.style.fontSize = `${this.fontsize}px`;
......
...@@ -94,6 +94,10 @@ export default { ...@@ -94,6 +94,10 @@ export default {
type: Object, type: Object,
default: () => {}, default: () => {},
}, },
contenturls: {
type: Array,
default: () => [],
},
fontsize: { fontsize: {
type: Number, type: Number,
default: () => 14, default: () => 14,
...@@ -122,14 +126,6 @@ export default { ...@@ -122,14 +126,6 @@ export default {
type: Function, type: Function,
default: () => null, default: () => null,
}, },
transcription: {
type: String,
default: () => '',
},
transliteration: {
type: String,
default: () => '',
},
tree: { tree: {
type: Array, type: Array,
default: () => [], default: () => [],
...@@ -137,10 +133,10 @@ export default { ...@@ -137,10 +133,10 @@ export default {
}, },
computed: { computed: {
ready() { ready() {
return this.manifests.length && this.tree.length; return this.manifests.length && this.tree.length && this.contenturls.length;
}, },
keys() { keys() {
return { 3: this.imageurl, 4: this.transcription }; return { 3: this.imageurl, 4: this.contenturls[0] };
}, },
}, },
}; };
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment