bibliography improvment #1257
This commit is contained in:
+78
-4
@@ -31,8 +31,8 @@ that is currently Firefox-only */
|
|||||||
|
|
||||||
body{
|
body{
|
||||||
color: #1a1a1a;
|
color: #1a1a1a;
|
||||||
background-image: url('/static/img/grille-ligne-de-base.png');
|
// background-image: url('/static/img/grille-ligne-de-base.png');
|
||||||
background-repeat: repeat;
|
// background-repeat: repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
#root{
|
#root{
|
||||||
@@ -927,14 +927,88 @@ section[role="main-content"]{
|
|||||||
padding:0;
|
padding:0;
|
||||||
li{
|
li{
|
||||||
padding:0;
|
padding:0;
|
||||||
margin:0 0 1.5em 0;
|
margin:0 0 $base-line 0;
|
||||||
h2{
|
h2{
|
||||||
margin:0;
|
margin:0;
|
||||||
@include title2black;
|
@include title1black;
|
||||||
}
|
}
|
||||||
p{
|
p{
|
||||||
margin:0;
|
margin:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
span.date{
|
||||||
|
@include title2black;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
aside{
|
||||||
|
overflow: hidden;
|
||||||
|
h5{
|
||||||
|
@include title2black;
|
||||||
|
margin: $base-line / 2 0;
|
||||||
|
cursor: pointer;
|
||||||
|
// padding-left: 1em;
|
||||||
|
// position: relative;
|
||||||
|
&:before{
|
||||||
|
cursor: pointer;
|
||||||
|
content:"\2304";
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
top: -4px;
|
||||||
|
// transform-origin: center;
|
||||||
|
// transform: rotateZ(-90deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ul{
|
||||||
|
max-height: 1px;
|
||||||
|
transition: all 0.3s ease-in-out;
|
||||||
|
padding-left: 1em;
|
||||||
|
li{
|
||||||
|
margin-bottom: $base-line / 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.opened{
|
||||||
|
h5{
|
||||||
|
&:before{
|
||||||
|
top: 4px;
|
||||||
|
content:"\2303";
|
||||||
|
// transform: rotateZ(90deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ul{
|
||||||
|
max-height: 100em;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.manifestations{
|
||||||
|
li{
|
||||||
|
max-height: 0.2px;
|
||||||
|
margin-bottom:0;
|
||||||
|
overflow: hidden;
|
||||||
|
transition: all 1s ease-in-out;
|
||||||
|
&.active{
|
||||||
|
max-height: 10em;
|
||||||
|
}
|
||||||
|
.wrapper{
|
||||||
|
margin-bottom: $base-line;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ul.authors-filters{
|
||||||
|
li{
|
||||||
|
@include title4black;
|
||||||
|
line-height: $base-line / 2;
|
||||||
|
span{
|
||||||
|
cursor: pointer;
|
||||||
|
color: $gris;
|
||||||
|
&.active{
|
||||||
|
color: $grisfonce;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,15 @@ footer[role="tools"] .row>nav{
|
|||||||
line-height: $base-line / 2;
|
line-height: $base-line / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@mixin title2blue {
|
||||||
|
@include fontserif;
|
||||||
|
font-size: 1.134em;
|
||||||
|
color: $grisfonce;
|
||||||
|
font-weight: 400;
|
||||||
|
margin:0;
|
||||||
|
line-height: $base-line / 2;
|
||||||
|
}
|
||||||
|
|
||||||
@mixin title3black {
|
@mixin title3black {
|
||||||
@include fontserif;
|
@include fontserif;
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
|
|||||||
+187
-19
@@ -28,39 +28,94 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- default slot -->
|
<!-- default slot -->
|
||||||
<!-- expressions or manifestations list -->
|
<!-- expressions list -->
|
||||||
<template v-if="!uuid">
|
<template v-if="!uuid && type === 'expressions'">
|
||||||
<ul class="item-list">
|
<ul class="item-list">
|
||||||
<li v-for="item in content" :key="item.uuid">
|
<li v-for="item in expressions" :key="item.uuid">
|
||||||
<h2>
|
<h2>
|
||||||
<router-link
|
<router-link
|
||||||
|
v-if="item.authors"
|
||||||
:to="{ name:'bibliographieItem', params:{ type:type, uuid:item.uuid } }"
|
:to="{ name:'bibliographieItem', params:{ type:type, uuid:item.uuid } }"
|
||||||
>
|
>
|
||||||
{{ item.authors }}
|
{{ item.authors }}
|
||||||
</router-link>
|
</router-link>
|
||||||
|
<span v-else>/!\ No authors /!\</span>
|
||||||
</h2>
|
</h2>
|
||||||
<p class="date">{{ item.dates }}</p>
|
<p class="date">{{ item.dates }}</p>
|
||||||
<p class="titles">{{ item.titles }}</p>
|
<em class="titles">{{ item.titles }}</em>
|
||||||
|
<aside v-if="item.manifestations.length">
|
||||||
|
<h5
|
||||||
|
@click.prevent="onToggleManifs"
|
||||||
|
@keyup.enter="onToggleManifs"
|
||||||
|
>Manifestations</h5>
|
||||||
|
<ul>
|
||||||
|
<li v-for="manif in item.manifestations" :key="manif.uuid">
|
||||||
|
<span class="date">{{ manif.dates }} </span>
|
||||||
|
<router-link
|
||||||
|
:to="{ name:'bibliographieItem', params:{ type:'manifestations', uuid:manif.uuid } }"
|
||||||
|
>
|
||||||
|
<em>{{ manif.titles }}</em>
|
||||||
|
</router-link>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</aside>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</template>
|
||||||
|
<!-- manifestations list -->
|
||||||
|
<template v-if="!uuid && type === 'manifestations'">
|
||||||
|
<ul class="item-list manifestations">
|
||||||
|
<li
|
||||||
|
v-for="item in manifestations" :key="item.uuid"
|
||||||
|
:class="isInActiveAuthors(item.authors)"
|
||||||
|
>
|
||||||
|
<div class="wrapper">
|
||||||
|
<span class="date">{{ item.dates }} </span>
|
||||||
|
<router-link
|
||||||
|
:to="{ name:'bibliographieItem', params:{ type:'manifestations', uuid:item.uuid } }"
|
||||||
|
>
|
||||||
|
<em class="titles">{{ item.titles }}</em>
|
||||||
|
</router-link>
|
||||||
|
<!-- <p class="authors">{{ item.authors }}</p> -->
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</template>
|
</template>
|
||||||
<!-- or item -->
|
<!-- or item -->
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div class="biblio-item">
|
<div class="biblio-item">
|
||||||
<h2>{{ content.authors }}</h2>
|
<h2>{{ item.authors }}</h2>
|
||||||
<p v-if="content.dates" class="date">{{ content.dates }}</p>
|
<p v-if="item.dates" class="date">{{ item.dates }}</p>
|
||||||
<p class="titles">{{ content.titles }}</p>
|
<p class="titles">{{ item.titles }}</p>
|
||||||
<ul vi-if="content.manifestations.length" class="item-list">
|
<p class="tei">{{ item.tei }}</p>
|
||||||
<li v-for="item in content.manifestations" :key="item.uuid">
|
<ul vi-if="item.manifestations.length" class="item-list">
|
||||||
|
<li v-for="manif in item.manifestations" :key="manif.uuid">
|
||||||
<router-link
|
<router-link
|
||||||
:to="{ name:'bibliographieItem', params:{ type:'manifestations', uuid:item.uuid } }"
|
:to="{ name:'bibliographieItem', params:{ type:'manifestations', uuid:manif.uuid } }"
|
||||||
v-html="item.tei"
|
v-html="manif.tei"
|
||||||
/>
|
/>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<ul vi-if="item.idno.length" class="item-list">
|
||||||
|
<li v-for="id in item.idno" :key="id.url">
|
||||||
|
<a :href="id.url">{{ id.type }}: {{ id.url }}</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #nav />
|
<template #nav>
|
||||||
|
<ul v-if="!uuid && type === 'manifestations'" class="authors-filters">
|
||||||
|
<li
|
||||||
|
v-for="author in authors" :key="author"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
:class="isInActiveAuthors(author)"
|
||||||
|
@click.prevent="onToggleAuthors(author)"
|
||||||
|
@keyup.enter="onToggleAuthors(author)"
|
||||||
|
>{{ author }}</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</template>
|
||||||
</MainContentLayout>
|
</MainContentLayout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -82,32 +137,145 @@ export default {
|
|||||||
uuid: String
|
uuid: String
|
||||||
},
|
},
|
||||||
data: () => ({
|
data: () => ({
|
||||||
content: Array
|
content: Array,
|
||||||
|
manifestations: Array,
|
||||||
|
expressions: Array,
|
||||||
|
authors: Array,
|
||||||
|
activeAuthors: Array,
|
||||||
|
item: Array
|
||||||
}),
|
}),
|
||||||
|
computed: {
|
||||||
|
},
|
||||||
watch: {
|
watch: {
|
||||||
$route (to, from) {
|
$route (to, from) {
|
||||||
this.getContent()
|
console.log('watch $route to', to)
|
||||||
|
// this.getContent()
|
||||||
|
if (to.params.uuid) {
|
||||||
|
this.getItem(to.params.type, to.params.uuid)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
// this.type = this.$route.params.type || 'expressions'
|
// this.type = this.$route.params.type || 'expressions'
|
||||||
// this.uuid = this.$route.params.id || null
|
// this.uuid = this.$route.params.id || null
|
||||||
|
this.activeAuthors = []
|
||||||
this.getContent()
|
this.getContent()
|
||||||
|
if (this.$route.params.uuid) {
|
||||||
|
this.getItem(this.$route.params.type, this.$route.params.uuid)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getContent () {
|
getContent () {
|
||||||
// ?_format=json
|
REST.get(`${window.apipath}/bibliography/expressions`, {})
|
||||||
REST.get(`${window.apipath}/bibliography/${this.type}/${this.uuid || ''}`, {})
|
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
console.log('Biblio REST: data', data)
|
console.log('Biblio REST expressions: data', data)
|
||||||
if (data.content) {
|
if (data.content) {
|
||||||
this.content = data.content
|
this.expressions = data.content
|
||||||
|
REST.get(`${window.apipath}/bibliography/manifestations`, {})
|
||||||
|
.then(({ data }) => {
|
||||||
|
console.log('Biblio REST manifestations: data', data)
|
||||||
|
if (data.content) {
|
||||||
|
this.manifestations = data.content
|
||||||
|
}
|
||||||
|
this.parseContents()
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.warn('Issue with bibliographie manifestations', error)
|
||||||
|
Promise.reject(error)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.warn('Issue with bibliographie', error)
|
console.warn('Issue with bibliographie expressions', error)
|
||||||
Promise.reject(error)
|
Promise.reject(error)
|
||||||
})
|
})
|
||||||
|
// // ?_format=json
|
||||||
|
// REST.get(`${window.apipath}/bibliography/${this.type}/${this.uuid || ''}`, {})
|
||||||
|
// .then(({ data }) => {
|
||||||
|
// console.log('Biblio REST: data', data)
|
||||||
|
// if (data.content) {
|
||||||
|
// this.content = data.content
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// .catch((error) => {
|
||||||
|
// console.warn('Issue with bibliographie', error)
|
||||||
|
// Promise.reject(error)
|
||||||
|
// })
|
||||||
|
},
|
||||||
|
getItem (type, uuid) {
|
||||||
|
REST.get(`${window.apipath}/bibliography/${type}/${uuid}`, {})
|
||||||
|
.then(({ data }) => {
|
||||||
|
console.log('Biblio REST item: data', data)
|
||||||
|
if (data.content) {
|
||||||
|
this.item = data.content
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.warn('Issue with bibliographie get item', error)
|
||||||
|
Promise.reject(error)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
parseContents () {
|
||||||
|
this.expressions = this.expressions.sort((a, b) => {
|
||||||
|
let Adate = parseInt(a.dates)
|
||||||
|
let Bdate = parseInt(b.dates)
|
||||||
|
if (Adate < Bdate) {
|
||||||
|
return -1
|
||||||
|
} else if (Adate > Bdate) {
|
||||||
|
return 1
|
||||||
|
} else {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.manifestations = this.manifestations.sort((a, b) => {
|
||||||
|
let Adate = parseInt(a.dates)
|
||||||
|
let Bdate = parseInt(b.dates)
|
||||||
|
if (Adate < Bdate) {
|
||||||
|
return -1
|
||||||
|
} else if (Adate > Bdate) {
|
||||||
|
return 1
|
||||||
|
} else {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
this.authors = []
|
||||||
|
this.manifestations.forEach(manif => {
|
||||||
|
// console.log('this.authors', this.authors)
|
||||||
|
if (this.authors.indexOf(manif.authors) === -1) {
|
||||||
|
this.authors.push(manif.authors)
|
||||||
|
this.activeAuthors.push(manif.authors)
|
||||||
|
}
|
||||||
|
// console.log('authors', this.authors)
|
||||||
|
})
|
||||||
|
|
||||||
|
this.expressions.forEach((expr, i) => {
|
||||||
|
let manifs = []
|
||||||
|
this.manifestations.forEach((manif, j) => {
|
||||||
|
if (manif.authors !== '' && manif.authors === expr.authors) {
|
||||||
|
manifs.push(manif)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.expressions[i].manifestations = manifs
|
||||||
|
})
|
||||||
|
this.content = this.expressions
|
||||||
|
// console.log(this.expressions)
|
||||||
|
},
|
||||||
|
onToggleManifs (e) {
|
||||||
|
console.log('togle manifs', e)
|
||||||
|
let aside = e.originalTarget.parentNode
|
||||||
|
// console.log('aside', aside)
|
||||||
|
aside.classList.toggle('opened')
|
||||||
|
},
|
||||||
|
isInActiveAuthors (authors) {
|
||||||
|
return this.activeAuthors.indexOf(authors) !== -1 ? 'active' : null
|
||||||
|
},
|
||||||
|
onToggleAuthors (author) {
|
||||||
|
if (this.activeAuthors.indexOf(author) === -1) {
|
||||||
|
this.activeAuthors.push(author)
|
||||||
|
} else {
|
||||||
|
this.activeAuthors.splice(this.activeAuthors.indexOf(author), 1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user