bibliographie draft #788

This commit is contained in:
2020-07-27 11:11:07 +02:00
parent c29b86a5ae
commit 2ce63fa320
3 changed files with 130 additions and 29 deletions
+20 -1
View File
@@ -525,7 +525,26 @@ section[role="main-content"]{
} }
} }
#biblio{
.router-link-active{
font-weight: 600;
}
ul.item-list{
margin:0;
padding:0;
li{
padding:0;
margin:0 0 1.5em 0;
h2{
margin:0;
@include title2black;
}
p{
margin:0;
}
}
}
}
} }
footer[role="tools"]{ footer[role="tools"]{
+97 -26
View File
@@ -1,43 +1,114 @@
<template> <template>
<div <MainContentLayout id="biblio">
id="bibliographie" <template v-if="!content" #header>
class="full-width" <span>Loading ...</span>
> </template>
<h1>Bibliographie</h1> <template #header>
</div> <h1>
<router-link :to="{ name:'bibliographie'}">Bibliographie</router-link>
</h1>
<nav>
<ul>
<li>
<router-link
:to="{ name:'bibliographie', params: { type: 'expressions'}}"
>
Expressions
</router-link>
</li>
<li>
<router-link
:to="{ name:'bibliographie', params: { type: 'manifestations'}}"
>
Manifestations
</router-link>
</li>
</ul>
</nav>
</template>
<!-- default slot -->
<!-- expressions or manifestations list -->
<template v-if="!this.uuid">
<ul class="item-list">
<li v-for="item in content" :key="item.uuid">
<h2>
<router-link
:to="{ name:'bibliographieItem', params:{ type:type, uuid:item.uuid } }"
>
{{ item.authors }}
</router-link>
</h2>
<p class="date">{{ item.dates }}</p>
<p class="titles">{{ item.titles }}</p>
</li>
</ul>
</template>
<!-- or item -->
<template v-else>
<div class="biblio-item">
<h2>{{ content.authors }}</h2>
<p v-if="content.dates" class="date">{{ content.dates }}</p>
<p class="titles">{{ content.titles }}</p>
<ul vi-if="content.manifestations.length" class="item-list">
<li v-for="item in content.manifestations" :key="item.uuid">
<router-link
:to="{ name:'bibliographieItem', params:{ type:'manifestations', uuid:item.uuid } }"
v-html="item.tei"
/>
</li>
</ul>
</div>
</template>
<template #nav />
</MainContentLayout>
</template> </template>
<script> <script>
import { REST } from 'api/rest-axios' import { REST } from 'api/rest-axios'
import MainContentLayout from '../components/Layouts/MainContentLayout'
export default { export default {
name: 'Bibliographie', name: 'Bibliographie',
components: {
MainContentLayout
},
metaInfo: { metaInfo: {
title: 'Bibliographie' title: 'Bibliographie'
}, },
props: {
type: String,
uuid: String
},
data: () => ({ data: () => ({
content: Array
}), }),
beforeCreate () { watch: {
// ?_format=json $route (to, from) {
REST.get(`${window.apipath}/bibliography/works`, {}) this.getContent()
.then(({ data }) => { }
console.log('Biblio REST: data', data) },
// if(data.length){ created () {
// commit('setItems',data) // this.type = this.$route.params.type || 'expressions'
// // console.log('items.length', this.items.length); // this.uuid = this.$route.params.id || null
// if(state.infiniteLoadingState) this.getContent()
// state.infiniteLoadingState.loaded() },
// }else{ methods: {
// if(state.infiniteLoadingState) getContent () {
// state.infiniteLoadingState.complete() // ?_format=json
// } REST.get(`${window.apipath}/bibliography/${this.type}/${this.uuid || ''}`, {})
}) .then(({ data }) => {
.catch((error) => { console.log('Biblio REST: data', data)
console.warn('Issue with operum', error) if (data.content) {
Promise.reject(error) this.content = data.content
}) }
})
.catch((error) => {
console.warn('Issue with bibliographie', error)
Promise.reject(error)
})
}
} }
} }
</script> </script>
+13 -2
View File
@@ -80,9 +80,20 @@ const routes = [
component: Operum component: Operum
}, },
{ {
name: 'bibliographie',
path: '/bibliographie', path: '/bibliographie',
component: Bibliographie redirect: '/bibliographie/expressions'
},
{
name: 'bibliographie',
path: '/bibliographie/:type',
component: Bibliographie,
props: true
},
{
name: 'bibliographieItem',
path: '/bibliographie/:type/:uuid',
component: Bibliographie,
props: true
}, },
{ {
name: 'notfound', name: 'notfound',