Merge branch 'develop' of https://github.com/tainacan/tainacan into develop
This commit is contained in:
commit
acf0b45b21
|
@ -46,8 +46,8 @@
|
|||
<div class="table-footer">
|
||||
<div class="shown-items">
|
||||
{{
|
||||
$i18n.get('info_showing_items') +
|
||||
(itemsPerPage*(page - 1) + 1) +
|
||||
$i18n.get('info_showing_items') +
|
||||
getFirstItem() +
|
||||
$i18n.get('info_to') +
|
||||
getLastItemNumber() +
|
||||
$i18n.get('info_of') + totalItems + '.'
|
||||
|
@ -100,6 +100,11 @@ export default {
|
|||
isLoading: false
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
page( value ){
|
||||
this.page = ( value > 0 ) ? value : 1;
|
||||
}
|
||||
},
|
||||
components: {
|
||||
ItemsList,
|
||||
FiltersItemsList
|
||||
|
@ -185,6 +190,12 @@ export default {
|
|||
let last = (Number(this.itemsPerPage*(this.page - 1)) + Number(this.itemsPerPage));
|
||||
|
||||
return last > this.totalItems ? this.totalItems : last;
|
||||
},
|
||||
getFirstItem(){
|
||||
if( this.totalItems == 0 )
|
||||
return 0;
|
||||
|
||||
return ( this.itemsPerPage * ( this.page - 1 ) + 1)
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
|
@ -48,7 +48,8 @@ class TAINACAN_REST_Filters_Controller extends TAINACAN_REST_Controller {
|
|||
array(
|
||||
'methods' => WP_REST_Server::READABLE,
|
||||
'callback' => array($this, 'get_items'),
|
||||
'permission_callback' => array($this, 'get_items_permissions_check')
|
||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||
'args' => $this->get_collection_params()
|
||||
),
|
||||
array(
|
||||
'methods' => WP_REST_Server::CREATABLE,
|
||||
|
@ -60,7 +61,8 @@ class TAINACAN_REST_Filters_Controller extends TAINACAN_REST_Controller {
|
|||
array(
|
||||
'methods' => WP_REST_Server::READABLE,
|
||||
'callback' => array($this, 'get_items'),
|
||||
'permission_callback' => array($this, 'get_items_permissions_check')
|
||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||
'args' => $this->get_collection_params()
|
||||
),
|
||||
array(
|
||||
'methods' => WP_REST_Server::CREATABLE,
|
||||
|
|
|
@ -99,12 +99,14 @@
|
|||
getValuesPlainText( field_id ){
|
||||
return axios.get( '/collection/' + this.collection + '/fields/' + field_id + '?fetch=all_field_values')
|
||||
.then( res => {
|
||||
for (let metadata of res.data) {
|
||||
let index = this.options.findIndex(itemMetadata => itemMetadata.value === metadata.mvalue);
|
||||
if( index < 0 ){
|
||||
this.options.push({ label: metadata.mvalue, value: metadata.mvalue })
|
||||
}
|
||||
if( res.data ){
|
||||
for (let metadata of res.data) {
|
||||
let index = this.options.findIndex(itemMetadata => itemMetadata.value === metadata.mvalue);
|
||||
if( index < 0 ){
|
||||
this.options.push({ label: metadata.mvalue, value: metadata.mvalue })
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
|
|
|
@ -142,7 +142,7 @@ class Fields extends Repository {
|
|||
'field_type_options' => [ // not showed in form
|
||||
'map' => 'meta',
|
||||
'title' => __('Field Type options', 'tainacan'),
|
||||
'type' => 'array',
|
||||
'type' => 'array/object',
|
||||
'description'=> __('Options specific for field type', 'tainacan'),
|
||||
'default' => [],
|
||||
// 'validation' => ''
|
||||
|
@ -152,6 +152,7 @@ class Fields extends Repository {
|
|||
'title' => __('Collection', 'tainacan'),
|
||||
'type' => 'integer/string',
|
||||
'description'=> __('The collection ID', 'tainacan'),
|
||||
'default' => ''
|
||||
//'validation' => ''
|
||||
],
|
||||
'accept_suggestion' => [
|
||||
|
@ -663,9 +664,8 @@ class Fields extends Repository {
|
|||
);
|
||||
|
||||
$pre_result = $wpdb->get_results( $sql_string, ARRAY_A );
|
||||
|
||||
if (!empty($pre_result)) {
|
||||
$results[] = $pre_result[0];
|
||||
$results[] = $pre_result;
|
||||
}
|
||||
}
|
||||
} elseif ( current_user_can( $capabilities->read_private_posts) ) {
|
||||
|
@ -694,7 +694,7 @@ class Fields extends Repository {
|
|||
$pre_result = $wpdb->get_results( $sql_string, ARRAY_A );
|
||||
|
||||
if (!empty($pre_result)) {
|
||||
$results[] = $pre_result[0];
|
||||
$results[] = $pre_result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -485,7 +485,7 @@ class TAINACAN_REST_Metadata_Controller extends TAINACAN_UnitApiTestCase {
|
|||
$data1 = $response1->get_data();
|
||||
|
||||
$this->assertCount(1, $data1);
|
||||
$this->assertEquals('12/12/2017', $data1[0]['mvalue']);
|
||||
$this->assertEquals('12/12/2017', $data1[0][0]['mvalue']);
|
||||
|
||||
//=======================
|
||||
|
||||
|
@ -497,7 +497,7 @@ class TAINACAN_REST_Metadata_Controller extends TAINACAN_UnitApiTestCase {
|
|||
$data1 = $response1->get_data();
|
||||
|
||||
$this->assertCount(1, $data1);
|
||||
$this->assertEquals('12/12/2017', $data1[0]['mvalue']);
|
||||
$this->assertEquals('12/12/2017', $data1[0][0]['mvalue']);
|
||||
|
||||
//=======================
|
||||
|
||||
|
@ -509,8 +509,8 @@ class TAINACAN_REST_Metadata_Controller extends TAINACAN_UnitApiTestCase {
|
|||
$data2 = $response2->get_data();
|
||||
|
||||
$this->assertCount(2, $data2);
|
||||
$this->assertEquals('12/12/2017', $data2[0]['mvalue']);
|
||||
$this->assertEquals('02/03/2018', $data2[1]['mvalue']);
|
||||
$this->assertEquals('12/12/2017', $data2[0][0]['mvalue']);
|
||||
$this->assertEquals('02/03/2018', $data2[1][0]['mvalue']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue