From 904aae2dc79c41af15ee9f2ee7a944e92ce0eff3 Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Tue, 9 Aug 2022 15:47:28 -0300 Subject: [PATCH 1/2] Auto selects first or title metadata as search option on relationship. --- .../relationship/FormRelationship.vue | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/views/admin/components/metadata-types/relationship/FormRelationship.vue b/src/views/admin/components/metadata-types/relationship/FormRelationship.vue index da4ed0bca..753d69fa7 100644 --- a/src/views/admin/components/metadata-types/relationship/FormRelationship.vue +++ b/src/views/admin/components/metadata-types/relationship/FormRelationship.vue @@ -227,7 +227,7 @@ if ( (metadatum.metadata_type_object.component !== 'tainacan-relationship' || this.isMetaqueryRelationshipEnabled) ) { this.metadata.push( metadatum ); this.hasMetadata = true; - this.checkMetadata(); + this.checkSearchMetadatum(); } } @@ -259,15 +259,17 @@ }); }, - checkMetadata(){ + checkSearchMetadatum() { if ( this.value && this.value.search ) { this.modelSearch = this.value.search; } else { - try { - const json = JSON.parse( this.search ); - this.modelSearch = json; - } catch(e){ - this.modelSearch = ''; + const titleMetadatumIndex = this.metadata.findIndex(metadatum => metadatum.metadata_type == 'Tainacan\\Metadata_Types\\Core_Title'); + if (titleMetadatumIndex >= 0) + this.modelSearch = this.metadata[titleMetadatumIndex].id; + else { + const nonCompountMetadatumIndex = this.metadata.findIndex(metadatum => metadatum.metadata_type_object.component !== 'tainacan-compound'); + if (nonCompountMetadatumIndex >= 0) + this.modelSearch = this.metadata[nonCompountMetadatumIndex].id; } } }, From 19bcbcd50f4b041816ee63e1797e68136c891a8a Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Tue, 9 Aug 2022 15:47:46 -0300 Subject: [PATCH 2/2] Fix error while deling sections and overlaping sections. --- src/views/admin/js/store/modules/metadata/mutations.js | 4 ++-- src/views/admin/pages/lists/metadata-page.vue | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/views/admin/js/store/modules/metadata/mutations.js b/src/views/admin/js/store/modules/metadata/mutations.js index b47f61b4d..294129cb3 100644 --- a/src/views/admin/js/store/modules/metadata/mutations.js +++ b/src/views/admin/js/store/modules/metadata/mutations.js @@ -213,9 +213,9 @@ export const clearPlaceholderMetadataSection = (state) => { } export const deleteMetadataSection = ( state, metadataSection ) => { - let index = state.metadataSection.findIndex(deletedMetadataSection => deletedMetadataSection.id == metadataSection.id); + let index = state.metadataSections.findIndex(deletedMetadataSection => deletedMetadataSection.id == metadataSection.id); if (index >= 0) - state.metadataSection.splice(index, 1); + state.metadataSections.splice(index, 1); } export const cleanMetadataSections = (state) => { diff --git a/src/views/admin/pages/lists/metadata-page.vue b/src/views/admin/pages/lists/metadata-page.vue index 71b170e51..0467b5ca7 100644 --- a/src/views/admin/pages/lists/metadata-page.vue +++ b/src/views/admin/pages/lists/metadata-page.vue @@ -187,6 +187,8 @@ export default { section.field.is-grouped-centered.section { position: absolute; width: 63%; + background: var(--tainacan-background-color); + padding-top: 5em; } &:not(.available-metadata-types-area){ @@ -271,6 +273,11 @@ export default { .active-metadata-area, .active-metadata-sections-area { min-height: 3em; + transition: min-height 0.2s ease; + + &:empty { + min-height: 220px; + } @media screen and (max-width: 769px) { min-height: 45px;