diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..7a73a41bf --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/src/admin/class-tainacan-admin.php b/src/admin/class-tainacan-admin.php index 7293e6abf..75b54578d 100644 --- a/src/admin/class-tainacan-admin.php +++ b/src/admin/class-tainacan-admin.php @@ -85,7 +85,8 @@ class Admin { } $settings = [ - 'root' => esc_url_raw( rest_url() ).'tainacan/v2', + 'root' => esc_url_raw( rest_url() ).'tainacan/v2', + 'root_wp_api' => esc_url_raw( rest_url() ), 'nonce' => wp_create_nonce( 'wp_rest' ), 'components' => $components, 'i18n' => $tainacan_admin_i18n, diff --git a/src/admin/components/collections-list.vue b/src/admin/components/collections-list.vue index 5563d217d..3e87fff38 100644 --- a/src/admin/components/collections-list.vue +++ b/src/admin/components/collections-list.vue @@ -8,10 +8,10 @@ v-model="collectionsPerPage" @input="onChangeCollectionsPerPage" :disabled="collections.length <= 0"> - - - - + + + + @@ -52,7 +52,7 @@ - + @@ -94,7 +94,7 @@ export default { isLoading: false, totalCollections: 0, page: 1, - collectionsPerPage: 2 + collectionsPerPage: 12 } }, methods: { @@ -107,13 +107,13 @@ export default { ]), deleteOneCollection(collectionId) { this.$dialog.confirm({ - message: this.$i18n.get('info_warning_collection_deleted'), + message: this.$i18n.get('info_warning_collection_delete'), onConfirm: () => { this.deleteCollection(collectionId).then(() => { this.loadCollections(); this.$toast.open({ duration: 3000, - message: this.$i18n.get('info_collection_delete'), + message: this.$i18n.get('info_collection_deleted'), position: 'is-bottom', type: 'is-secondary', queue: true @@ -174,6 +174,7 @@ export default { }, onChangeCollectionsPerPage(value) { this.collectionsPerPage = value; + this.$userPrefs.set('items_per_page', value); this.loadCollections(); }, onPageChange(page) { @@ -197,6 +198,15 @@ export default { return this.getCollections(); } }, + created() { + this.$userPrefs.get('items_per_page') + .then((value) => { + this.collectionsPerPage = value; + }) + .catch((error) => { + this.$userPrefs.set('items_per_page', 12); + }); + }, mounted(){ this.loadCollections(); } diff --git a/src/admin/components/items-list.vue b/src/admin/components/items-list.vue index 26348c1d3..b5174b684 100644 --- a/src/admin/components/items-list.vue +++ b/src/admin/components/items-list.vue @@ -24,10 +24,10 @@ v-model="itemsPerPage" @input="onChangeItemsPerPage" :disabled="items.length <= 0"> - - - - + + + + @@ -110,7 +110,7 @@ export default { isLoading: false, totalItems: 0, page: 1, - itemsPerPage: 2 + itemsPerPage: 12 } }, props: { @@ -192,6 +192,7 @@ export default { }, onChangeItemsPerPage(value) { this.itemsPerPage = value; + this.$userPrefs.set('items_per_page', value); this.loadItems(); }, goToItemPage(itemId) { @@ -221,6 +222,15 @@ export default { return this.getItems(); } }, + created() { + this.$userPrefs.get('items_per_page') + .then((value) => { + this.itemsPerPage = value; + }) + .catch((error) => { + this.$userPrefs.set('items_per_page', 12); + }); + }, mounted(){ this.loadItems(); this.fetchFields(this.collectionId).then((res) => { @@ -237,7 +247,9 @@ export default { } -