add showOrigin prop to NodeView & children

This commit is contained in:
axolotle
2021-07-01 16:12:18 +02:00
parent 35fecd8ca2
commit b9292b0189
6 changed files with 31 additions and 17 deletions
+9 -4
View File
@@ -2,13 +2,13 @@
<div
class="node-view-header-prod" :class="'node-view-header-' + mode"
>
<div class="d-flex w-100">
<div class="node-view-header-wrapper d-flex w-100">
<h4 class="mr-auto">
<div class="node-view-header-type">
{{ $t('variants.' + node.variant) }} {{ mode === 'card' && node.parents ? $t('from') : '' }}
{{ $t('variants.' + node.variant) }} {{ withOrigin ? $t('from') : '' }}
</div>
<div v-if="mode === 'card' && node.parents && node.parents.length" class="node-view-header-parent">
<div v-if="withOrigin" class="node-view-header-parent">
<node-view-title :node="node.parents[0]" edition tag="div" />
</div>
</h4>
@@ -32,13 +32,18 @@ export default {
props: {
node: { type: Object, required: true },
mode: { type: String, required: true }
mode: { type: String, required: true },
showOrigin: { type: Boolean, required: true }
},
computed: {
parent () {
if (!this.node || !this.node.parents) return
return this.node.parents.find(parent => parent.variant === 'depart')
},
withOrigin () {
return (this.showOrigin || this.mode === 'card') && this.node.parents && this.node.parents.length
}
},