Fixes small flow issue in preset selection. #734.

This commit is contained in:
mateuswetah 2022-10-04 11:23:01 -03:00
parent 4b2fc1773c
commit 927873a78e
1 changed files with 10 additions and 5 deletions

View File

@ -25,8 +25,8 @@
{{ $i18n.get('label_create_collection') }}
</h2>
<a
@click="selectedEstrategy = undefined"
v-if="selectedEstrategy != undefined"
@click="selectedEstrategy = hasPresetsHook ? undefined : 'mappers'"
v-if="(hasPresetsHook && selectedEstrategy != undefined) || (!hasPresetsHook && selectedEstrategy == 'mappers')"
class="back-link">
{{ $i18n.get('back') }}
</a>
@ -111,11 +111,16 @@ export default {
name: 'CollectionCreationModal',
data(){
return {
selectedEstrategy: this.hasPresetsHook ? undefined : 'mappers',
selectedEstrategy: 'mappers',
isLoadingMetadatumMappers: true,
collectionPresets: []
}
},
watch: {
hasPresetsHook() {
this.selectedEstrategy = this.hasPresetsHook ? undefined : 'mappers';
}
},
computed: {
metadatumMappers() {
return this.getMetadatumMappers();
@ -128,7 +133,7 @@ export default {
},
getPresetsHook() {
if (wp !== undefined && wp.hooks !== undefined)
return wp.hooks.applyFilters(`tainacan_collections_presets`, this.collectionPresets);
this.collectionPresets = wp.hooks.applyFilters(`tainacan_collections_presets`, this.collectionPresets);
return this.collectionPresets;
},
@ -204,7 +209,7 @@ export default {
text-align: left;
padding: 15px;
cursor: pointer;
max-width: 50%;
flex-basis: calc(50% - 12px);
flex-grow: 1;
font-size: 1em;
transition: border 0.3s ease;