Fixes change on taxonomy input type not being applied on metadatum edition form when only changed from insert options. Fixes select taxonomy not receiving current Taxonomy ID.

This commit is contained in:
Mateus Machado Luna 2019-01-30 15:18:09 -02:00
parent 3fdc4c467f
commit 362b43cf5c
1 changed files with 13 additions and 6 deletions

View File

@ -56,7 +56,6 @@
v-model="input_type"
@input="emitValues()"
v-else>
<option
v-for="(option, index) in multiple_types"
:value="index"
@ -96,11 +95,11 @@
errors: [ String, Object, Array ]
},
created(){
this.fetchTaxonomies().then(() => {
if ( this.value ) {
this.taxonomy_id = this.value.taxonomy_id;
}
});
this.fetchTaxonomies();
if ( this.value ) {
this.taxonomy_id = this.value.taxonomy_id;
}
if( this.value ) {
this.allow_new_terms = ( this.value.allow_new_terms ) ? this.value.allow_new_terms : 'no';
@ -112,6 +111,13 @@
this.isReady = true;
},
watch: {
input_type(val, oldValue) {
if (val != oldValue) {
this.emitValues();
}
}
},
computed: {
listInputType(){
if( this.metadatum && this.metadatum.multiple === 'no' ){
@ -158,6 +164,7 @@
this.taxonomyMessage = message;
},
fetchTaxonomies(){
return axios.get('/taxonomies?nopaging=1&order=asc&orderby=title')
.then(res => {
let taxonomies = res.data;