Makes all reference to 96 max per page setting reference the constant #771.

This commit is contained in:
mateuswetah 2023-05-09 14:25:37 -03:00
parent cd5ba1c50c
commit 7adbfa82c9
10 changed files with 21 additions and 30 deletions

View File

@ -70,21 +70,6 @@
$i18n.get('info_of') + totalAttachments + '.'
}}
</div>
<!-- <div class="items-per-page">
<b-field
horizontal
:label="$i18n.get('label_attachments_per_page')">
<b-select
:value="attachmentsPerPage"
@input="onChangeAttachmentsPerPage"
:disabled="attachments.length <= 0">
<option value="12">12</option>
<option value="24">24</option>
<option value="48">48</option>
<option value="96">96</option>
</b-select>
</b-field>
</div> -->
<div class="pagination">
<b-pagination
@change="onPageChange"

View File

@ -59,17 +59,18 @@ import { mapActions } from 'vuex';
export default {
name: 'CollectionsModal',
data(){
data() {
return {
collections: [],
isLoading: false
isLoading: false,
maxCollectionsPerPage: tainacan_plugin.api_max_items_per_page ? Number(tainacan_plugin.api_max_items_per_page) : 96
}
},
mounted() {
this.isLoading = true;
this.fetchCollections({
page: 1,
collectionsPerPage: 96,
collectionsPerPage: this.maxCollectionsPerPage,
contextEdit: true
})
.then((res) => {

View File

@ -116,7 +116,7 @@ export default {
},
data() {
return {
maxItemsPerPage: tainacan_plugin.api_max_items_per_page
maxItemsPerPage: tainacan_plugin.api_max_items_per_page ? Number(tainacan_plugin.api_max_items_per_page) : 96
}
},
computed: {
@ -133,7 +133,7 @@ export default {
return Math.ceil(Number(this.totalItems)/Number(this.itemsPerPage));
},
itemsPerPageOptions() {
const defaultItemsPerPageOptions = [12, 24, 48, 96];
const defaultItemsPerPageOptions = [12, 24, 48, this.maxItemsPerPage];
if (!isNaN(this.itemsPerPage) && !defaultItemsPerPageOptions.includes(this.itemsPerPage))
defaultItemsPerPageOptions.push(this.itemsPerPage);

View File

@ -271,7 +271,7 @@
<option value="12">12</option>
<option value="24">24</option>
<option value="48">48</option>
<option value="96">96</option>
<option :value="maxActivitiesPerPage">{{ maxActivitiesPerPage }}</option>
</b-select>
</b-field>
</div>
@ -312,7 +312,7 @@
<option value="12">12</option>
<option value="24">24</option>
<option value="48">48</option>
<option value="96">96</option>
<option :value="maxActivitiesPerPage">{{ maxActivitiesPerPage }}</option>
</b-select>
</b-field>
</div>
@ -367,7 +367,8 @@
userIdForFiltering: null,
usersForFilteringSearchQuery: '',
usersForFilteringSearchPage: 1,
totalUsers: 0
totalUsers: 0,
maxActivitiesPerPage: tainacan_plugin.api_max_items_per_page ? Number(tainacan_plugin.api_max_items_per_page) : 96
}
},
computed: {

View File

@ -333,7 +333,7 @@
<option value="12">12</option>
<option value="24">24</option>
<option value="48">48</option>
<option value="96">96</option>
<option :value="maxCollectionsPerPage">{{ maxCollectionsPerPage }}</option>
</b-select>
</b-field>
</div>
@ -383,7 +383,8 @@ export default {
{ label: this.$i18n.get('label_title'), value: 'title' },
{ label: this.$i18n.get('label_creation_date'), value: 'date' },
{ label: this.$i18n.get('label_modification_date'), value: 'modified' }
]
],
maxCollectionsPerPage: tainacan_plugin.api_max_items_per_page ? Number(tainacan_plugin.api_max_items_per_page) : 96
}
},
computed: {

View File

@ -212,7 +212,7 @@
<option value="12">12</option>
<option value="24">24</option>
<option value="48">48</option>
<option value="96">96</option>
<option :value="maxTaxonomiesPerPage">{{ maxTaxonomiesPerPage }}</option>
</b-select>
</b-field>
</div>
@ -259,7 +259,8 @@
sortingOptions: [
{ label: this.$i18n.get('label_title'), value: 'title' },
{ label: this.$i18n.get('label_creation_date'), value: 'date' },
]
],
maxTaxonomiesPerPage: tainacan_plugin.api_max_items_per_page ? Number(tainacan_plugin.api_max_items_per_page) : 96
}
},
computed: {

View File

@ -526,7 +526,7 @@ export default function({ attributes, setAttributes, className, isSelected, clie
setContent();
}}
min={ 1 }
max={ 96 }
max={ tainacan_blocks.api_max_items_per_page ? Number(tainacan_blocks.api_max_items_per_page) : 96 }
/>
</div>
</PanelBody>

View File

@ -678,7 +678,7 @@ export default function({ attributes, setAttributes, className, isSelected, clie
setContent();
}}
min={ 1 }
max={ 96 }
max={ tainacan_blocks.api_max_items_per_page ? Number(tainacan_blocks.api_max_items_per_page) : 96 }
/>
<hr></hr>
</div>

View File

@ -521,7 +521,7 @@ export default function({ attributes, setAttributes, className, isSelected, clie
setContent();
}}
min={ 1 }
max={ 96 }
max={ tainacan_blocks.api_max_items_per_page ? Number(tainacan_blocks.api_max_items_per_page) : 96 }
/>
<ToggleControl
label={__('Items count', 'tainacan')}

View File

@ -215,6 +215,7 @@ function tainacan_blocks_get_common_editor_styles() {
*/
function tainacan_blocks_get_plugin_js_settings(){
global $TAINACAN_BASE_URL;
global $TAINACAN_API_MAX_ITEMS_PER_PAGE;
global $wp_version;
$Tainacan_Collections = \Tainacan\Repositories\Collections::get_instance();
@ -229,6 +230,7 @@ function tainacan_blocks_get_plugin_js_settings(){
'root' => esc_url_raw( rest_url() ) . 'tainacan/v2',
'nonce' => is_user_logged_in() ? wp_create_nonce( 'wp_rest' ) : false,
'base_url' => $TAINACAN_BASE_URL,
'api_max_items_per_page' => $TAINACAN_API_MAX_ITEMS_PER_PAGE,
'admin_url' => admin_url(),
'site_url' => site_url(),
'theme_items_list_url' => esc_url_raw( get_site_url() ) . '/' . \Tainacan\Theme_Helper::get_instance()->get_items_list_slug(),