Merge branch 'develop' of https://github.com/tainacan/tainacan into develop

This commit is contained in:
mateuswetah 2018-03-23 11:46:27 -03:00
commit a7923b0a4d
12 changed files with 45 additions and 32 deletions

View File

@ -105,7 +105,7 @@
val.push( term_id );
axios.patch(`/item/${this.item_id}/metadata/${this.field_id}`, {
values: val,
}).then( res => {
}).then( () => {
instance.$emit('newTerm', val);
})
}

View File

@ -42,7 +42,7 @@
value: [ Number, String, Array ]
},
methods: {
onChecked(option) {
onChecked() {
this.$emit('blur');
this.onInput(this.checked)
},

View File

@ -38,7 +38,7 @@
value: [ Number, String, Array ]
},
methods: {
onChecked(option) {
onChecked() {
this.$emit('blur');
this.onInput(this.checked)
},

View File

@ -23,7 +23,7 @@
}
},
watch: {
terms( val ){
terms(){
this.selectedValues();
}
},

View File

@ -124,23 +124,22 @@
if( this.field && this.field.multiple === 'no' ){
let types = Object.keys( this.single_types );
let hasValue = this.value && this.value.input_type && types.indexOf( this.value.input_type ) >= 0;
this.input_type = ( hasValue ) ? this.value.input_type : 'tainacan-category-radio';
this.setInputType( ( hasValue ) ? this.value.input_type : 'tainacan-category-radio' );
return true;
} else {
let types = Object.keys( this.multiple_types );
let hasValue = this.value && this.value.input_type && types.indexOf( this.value.input_type ) >= 0;
this.input_type = ( hasValue ) ? this.value.input_type : 'tainacan-category-checkbox';
this.setInputType( ( hasValue ) ? this.value.input_type : 'tainacan-category-checkbox' );
return false;
}
},
setError(){
if( this.errors && this.errors.taxonomy_id !== '' ){
this.taxonomyType = 'is-danger';
this.taxonomyMessage = this.errors.taxonomy_id;
this.setErrorsAttributes( 'is-danger', this.errors.taxonomy_id );
} else {
this.taxonomyType = '';
this.taxonomyMessage = '';
this.setErrorsAttributes( '', '' );
}
return true;
}
},
data(){
@ -158,6 +157,13 @@
}
},
methods: {
setInputType( input ){
this.input_type = input;
},
setErrorsAttributes( type, message ){
this.taxonomyType = type;
this.taxonomyMessage = message;
},
fetchTaxonomies(){
return axios.get('/taxonomies')
.then(res => {
@ -172,7 +178,6 @@
})
.catch(error => {
console.log(error);
reject(error);
});
},
labelNewTerms(){

View File

@ -142,15 +142,18 @@
computed: {
setError(){
if( this.errors && this.errors.collection_id !== '' ){
this.collectionType = 'is-danger';
this.collectionMessage = this.errors.collection_id;
this.setErrorsAttributes( 'is-danger', this.errors.collection_id );
} else {
this.collectionType = '';
this.collectionMessage = '';
this.setErrorsAttributes( '', '' );
}
return true;
},
},
methods:{
setErrorsAttributes( type, message ){
this.collectionType = type;
this.collectionType = message;
},
fetchCollections(){
return axios.get('/collections')
.then(res => {

View File

@ -83,15 +83,10 @@
this.loading = true;
this.options = [];
let collectionId = ( this.field && this.field.field.field_type_options.collection_id ) ? this.field.field.field_type_options.collection_id : this.collection_id;
axios.get('/collection/'+collectionId+'/items')
axios.get('/collection/'+collectionId+'/items?search=' + query)
.then( res => {
let result = [];
this.loading = false;
result = res.data.filter(item => {
return item.title.toLowerCase()
.indexOf(query.toLowerCase()) > -1;
});
let result = res.data;
for (let item of result) {
this.options.push({ label: item.title, value: item.id })
}

View File

@ -45,12 +45,11 @@
computed: {
setError(){
if( this.errors && this.errors.options !== '' ){
this.optionType = 'is-danger';
this.optionMessage = this.errors.options;
this.setErrorsAttributes( 'is-danger', this.errors.options )
} else {
this.optionType = '';
this.optionMessage = '';
this.setErrorsAttributes( '', '' )
}
return true;
}
},
methods: {
@ -62,6 +61,10 @@
this.$emit('input',{
options: ( this.options.length > 0 ) ? this.options.join('\n') : ''
})
},
setErrorsAttributes( type, message ){
this.optionType = type;
this.optionMessage = message;
}
}
}

View File

@ -48,12 +48,12 @@
let msg = '';
let errors = eventBus.getErrors(this.field.field.id);
if ( errors) {
this.fieldTypeMessage = 'is-danger';
this.setFieldTypeMessage('is-danger');
for (let index in errors) {
msg += errors[index] + '\n';
}
} else {
this.fieldTypeMessage = '';
this.setFieldTypeMessage('');
}
return msg;
}
@ -85,6 +85,9 @@
isTextInputComponent( component ){
let array = ['tainacan-relationship','tainacan-category'];
return !( array.indexOf( component ) >= 0 );
},
setFieldTypeMessage( message ){
this.fieldTypeMessage = message;
}
}
}

View File

@ -37,6 +37,7 @@
<script>
import { tainacan as axios } from '../../../js/axios/axios'
import { filter_type_mixin } from '../filter-types-mixin'
import qs from 'qs';
export default {
created(){
@ -95,7 +96,7 @@
promise = this.getValuesPlainText( this.field, query );
}
promise.then( data => {
promise.then( () => {
this.isLoading = false;
}).catch( error => {
console.log('error select', error );

View File

@ -53,7 +53,7 @@
}
},
methods: {
loadOptions(){deleteFile
loadOptions(){
let promise = null;
this.isLoading = true;

View File

@ -35,12 +35,12 @@
let msg = '';
let errors = eventFilterBus.getErrors( this.filter.id );
if ( errors) {
this.filterTypeMessage = 'is-danger';
this.setFilterTypeMessage('is-danger');
for (let index in errors) {
msg += errors[index] + '\n';
}
} else {
this.filterTypeMessage = '';
this.setFilterTypeMessage('');
}
return msg;
},
@ -61,6 +61,9 @@
eventFilterBus.$emit( 'input', ( event.field_id ) ? event : event.detail[0] );
router.push({ query: {} });
router.push({ query: this.getPostQuery() });
},
setFilterTypeMessage( message ){
this.filterTypeMessage = message;
}
}
}