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

This commit is contained in:
weryques 2018-03-15 10:43:27 -03:00
commit 1747b53b2d
2 changed files with 20 additions and 7 deletions

View File

@ -47,7 +47,7 @@
<div class="shown-items"> <div class="shown-items">
{{ {{
$i18n.get('info_showing_items') + $i18n.get('info_showing_items') +
(itemsPerPage*(page - 1) + 1) + getFirstItem() +
$i18n.get('info_to') + $i18n.get('info_to') +
getLastItemNumber() + getLastItemNumber() +
$i18n.get('info_of') + totalItems + '.' $i18n.get('info_of') + totalItems + '.'
@ -100,6 +100,11 @@ export default {
isLoading: false isLoading: false
} }
}, },
watch: {
page( value ){
this.page = ( value > 0 ) ? value : 1;
}
},
components: { components: {
ItemsList, ItemsList,
FiltersItemsList FiltersItemsList
@ -185,6 +190,12 @@ export default {
let last = (Number(this.itemsPerPage*(this.page - 1)) + Number(this.itemsPerPage)); let last = (Number(this.itemsPerPage*(this.page - 1)) + Number(this.itemsPerPage));
return last > this.totalItems ? this.totalItems : last; return last > this.totalItems ? this.totalItems : last;
},
getFirstItem(){
if( this.totalItems == 0 )
return 0;
return ( this.itemsPerPage * ( this.page - 1 ) + 1)
} }
}, },
computed: { computed: {

View File

@ -99,6 +99,7 @@
getValuesPlainText( field_id ){ getValuesPlainText( field_id ){
return axios.get( '/collection/' + this.collection + '/fields/' + field_id + '?fetch=all_field_values') return axios.get( '/collection/' + this.collection + '/fields/' + field_id + '?fetch=all_field_values')
.then( res => { .then( res => {
if( res.data ){
for (let metadata of res.data) { for (let metadata of res.data) {
let index = this.options.findIndex(itemMetadata => itemMetadata.value === metadata.mvalue); let index = this.options.findIndex(itemMetadata => itemMetadata.value === metadata.mvalue);
if( index < 0 ){ if( index < 0 ){
@ -106,6 +107,7 @@
} }
} }
}
}) })
.catch(error => { .catch(error => {
console.log(error); console.log(error);