Fixes bug where more than one child metadata child of the same type could not be inserted in compound.

This commit is contained in:
mateuswetah 2024-05-21 10:32:23 -03:00
parent 2d71ceee9e
commit ff8058bfc9
2 changed files with 5 additions and 5 deletions

View File

@ -11,7 +11,7 @@
</h3>
<sortable
:list="availableMetadataTypes"
item-key="id"
item-key="component"
:options="{
group: {
name: 'metadata',
@ -25,7 +25,7 @@
}">
<template #item="{ element: metadatum }">
<div
:id="metadatum.component"
:data-metadatum-type="metadatum.component"
class="available-metadatum-item"
:class="{ 'highlighted-metadatum' : highlightedMetadatum == metadatum.name, 'inherited-metadatum': metadatum.inherited || isRepositoryLevel }"
@click.prevent="addMetadatumViaButton(metadatum)">

View File

@ -452,13 +452,13 @@
this.updateMetadataOrder();
},
isAvailableChildMetadata(to, from, item) {
if (!item || !item.id)
if (!item || !item.dataset || !item.dataset.metadatumType)
return false;
if (from.el && from.el.className === 'active-metadata-area')
return false;
return !['tainacan-compound', 'tainacan-taxonomy'].includes(item.id);
return !['tainacan-compound', 'tainacan-taxonomy'].includes(item.dataset.metadatumType);
},
isCollapseOpen(metadatumId) {
return this.collapses[metadatumId] == true;