Displays compound parent name on child metadata displayed on filters page. #17.

This commit is contained in:
mateuswetah 2020-03-19 20:15:15 -03:00
parent bbf0dc9c24
commit 3587e5bd7d
1 changed files with 21 additions and 5 deletions

View File

@ -192,7 +192,13 @@
}" }"
class="tainacan-icon" /> class="tainacan-icon" />
</span> </span>
<span class="metadatum-name">{{ metadatum.name }}</span> <span class="metadatum-name">{{ metadatum.name }}
<span
v-if="metadatum.parent_name"
class="label-details">
<em>{{ '(' + metadatum.parent_name + ')' }}</em>
</span>
</span>
</div> </div>
</draggable> </draggable>
@ -550,8 +556,14 @@ export default {
.catch(() => { this.isUpdatingFiltersOrder = false }); .catch(() => { this.isUpdatingFiltersOrder = false });
}, },
updateListOfMetadata() { updateListOfMetadata() {
const availableMetadata = JSON.parse(JSON.stringify(this.getMetadata()));
const availableMetadataNames = {};
let availableMetadata = JSON.parse(JSON.stringify(this.getMetadata())).filter((aMetadatum) => aMetadatum.metadata_type_object.component != 'tainacan-compound'); for (let availableMetadatum of availableMetadata) {
availableMetadataNames['' + availableMetadatum.id] = availableMetadatum.name;
if (availableMetadatum.parent > 0 && availableMetadataNames[availableMetadatum.parent])
availableMetadatum.parent_name = availableMetadataNames[availableMetadatum.parent];
}
for (let activeFilter of this.activeFilterList) { for (let activeFilter of this.activeFilterList) {
for (let i = availableMetadata.length - 1; i >= 0 ; i--) { for (let i = availableMetadata.length - 1; i >= 0 ; i--) {
@ -562,7 +574,7 @@ export default {
} }
} }
this.availableMetadata = availableMetadata; this.availableMetadata = availableMetadata.filter((aMetadatum) => aMetadatum.metadata_type_object.component != 'tainacan-compound');
}, },
onChangeEnable($event, index) { onChangeEnable($event, index) {
let filtersOrder = []; let filtersOrder = [];
@ -1040,6 +1052,10 @@ export default {
border-bottom-width: 20px; border-bottom-width: 20px;
left: -20px; left: -20px;
} }
.label-details {
font-weight: normal;
color: var(--tainacan-gray3);
}
} }
.sortable-drag { .sortable-drag {
opacity: 1 !important; opacity: 1 !important;