add text_rebond to NodeViewFooter & style popovers

This commit is contained in:
axolotle
2021-06-23 16:21:54 +02:00
parent 600972b8cd
commit f4d81dffcf
9 changed files with 87 additions and 37 deletions
+2 -2
View File
@@ -132,7 +132,7 @@ $spinner-width: 50px;
// POPOVERS // POPOVERS
$popover-font-size: $font-size-base; $popover-font-size: $font-size-base;
$popover-bg: $black; $popover-bg: $white;
$popover-max-width: 450px; $popover-max-width: 450px;
$popover-border-width: 0; $popover-border-width: 0;
$popover-box-shadow: null; $popover-box-shadow: null;
@@ -142,7 +142,7 @@ $popover-body-padding-y: 18px;
$popover-body-padding-x: 18px; $popover-body-padding-x: 18px;
$popover-arrow-width: 0; $popover-arrow-width: 0;
$popover-arrow-height: 1rem; $popover-arrow-height: 2rem;
$popover-arrow-outer-color: null; $popover-arrow-outer-color: null;
@@ -31,3 +31,11 @@ a:hover {
.popover { .popover {
font-family: $font-family-text; font-family: $font-family-text;
} }
.btn {
font-family: $font-family-base;
}
.badge {
font-size: inherit;
}
@@ -85,7 +85,6 @@ export default {
} }
.b-form-tag { .b-form-tag {
font-size: inherit;
font-weight: $font-weight-bold; font-weight: $font-weight-bold;
padding-top: 0; padding-top: 0;
padding-bottom: 0; padding-bottom: 0;
+27 -9
View File
@@ -20,7 +20,7 @@
v-for="link in note.links" :key="link.id" v-for="link in note.links" :key="link.id"
:node="link.parents && link.parents.length ? link.parents[0] : link" :node="link.parents && link.parents.length ? link.parents[0] : link"
link link
@open-node="onFootnoteLinkClick(link)" @open-node="onFootnoteLinkClick(link, 'note-' + note.number)"
> >
<dot-button <dot-button
:variant="link.variant" :variant="link.variant"
@@ -67,11 +67,13 @@ export default {
if (link.parentElement.nodeName === 'SUP') { if (link.parentElement.nodeName === 'SUP') {
link.parentElement.replaceWith(link) link.parentElement.replaceWith(link)
} }
link.setAttribute('href', 'javascript:;')
} }
}) })
}, },
onFootnoteLinkClick (node) { onFootnoteLinkClick (node, popoverBtnId) {
this.$root.$emit('bv::hide::popover', popoverBtnId)
if (node.parents && node.parents.length) { if (node.parents && node.parents.length) {
this.$parent.$emit('open-node', { parentId: node.parents[0].id, childId: node.id }) this.$parent.$emit('open-node', { parentId: node.parents[0].id, childId: node.id })
} else { } else {
@@ -165,14 +167,30 @@ export default {
} }
} }
.footnote-content, .footnote {
.footnote-child-list { background-color: $black;
> :last-child { color: $white;
margin-bottom: 0; font-size: 1.25rem;
@include media-breakpoint-up(sm) {
font-size: 1.5rem;
}
h6 {
font-size: inherit;
}
&-content,
&-child-list {
> :last-child {
margin-bottom: 0;
}
}
&-child-list {
margin-top: .5rem;
} }
} }
.footnote-child-list {
margin-top: .5rem;
}
</style> </style>
+46 -21
View File
@@ -3,38 +3,34 @@
class="node-view-footer" :class="'node-view-footer-' + mode" class="node-view-footer" :class="'node-view-footer-' + mode"
> >
<div class="d-flex w-100"> <div class="d-flex w-100">
<div class="tags"> <div class="tags mb-n2">
<b-badge <b-badge
v-for="tag in node.tags" :key="tag.id" v-for="tag in node.tags" :key="tag.id"
variant="dark" pill variant="dark" pill class="mr-2 mb-2"
> >
{{ tag.name }} {{ tag.name }}
</b-badge> </b-badge>
</div> </div>
<div v-if="mode === 'view' && node.siblings"> <div v-if="mode === 'view' && node.siblings && node.siblings.length">
<b-button :id="'siblings-' + node.id"> <b-button :id="'siblings-' + node.id">
{{ $t('siblings') }} {{ $t('siblings') }}
</b-button> </b-button>
<b-popover <b-popover
:target="'siblings-' + node.id" triggers="hover" placement="top" :target="'siblings-' + node.id" triggers="click" placement="top"
custom-class="popover-siblings"
boundary="viewport"
> >
<div v-for="sibling in node.siblings" :key="sibling.id"> <ul>
<h6> <li v-for="sibling in node.siblings" :key="sibling.id">
<a @click.prevent="onOpen(sibling.id)" href="#"> <node-view-title
<div class=""> :node="sibling"
{{ toCommaList(sibling.authors) }}, link edition block
</div> @open-node="onOpen(sibling.id, 'siblings-' + node.id)"
<div class=""> />
{{ sibling.title }}, </li>
</div> </ul>
<div class="">
{{ sibling.edition ? sibling.edition.name : sibling.edition }}
</div>
</a>
</h6>
</div>
</b-popover> </b-popover>
</div> </div>
@@ -49,11 +45,16 @@
<script> <script>
import { toCommaList } from '@/helpers/common' import { toCommaList } from '@/helpers/common'
import { NodeViewTitle } from '@/components/nodes'
export default { export default {
name: 'NodeViewFooter', name: 'NodeViewFooter',
components: {
NodeViewTitle
},
props: { props: {
node: { type: Object, required: true }, node: { type: Object, required: true },
type: { type: String, required: true }, type: { type: String, required: true },
@@ -71,16 +72,40 @@ export default {
methods: { methods: {
toCommaList, toCommaList,
onOpen (parentId) { onOpen (parentId, popoverBtnId) {
this.$root.$emit('bv::hide::popover', popoverBtnId)
this.$parent.$emit('open-node', { parentId }) this.$parent.$emit('open-node', { parentId })
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss">
.node-view-footer { .node-view-footer {
margin-top: auto; margin-top: auto;
font-family: $font-family-base; font-family: $font-family-base;
} }
.popover-siblings {
background-color: $white;
border: $line;
.popover-body {
color: $black;
ul {
list-style: none;
padding: 0;
margin: 0;
li:not(:last-of-type) {
margin-bottom: 1rem;
}
h6 {
margin: 0;
}
}
}
}
</style> </style>
+1 -1
View File
@@ -10,7 +10,7 @@
class="node-view-title-container" class="node-view-title-container"
> >
<slot name="default" /> <slot name="default" />
<strong>{{ toCommaList(node.authors) }}</strong>, <span><strong>{{ toCommaList(node.authors) }}</strong>,</span>
<span> <span>
<span v-if="node.preTitle" v-html="trim(node.preTitle) + ', '" /> <span v-if="node.preTitle" v-html="trim(node.preTitle) + ', '" />
<em v-html="trim(node.title) || 'pas de titre ital'" /> <em v-html="trim(node.title) || 'pas de titre ital'" />
+1 -1
View File
@@ -58,7 +58,7 @@ export default {
methods: { methods: {
onOpen (node) { onOpen (node) {
if (node.parents) { if (node.parents && node.parents.length) {
this.$emit('open-node', { parentId: node.parents[0].id, childId: node.id }) this.$emit('open-node', { parentId: node.parents[0].id, childId: node.id })
} else { } else {
this.$emit('open-node', { parentId: node.id }) this.$emit('open-node', { parentId: node.id })
+1 -1
View File
@@ -109,7 +109,7 @@ export default {
trim, trim,
onNodeClick (node) { onNodeClick (node) {
if (node.parents) { if (node.parents && node.parents.length) {
this.$emit('open-node', { parentId: node.parents[0].id, childId: node.id }) this.$emit('open-node', { parentId: node.parents[0].id, childId: node.id })
} else { } else {
this.$emit('open-node', { parentId: node.id }) this.$emit('open-node', { parentId: node.id })
+1 -1
View File
@@ -222,7 +222,7 @@ export default {
if (a.authors[0].last_name > b.authors[0].last_name) return 1 if (a.authors[0].last_name > b.authors[0].last_name) return 1
return 0 return 0
}).reduce((dict, text) => { }).reduce((dict, text) => {
const firstChar = text.authors ? text.authors[0].last_name[0] : 'Pas de noms' const firstChar = text.authors ? text.authors[0].last_name[0].toUpperCase() : 'Pas de noms'
if (!(firstChar in dict)) dict[firstChar] = [] if (!(firstChar in dict)) dict[firstChar] = []
dict[firstChar].push(text) dict[firstChar].push(text)
return dict return dict