fix errors on create term in field type category

This commit is contained in:
Eduardo humberto 2018-03-20 16:03:15 -03:00
parent c75140b2f3
commit 4401ac95b9
5 changed files with 23 additions and 9 deletions

View File

@ -89,14 +89,16 @@
.then( res => {
instance.name = '';
instance.parent = 0;
if( res.data && res.data.term_id || res.term_id ){
let term_id = ( res.term_id ) ? res.term_id : res.data.term_id;
let val = this.value;
if( !Array.isArray( val ) && this.field.field.multiple === 'no' ){
axios.patch(`/item/${this.item_id}/metadata/${this.field_id}`, {
values: term_id,
}).then( res => {
instance.$emit('newTerm', true);
instance.$emit('newTerm', term_id);
})
} else {
val = ( val ) ? val : [];
@ -104,10 +106,9 @@
axios.patch(`/item/${this.item_id}/metadata/${this.field_id}`, {
values: val,
}).then( res => {
instance.$emit('newTerm', true);
instance.$emit('newTerm', val);
})
}
}
});
}

View File

@ -125,7 +125,9 @@
this.$emit('input', this.inputValue);
this.$emit('blur');
},
reload(){
reload( val ){
this.valueComponent = val;
this.terms = [];
this.getTermsFromTaxonomy();
this.getTermsId();

View File

@ -28,6 +28,11 @@
checked: []
}
},
watch: {
value( val ){
this.checked = val;
}
},
props: {
options: {
type: Array

View File

@ -19,13 +19,14 @@
<script>
export default {
created(){
if( this.value )
this.checked = this.value;
},
data(){
return {
checked:''
checked: ( this.value ) ? this.value : ''
}
},
watch: {
value( val ){
this.checked = val;
}
},
props: {

View File

@ -28,6 +28,11 @@
selected: ''
}
},
watch: {
value( val ){
this.selected = val;
}
},
props: {
id: String,
options: {