From 7e774a24ac853d42285454ae9f235779ea716b44 Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Mon, 5 Aug 2024 18:15:56 -0300 Subject: [PATCH] Creates select filter for taxonomies and updates max options feature for existing select filter. #912. --- .../repositories/class-tainacan-filters.php | 2 +- src/classes/tainacan-creator.php | 2 +- .../edition/filter-edition-form.vue | 6 +- .../class-tainacan-filter-type-helper.php | 1 + .../selectbox/TainacanFilterSelectbox.vue | 15 +- .../selectbox/class-tainacan-selectbox.php | 2 +- .../filter-types/tainacan-filter-item.vue | 1 + .../taxonomy/TainacanFilterSelectbox.vue | 210 ++++++++++++++++++ .../class-tainacan-taxonomyselectbox.php | 27 +++ .../relationship/TainacanRelationship.vue | 1 + 10 files changed, 255 insertions(+), 12 deletions(-) create mode 100644 src/views/admin/components/filter-types/taxonomy/TainacanFilterSelectbox.vue create mode 100644 src/views/admin/components/filter-types/taxonomy/class-tainacan-taxonomyselectbox.php diff --git a/src/classes/repositories/class-tainacan-filters.php b/src/classes/repositories/class-tainacan-filters.php index 68415bf13..3212b3411 100644 --- a/src/classes/repositories/class-tainacan-filters.php +++ b/src/classes/repositories/class-tainacan-filters.php @@ -107,7 +107,7 @@ class Filters extends Repository { 'map' => 'meta', 'title' => __( 'Max of options', 'tainacan' ), 'type' => ['integer', 'string'], - 'description' => __( 'The max number of options to be showed in filter sidebar.', 'tainacan' ), + 'description' => __( 'The maximum number of options to be loaded by default on the filter.', 'tainacan' ), 'validation' => '', 'default' => 4 ], diff --git a/src/classes/tainacan-creator.php b/src/classes/tainacan-creator.php index 596b3edb5..cbdc58d67 100644 --- a/src/classes/tainacan-creator.php +++ b/src/classes/tainacan-creator.php @@ -111,7 +111,7 @@ function tainacan_autoload($class_name) { } if( in_array('Metadata_Types', $class_path) || in_array('Filter_Types', $class_path) ){ - $exceptions = ['taxonomytaginput','taxonomycheckbox']; + $exceptions = ['taxonomytaginput','taxonomycheckbox','taxonomyselectbox']; if( in_array( strtolower( $class_name ), $exceptions) ){ $dir.= 'taxonomy/'; }else{ diff --git a/src/views/admin/components/edition/filter-edition-form.vue b/src/views/admin/components/edition/filter-edition-form.vue index 1486caba1..d8ec40059 100644 --- a/src/views/admin/components/edition/filter-edition-form.vue +++ b/src/views/admin/components/edition/filter-edition-form.vue @@ -179,7 +179,8 @@ v-model="form.max_options" name="max_options" type="number" - step="1" /> + step="1" + :max="maxOptionsLimit" />