Commit 21df73e1 authored by dindigala's avatar dindigala
Browse files

feat: enable TIDO to display more (+n) text types as tabs

parent 5e7f3198
Pipeline #183107 passed with stages
in 2 minutes and 42 seconds
......@@ -16,6 +16,7 @@
<router-view
:collection="collection"
:config="config"
:contenttypes="contentTypes"
:contenturls="contenturls"
:fontsize="fontsize"
:imageurl="imageurl"
......@@ -54,6 +55,7 @@ export default {
collection: {},
collectiontitle: '',
config: {},
contentTypes: [],
contenturls: [],
fontsize: 14,
imageurl: '',
......@@ -176,9 +178,13 @@ export default {
const urls = [];
if (Array.isArray(content) && content.length) {
this.contentTypes = [];
content.forEach((c) => {
if (c.type.match(/(application\/xhtml\+xml|text\/html)/)) {
urls.push(c.url);
this.contentTypes.push(c.type.split('type=')[1]);
}
});
}
......
<template>
<div>
<q-card>
<q-tabs
v-model="activeTab"
dense
class="text-grey q-mb-lg"
active-color="$q.dark.isActive ? 'white' : 'accent'"
indicator-color="$q.dark.isActive ? 'white' : 'accent'"
align="justify"
narrow-indicator
>
<q-tab
v-for="(contenturl, i) in contenturls"
:key="`content${i}`"
:name="contenturl"
:label="contenttypes[i]"
/>
</q-tabs>
</q-card>
<div class="row sticky">
<div>
<q-btn
......@@ -60,6 +78,10 @@ export default {
type: Array,
default: () => [],
},
contenttypes: {
type: Array,
default: () => [],
},
fontsize: {
type: Number,
default: () => 14,
......@@ -76,13 +98,16 @@ export default {
type: String,
default: () => '',
},
transliteration: {
type: String,
default: () => '',
},
},
data() {
return {
content: '',
sequenceindex: 0,
};
},
data: () => ({
activeTab: null,
content: '',
sequenceindex: 0,
}),
computed: {
supportType() {
const { support } = this.manifests[this.sequenceindex];
......@@ -95,18 +120,23 @@ export default {
fontsize() {
this.$refs.contentsize.style.fontSize = `${this.fontsize}px`;
},
activeTab(url) {
this.request(url, 'text').then((data) => {
if (this.supportType) {
this.getSupport(this.manifests[0].support);
}
this.content = data;
});
},
},
async created() {
this.fasSearchPlus = fasSearchPlus;
this.fasSearchMinus = fasSearchMinus;
this.content = await this.request(this.contenturls[0], 'text').then((data) => {
if (this.supportType) {
this.getSupport(this.manifests[0].support);
}
const [contentUrl] = this.contenturls;
return data;
});
this.activeTab = contentUrl;
},
mounted() {
......
......@@ -94,6 +94,10 @@ export default {
type: Object,
default: () => {},
},
contenttypes: {
type: Array,
default: () => [],
},
contenturls: {
type: Array,
default: () => [],
......
Markdown is supported
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