Safe checking of metadtumList in item page.
This commit is contained in:
parent
2ae1ef8d56
commit
d653ddf4d6
|
@ -102,30 +102,32 @@
|
|||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div
|
||||
v-for="(itemMetadatum, index) of metadatumList.filter(anItemMetadatum => anItemMetadatum.metadatum.metadata_section_id == metadataSection.id)"
|
||||
:key="index"
|
||||
class="field">
|
||||
<label class="label">{{ itemMetadatum.metadatum.name }}</label>
|
||||
<template v-if="metadatumList && Array.isArray(metadatumList)">
|
||||
<div
|
||||
:class="{
|
||||
'metadata-type-textarea': itemMetadatum.metadatum.metadata_type_object.component == 'tainacan-textarea',
|
||||
'metadata-type-compound': itemMetadatum.metadatum.metadata_type_object.component == 'tainacan-compound',
|
||||
'metadata-type-relationship': itemMetadatum.metadatum.metadata_type_object.component == 'tainacan-relationship'
|
||||
}"
|
||||
class="content">
|
||||
<component
|
||||
:is="
|
||||
itemMetadatum.metadatum.metadata_type_object.component == 'tainacan-compound' ||
|
||||
(itemMetadatum.metadatum.metadata_type_object.component == 'tainacan-relationship' &&
|
||||
itemMetadatum.metadatum.metadata_type_object.options &&
|
||||
itemMetadatum.metadatum.metadata_type_object.options.display_related_item_metadata &&
|
||||
itemMetadatum.metadatum.metadata_type_object.options.display_related_item_metadata.length > 1
|
||||
) ? 'div' : 'p'"
|
||||
v-html="itemMetadatum.value_as_html != '' ? itemMetadatum.value_as_html : `<p><span class='has-text-gray is-italic'>` + $i18n.get('label_value_not_provided') + `</span></p>`"/>
|
||||
v-for="(itemMetadatum, index) of metadatumList.filter(anItemMetadatum => anItemMetadatum.metadatum.metadata_section_id == metadataSection.id)"
|
||||
:key="index"
|
||||
class="field">
|
||||
<label class="label">{{ itemMetadatum.metadatum.name }}</label>
|
||||
<div
|
||||
:class="{
|
||||
'metadata-type-textarea': itemMetadatum.metadatum.metadata_type_object.component == 'tainacan-textarea',
|
||||
'metadata-type-compound': itemMetadatum.metadatum.metadata_type_object.component == 'tainacan-compound',
|
||||
'metadata-type-relationship': itemMetadatum.metadatum.metadata_type_object.component == 'tainacan-relationship'
|
||||
}"
|
||||
class="content">
|
||||
<component
|
||||
:is="
|
||||
itemMetadatum.metadatum.metadata_type_object.component == 'tainacan-compound' ||
|
||||
(itemMetadatum.metadatum.metadata_type_object.component == 'tainacan-relationship' &&
|
||||
itemMetadatum.metadatum.metadata_type_object.options &&
|
||||
itemMetadatum.metadatum.metadata_type_object.options.display_related_item_metadata &&
|
||||
itemMetadatum.metadatum.metadata_type_object.options.display_related_item_metadata.length > 1
|
||||
) ? 'div' : 'p'"
|
||||
v-html="itemMetadatum.value_as_html != '' ? itemMetadatum.value_as_html : `<p><span class='has-text-gray is-italic'>` + $i18n.get('label_value_not_provided') + `</span></p>`"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -463,32 +463,32 @@
|
|||
v-if="metadataSection.description && (!hideHelpButtons && helpInfoBellowLabel)">
|
||||
{{ metadataSection.description }}
|
||||
</p>
|
||||
<template v-if="metadatumList && Array.isArray(metadatumList)">
|
||||
<template v-for="(itemMetadatum, index) of metadatumList.filter(anItemMetadatum => anItemMetadatum.metadatum.metadata_section_id == metadataSection.id)">
|
||||
|
||||
<!-- JS-side hook for extra content -->
|
||||
<div
|
||||
:key="index"
|
||||
v-if="hasBeforeHook('metadatum')"
|
||||
class="item-submission-hook item-submission-hook-metadatum-before"
|
||||
v-html="getBeforeHook('metadatum', { metadatum: itemMetadatum.metadatum, index: index, metadataSection: metadataSection, sectionIndex: sectionIndex })" />
|
||||
|
||||
<template v-for="(itemMetadatum, index) of metadatumList.filter(anItemMetadatum => anItemMetadatum.metadatum.metadata_section_id == metadataSection.id)">
|
||||
<tainacan-form-item
|
||||
:key="index"
|
||||
v-if="enabledMetadata[index] == 'true'"
|
||||
:item-metadatum="itemMetadatum"
|
||||
:hide-collapses="hideCollapses"
|
||||
:is-collapsed="metadataCollapses[index]"
|
||||
@changeCollapse="onChangeCollapse($event, index)"/>
|
||||
|
||||
<!-- JS-side hook for extra content -->
|
||||
<div
|
||||
:key="index"
|
||||
v-if="hasBeforeHook('metadatum')"
|
||||
class="item-submission-hook item-submission-hook-metadatum-before"
|
||||
v-html="getBeforeHook('metadatum', { metadatum: itemMetadatum.metadatum, index: index, metadataSection: metadataSection, sectionIndex: sectionIndex })" />
|
||||
|
||||
<tainacan-form-item
|
||||
:key="index"
|
||||
v-if="enabledMetadata[index] == 'true'"
|
||||
:item-metadatum="itemMetadatum"
|
||||
:hide-collapses="hideCollapses"
|
||||
:is-collapsed="metadataCollapses[index]"
|
||||
@changeCollapse="onChangeCollapse($event, index)"/>
|
||||
|
||||
<!-- JS-side hook for extra content -->
|
||||
<div
|
||||
:key="index"
|
||||
v-if="hasAfterHook('metadatum')"
|
||||
class="item-submission-hook item-submission-hook-metadatum-after"
|
||||
v-html="getAfterHook('metadatum', { metadatum: itemMetadatum.metadatum, index: index, metadataSection: metadataSection, sectionIndex: sectionIndex })" />
|
||||
<!-- JS-side hook for extra content -->
|
||||
<div
|
||||
:key="index"
|
||||
v-if="hasAfterHook('metadatum')"
|
||||
class="item-submission-hook item-submission-hook-metadatum-after"
|
||||
v-html="getAfterHook('metadatum', { metadatum: itemMetadatum.metadatum, index: index, metadataSection: metadataSection, sectionIndex: sectionIndex })" />
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<!-- JS-side hook for extra content -->
|
||||
<div
|
||||
v-if="hasAfterHook('metadata_section')"
|
||||
|
|
Loading…
Reference in New Issue