diff --git a/src/assets/css/tainacan-gutenberg-block-faceted-search.css b/src/assets/css/tainacan-gutenberg-block-faceted-search.css index b3b4bc955..3c30919ae 100644 --- a/src/assets/css/tainacan-gutenberg-block-faceted-search.css +++ b/src/assets/css/tainacan-gutenberg-block-faceted-search.css @@ -55,6 +55,24 @@ flex-wrap: nowrap; flex-direction: row; flex: 1 0 auto; } + .wp-block-tainacan-faceted-search .items-list-placeholder .below-search-control.horizontal-filters { + flex-direction: column; } + .wp-block-tainacan-faceted-search .items-list-placeholder .below-search-control.horizontal-filters .filters { + flex-direction: row; + flex: 0 1 100%; + flex-wrap: wrap; + padding: 18px 12px 6px 12px; } + .wp-block-tainacan-faceted-search .items-list-placeholder .below-search-control.horizontal-filters .filters .fake-filters-heading { + margin-right: 90%; + top: -0.5em; + left: 0.5em; } + .wp-block-tainacan-faceted-search .items-list-placeholder .below-search-control.horizontal-filters .filters .fake-filters-heading + .fake-link { + margin-right: 95%; + margin-left: 12px; } + .wp-block-tainacan-faceted-search .items-list-placeholder .below-search-control.horizontal-filters .filters .fake-filter { + margin: 6px 12px; + display: inline-flex; + width: var(--tainacan-filters-inline-width, 272px); } .wp-block-tainacan-faceted-search .items-list-placeholder .below-search-control .filters { flex: 0 1 var(--tainacan-filter-menu-width-theme, 20%); display: flex; @@ -64,7 +82,7 @@ display: flex; flex-direction: column; width: 80%; - margin: 5% 12%; } + margin: 5% 8%; } .wp-block-tainacan-faceted-search .items-list-placeholder .below-search-control .filters .fake-filter .fake-text { margin: 4px 0; width: 35%; diff --git a/src/assets/css/tainacan-gutenberg-block-faceted-search.css.map b/src/assets/css/tainacan-gutenberg-block-faceted-search.css.map index 6cb06a426..ec5c6337d 100644 --- a/src/assets/css/tainacan-gutenberg-block-faceted-search.css.map +++ b/src/assets/css/tainacan-gutenberg-block-faceted-search.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAgBA,QAAS;EACL,QAAQ,EAAE,QAAQ;EAClB,KAAK,EAAE,GAAG;EACV,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","../../views/gutenberg-blocks/blocks/faceted-search/style.scss"], "names": [], "file": "tainacan-gutenberg-block-faceted-search.css" diff --git a/src/classes/api/endpoints/class-tainacan-rest-items-controller.php b/src/classes/api/endpoints/class-tainacan-rest-items-controller.php index d25d70d11..5d1d3982c 100644 --- a/src/classes/api/endpoints/class-tainacan-rest-items-controller.php +++ b/src/classes/api/endpoints/class-tainacan-rest-items-controller.php @@ -454,7 +454,7 @@ class REST_Items_Controller extends REST_Controller { * @return array * @throws \Exception */ - private function prepare_filters_arguments ( $args, $collection_id = false ) { + private function prepare_filters_arguments ( $args, $collection_id = false, $ignore_filter_arguments = [] ) { $filters_arguments = array(); $meta_query = isset($args['meta_query']) ? $args['meta_query'] : []; if(isset($meta_query['value'])) $meta_query = [$meta_query]; @@ -498,8 +498,7 @@ class REST_Items_Controller extends REST_Controller { } foreach($meta_query as $meta) { - - if ( !isset($meta['key']) || !isset($meta['value']) ) + if ( !isset($meta['key']) || !isset($meta['value']) || ( in_array($meta['key'], $ignore_filter_arguments) )) continue; $meta_id = $meta['key']; @@ -554,6 +553,7 @@ class REST_Items_Controller extends REST_Controller { $date_format = get_option( 'date_format' ) != false ? get_option( 'date_format' ) : 'Y-m-d'; return empty($date) == false ? mysql2date($date_format, $date) : ""; }, $meta_label); + $meta_type = 'DATE'; break; case 'item': $meta_label = array_map(function($item_id) { @@ -643,7 +643,15 @@ class REST_Items_Controller extends REST_Controller { if($request['collection_id']) { $collection_id = $request['collection_id']; } - $filters_args = $this->prepare_filters_arguments($args, $collection_id); + $metaqueries = isset($request['metaquery']) ? $request['metaquery'] : []; + $ignore_filter_arguments = array_map( + function($metaquery) { return $metaquery['key']; }, + array_filter( + $metaqueries, + function($metaquery) { return isset($metaquery['key']) && isset($metaquery['secondary']) && $metaquery['secondary'] == 'true'; } + ) + ); + $filters_args = $this->prepare_filters_arguments($args, $collection_id, $ignore_filter_arguments); if(isset($args['meta_query']) && !empty($args['meta_query']) && is_array($filters_args) && !empty($filters_args)) { foreach($filters_args as $filters_arg) { if($filters_arg['filter'] !== false) { diff --git a/src/classes/entities/class-tainacan-filter.php b/src/classes/entities/class-tainacan-filter.php index 069f8f2a1..2adff81d1 100644 --- a/src/classes/entities/class-tainacan-filter.php +++ b/src/classes/entities/class-tainacan-filter.php @@ -20,7 +20,8 @@ class Filter extends Entity { $filter_type, $filter_type_options, $begin_with_filter_collapsed, - $display_in_repository_level_lists; + $display_in_repository_level_lists, + $description_bellow_name; static $post_type = 'tainacan-filter'; public $enabled_for_collection = true; @@ -72,9 +73,16 @@ class Filter extends Entity { /** * @return mixed|null */ - function get_description(){ + function get_description() { return $this->get_mapped_property('description'); } + + /** + * @return mixed|null + */ + function get_placeholder() { + return $this->get_mapped_property('placeholder'); + } /** * Return the filter order type @@ -188,7 +196,15 @@ class Filter extends Entity { public function get_display_in_repository_level_lists() { return $this->get_mapped_property('display_in_repository_level_lists'); } - + + /** + * Return the filter description_bellow_name + * + * @return string + */ + function get_description_bellow_name() { + return $this->get_mapped_property('description_bellow_name'); + } /** * Define the filter name @@ -220,6 +236,16 @@ class Filter extends Entity { $this->set_mapped_property('description', $value); } + /** + * Define the filter placeholder + * + * @param [string] $value + * @return void + */ + function set_placeholder($value) { + $this->set_mapped_property('placeholder', $value); + } + /** * Define the filter metadatum passing an object * @@ -284,6 +310,16 @@ class Filter extends Entity { $this->enabled_for_collection = $value; } + /** + * Set filter description_bellow_name + * + * @param [string] $value If the description will be displayed below the name instead of inside a tooltip (yes/no) + * @return void + */ + function set_description_bellow_name($value) { + $this->set_mapped_property('description_bellow_name', $value); + } + /** * {@inheritdoc } diff --git a/src/classes/importer/class-tainacan-csv.php b/src/classes/importer/class-tainacan-csv.php index ee8d0d30d..2c355ac54 100644 --- a/src/classes/importer/class-tainacan-csv.php +++ b/src/classes/importer/class-tainacan-csv.php @@ -697,6 +697,7 @@ class CSV extends Importer { remove_action( 'post_updated', 'wp_save_post_revision' ); $collections = $this->get_collections(); $collection_definition = isset($collections[$collection_index]) ? $collections[$collection_index] : false; + if ( !$collection_definition || !is_array($collection_definition) || !isset($collection_definition['id']) || !isset($collection_definition['mapping']) ) { $this->add_error_log('Collection misconfigured'); return false; @@ -712,7 +713,7 @@ class CSV extends Importer { $Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance(); $Tainacan_Item_Metadata = \Tainacan\Repositories\Item_Metadata::get_instance(); $Tainacan_Items = \Tainacan\Repositories\Items::get_instance(); - + $special_columns = false; $itemMetadataArray = []; @@ -731,7 +732,7 @@ class CSV extends Importer { $item = new Entities\Item(); } - if( is_numeric($this->get_transient('item_id')) ) { + if ( is_numeric($this->get_transient('item_id')) ) { if ( $item instanceof Entities\Item && $item->get_id() == $this->get_transient('item_id') ) { if ( ! $item->can_edit() ) { $this->add_error_log("You don't have permission to edit item:" . $item->get_id() ); @@ -748,12 +749,12 @@ class CSV extends Importer { } - if( $this->get_transient('item_id') && $item instanceof Entities\Item && is_numeric($item->get_id()) && $item->get_id() > 0 && $this->get_transient('item_action') == 'ignore' ){ + if ( $this->get_transient('item_id') && $item instanceof Entities\Item && is_numeric($item->get_id()) && $item->get_id() > 0 && $this->get_transient('item_action') == 'ignore' ){ $this->add_log('Ignoring repeated Item'); return $item; } - if( is_array( $processed_item ) ) { + if ( is_array( $processed_item ) ) { foreach ( $processed_item as $metadatum_source => $values ) { if ($metadatum_source == 'special_document' || @@ -820,81 +821,89 @@ class CSV extends Importer { } } - if( (!empty( $itemMetadataArray ) || $special_columns) && $collection instanceof Entities\Collection ) { - $item->set_collection( $collection ); - if ( !$updating_item ) { - if( $item->validate() ) { - $insertedItem = $Tainacan_Items->insert( $item ); - } else { - $this->add_error_log( 'Error inserting Item Title: ' . $item->get_title() ); - $this->add_error_log( $item->get_errors() ); - return false; - } - } else { - $insertedItem = $item; - } - global $wpdb; - $wpdb->query( 'SET autocommit = 0;' ); - foreach ( $itemMetadataArray as $itemMetadata ) { - if($itemMetadata instanceof Entities\Item_Metadata_Entity ) { - $itemMetadata->set_item( $insertedItem ); // *I told you - if( $itemMetadata->validate() ) { - $Tainacan_Item_Metadata->insert( $itemMetadata ); - } else { - $insertedItemId = $updating_item == true ? ' (special_item_id: ' . $insertedItem->get_id() . ')' : ''; - $this->add_error_log('Error saving value for ' . $itemMetadata->get_metadatum()->get_name() . " in item " . $insertedItem->get_title() . $insertedItemId); - $this->add_error_log($itemMetadata->get_errors()); - continue; - } - } elseif ( is_array($itemMetadata) ) { - if($updating_item == true) { - $this->deleteAllValuesCompoundItemMetadata($insertedItem, $itemMetadata[0][0]->get_metadatum()->get_parent()); - } - foreach($itemMetadata as $compoundItemMetadata) { - $parent_meta_id = null; - foreach($compoundItemMetadata as $itemChildren) { - $itemChildren->set_parent_meta_id($parent_meta_id); - if( $itemChildren->validate() ) { - $item_children_metadata = $Tainacan_Item_Metadata->insert($itemChildren); - $parent_meta_id = $item_children_metadata->get_parent_meta_id(); - } else { - $this->add_error_log('Error saving value for ' . $itemChildren->get_metadatum()->get_name() . " in item " . $insertedItem->get_title()); - $this->add_error_log($itemChildren->get_errors()); - continue; - } - } - } - } - - //if( $result ){ - // $values = ( is_array( $itemMetadata->get_value() ) ) ? implode( PHP_EOL, $itemMetadata->get_value() ) : $itemMetadata->get_value(); - // $this->add_log( 'Item ' . $insertedItem->get_id() . - // ' has inserted the values: ' . $values . ' on metadata: ' . $itemMetadata->get_metadatum()->get_name() ); - //} else { - // $this->add_error_log( 'Item ' . $insertedItem->get_id() . ' has an error' ); - //} - } - $wpdb->query( 'COMMIT;' ); - $wpdb->query( 'SET autocommit = 1;' ); - - if ( ! $updating_item ) { - $insertedItem->set_status('publish' ); - } - - if($insertedItem->validate()) { - $insertedItem = $Tainacan_Items->update( $insertedItem ); - $this->after_inserted_item( $insertedItem, $collection_index ); - } else { - $this->add_error_log( 'Error publishing, Item Title: ' . $insertedItem->get_title() ); - $this->add_error_log( 'Error publishing, Item ID: ' . $insertedItem->get_id() ); - $this->add_error_log( $insertedItem->get_errors() ); - return false; - } - return $insertedItem; - } else { + if ( !( $collection instanceof Entities\Collection ) ) { $this->add_error_log( 'Collection not set'); return false; } + + if ( ( empty( $itemMetadataArray ) && !$special_columns ) ) { + $this->add_log( 'Found one empty value' ); + return false; + } + + + $item->set_collection( $collection ); + if ( !$updating_item ) { + if( $item->validate() ) { + $insertedItem = $Tainacan_Items->insert( $item ); + } else { + $this->add_error_log( 'Error inserting Item Title: ' . $item->get_title() ); + $this->add_error_log( $item->get_errors() ); + return false; + } + } else { + $insertedItem = $item; + } + + global $wpdb; + $wpdb->query( 'SET autocommit = 0;' ); + + foreach ( $itemMetadataArray as $itemMetadata ) { + if($itemMetadata instanceof Entities\Item_Metadata_Entity ) { + $itemMetadata->set_item( $insertedItem ); // *I told you + if( $itemMetadata->validate() ) { + $Tainacan_Item_Metadata->insert( $itemMetadata ); + } else { + $insertedItemId = $updating_item == true ? ' (special_item_id: ' . $insertedItem->get_id() . ')' : ''; + $this->add_error_log('Error saving value for ' . $itemMetadata->get_metadatum()->get_name() . " in item " . $insertedItem->get_title() . $insertedItemId); + $this->add_error_log($itemMetadata->get_errors()); + continue; + } + } elseif ( is_array($itemMetadata) ) { + if($updating_item == true) { + $this->deleteAllValuesCompoundItemMetadata($insertedItem, $itemMetadata[0][0]->get_metadatum()->get_parent()); + } + foreach($itemMetadata as $compoundItemMetadata) { + $parent_meta_id = null; + foreach($compoundItemMetadata as $itemChildren) { + $itemChildren->set_parent_meta_id($parent_meta_id); + if( $itemChildren->validate() ) { + $item_children_metadata = $Tainacan_Item_Metadata->insert($itemChildren); + $parent_meta_id = $item_children_metadata->get_parent_meta_id(); + } else { + $this->add_error_log('Error saving value for ' . $itemChildren->get_metadatum()->get_name() . " in item " . $insertedItem->get_title()); + $this->add_error_log($itemChildren->get_errors()); + continue; + } + } + } + } + + //if( $result ){ + // $values = ( is_array( $itemMetadata->get_value() ) ) ? implode( PHP_EOL, $itemMetadata->get_value() ) : $itemMetadata->get_value(); + // $this->add_log( 'Item ' . $insertedItem->get_id() . + // ' has inserted the values: ' . $values . ' on metadata: ' . $itemMetadata->get_metadatum()->get_name() ); + //} else { + // $this->add_error_log( 'Item ' . $insertedItem->get_id() . ' has an error' ); + //} + } + $wpdb->query( 'COMMIT;' ); + $wpdb->query( 'SET autocommit = 1;' ); + + if ( ! $updating_item ) { + $insertedItem->set_status('publish' ); + } + + if ( $insertedItem->validate() ) { + $insertedItem = $Tainacan_Items->update( $insertedItem ); + $this->after_inserted_item( $insertedItem, $collection_index ); + } else { + $this->add_error_log( 'Error publishing, Item Title: ' . $insertedItem->get_title() ); + $this->add_error_log( 'Error publishing, Item ID: ' . $insertedItem->get_id() ); + $this->add_error_log( $insertedItem->get_errors() ); + return false; + } + return $insertedItem; } private function is_assoc(array $arr) { diff --git a/src/classes/repositories/class-tainacan-collections.php b/src/classes/repositories/class-tainacan-collections.php index 8a39617cd..d547cfefa 100644 --- a/src/classes/repositories/class-tainacan-collections.php +++ b/src/classes/repositories/class-tainacan-collections.php @@ -132,7 +132,7 @@ class Collections extends Repository { 'title' => __( 'Enabled view modes', 'tainacan' ), 'type' => 'array', 'description' => __( 'Which visualization modes will be available for the public to choose from', 'tainacan' ), - 'default' => [ 'table', 'cards' ], + 'default' => [ 'table', 'cards', 'masonry' ], 'items' => [ 'type' => 'string' ], //'validation' => v::stringType(), ], diff --git a/src/classes/repositories/class-tainacan-filters.php b/src/classes/repositories/class-tainacan-filters.php index 6affb9fe3..68415bf13 100644 --- a/src/classes/repositories/class-tainacan-filters.php +++ b/src/classes/repositories/class-tainacan-filters.php @@ -110,7 +110,24 @@ class Filters extends Repository { 'description' => __( 'The max number of options to be showed in filter sidebar.', 'tainacan' ), 'validation' => '', 'default' => 4 - ] + ], + 'placeholder' => [ + 'map' => 'meta', + 'title' => __( 'Placeholder', 'tainacan' ), + 'type' => 'string', + 'description' => __( 'The filter input placeholder. This is a simple message that will appear inside textual input and may indicate to the user what kind of information is expected.', 'tainacan' ), + 'default' => '', + ], + 'description_bellow_name' => [ + 'map' => 'meta', + 'title' => __( 'Description below name', 'tainacan' ), + 'type' => 'string', + 'description' => __( 'Whether the filter description should be displayed below the input label instead of inside a tooltip.', 'tainacan' ), + 'on_error' => __( 'Please set the "Description below name" value as "yes" or "no"', 'tainacan' ), + 'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no + 'enum' => [ 'yes', 'no' ], + 'default' => 'no' + ], ] ); } diff --git a/src/classes/theme-helper/class-tainacan-theme-helper.php b/src/classes/theme-helper/class-tainacan-theme-helper.php index 422e9482d..49690a75a 100644 --- a/src/classes/theme-helper/class-tainacan-theme-helper.php +++ b/src/classes/theme-helper/class-tainacan-theme-helper.php @@ -37,7 +37,7 @@ class Theme_Helper { // Replace collections permalink to post type archive if cover not enabled add_filter('post_type_link', array($this, 'permalink_filter'), 10, 3); - // Replace single query to the page content set as cover for the colllection + // Replace single query to the page content set as cover for the collection // Redirect to post type archive if no cover page is set add_action('wp', array($this, 'collection_single_redirect')); @@ -512,6 +512,9 @@ class Theme_Helper { * @type string $default_view_mode The default view mode * @type bool $is_forced_view_mode Ignores user prefs to always render the choosen default view mode * @type string[] $enabled_view_modes The list os enable view modes to display + * @type bool $should_not_hide_filters_on_mobile Disables the default behavior of automatically collapsing the filters inside a modal when in small screen sizes + * @type bool $display_filters_horizontally Display the filters in an horizontal panel above search control instead of a sidebar + * @type bool $hide_filter_collapses Hides the button that collapses all filters inside the filters panel * @return string The HTML div to be used for rendering the items list vue component */ public function search_shortcode($args) { @@ -617,7 +620,10 @@ class Theme_Helper { 'data-start-with-filters-hidden' => true, 'data-filters-as-modal' => true, 'data-show-inline-view-mode-options' => true, - 'data-show-fullscreen-with-view-modes' => true + 'data-show-fullscreen-with-view-modes' => true, + 'data-should-not-hide-filters-on-mobile' => true, + 'data-display-filters-horizontally' => true, + 'data-hide-filter-collapses' => true ] ]; @@ -2479,5 +2485,23 @@ class Theme_Helper { 'requires_thumbnail' => false, 'placeholder_template' => $map_view_mode_placeholder ]); + + $this->register_view_mode('mosaic', [ + 'label' => __('Mosaic', 'tainacan'), + 'dynamic_metadata' => false, + 'description' => __('A mosaic view, similar to Flickr and Google Photos, which will display images without cropping.', 'tainacan'), + 'icon' => '', + 'type' => 'component', + 'implements_skeleton' => true, + 'placeholder_template' => '' + ]); } } diff --git a/src/readme.txt b/src/readme.txt index ba8f58e37..d9581fcaf 100644 --- a/src/readme.txt +++ b/src/readme.txt @@ -4,7 +4,7 @@ Tags: museums, archives, GLAM, collections, repository Requires at least: 5.9 Tested up to: 6.5 Requires PHP: 7.0 -Stable tag: 0.21.6 +Stable tag: 0.21.7 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-3.0.html diff --git a/src/tainacan.php b/src/tainacan.php index ee459dfe1..0ef59fb9a 100644 --- a/src/tainacan.php +++ b/src/tainacan.php @@ -5,17 +5,17 @@ Plugin URI: https://tainacan.org/ Description: Open source, powerful and flexible repository platform for WordPress. Manage and publish you digital collections as easily as publishing a post to your blog, while having all the tools of a professional repository platform. Author: Tainacan.org Author URI: https://tainacan.org/ -Version: 0.21.6 +Version: 0.21.7 Requires at least: 5.9 Tested up to: 6.5 Requires PHP: 7.0 -Stable tag: 0.21.6 +Stable tag: 0.21.7 Text Domain: tainacan License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-3.0.html */ -const TAINACAN_VERSION = '0.21.6'; +const TAINACAN_VERSION = '0.21.7'; defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); $TAINACAN_BASE_URL = plugins_url('', __FILE__); diff --git a/src/views/admin/admin.vue b/src/views/admin/admin.vue index 8e9747a1d..c498570d4 100644 --- a/src/views/admin/admin.vue +++ b/src/views/admin/admin.vue @@ -5,46 +5,48 @@ :class="{ 'tainacan-admin-mobile-app-mode': $adminOptions.mobileAppMode }"> - - @@ -70,7 +72,8 @@ return { isMenuCompressed: false, isRepositoryLevel : true, - activeRoute: '/collections' + activeRoute: '/collections', + hasPermalinksStructure: false } }, computed: { @@ -105,19 +108,44 @@ } }, created() { - this.$statusHelper.loadStatuses(); - this.$userPrefs.init(); - this.isMenuCompressed = (this.$route.params.collectionId != undefined); - this.activeRoute = this.$route.name; - this.isRepositoryLevel = this.$route.params.collectionId == undefined; - if (jQuery && jQuery( document )) { - jQuery( document ).ajaxError(this.onHeartBitError); + this.hasPermalinksStructure = tainacan_plugin.has_permalinks_structure; + + if ( this.hasPermalinksStructure ) { + this.$statusHelper.loadStatuses(); + this.$userPrefs.init(); + this.isMenuCompressed = (this.$route.params.collectionId != undefined); + this.activeRoute = this.$route.name; + this.isRepositoryLevel = this.$route.params.collectionId == undefined; + + if (jQuery && jQuery( document )) { + jQuery( document ).ajaxError(this.onHeartBitError); + } + } else { + this.onPermalinksError(); } }, methods: { + onPermalinksError() { + this.$buefy.modal.open({ + component: CustomDialog, + props: { + title: this.$i18n.get('error_permalinks_label'), + message: this.$i18n.getWithVariables('error_permalinks_detail', [ '', '' ]), + hideCancel: true, + confirmText: this.$i18n.get('label_go_to_permalinks'), + onConfirm: () => { + window.location.href = tainacan_plugin.admin_url + 'options-permalink.php'; + } + }, + ariaRole: 'alertdialog', + ariaModal: true, + customClass: 'tainacan-modal', + canCancel: false, + }); + }, onHeartBitError(event, jqxhr, settings) { - if (settings && settings.url == '/wp-admin/admin-ajax.php') { + if (settings && settings.url == tainacan_plugin.admin_url + 'admin-ajax.php') { this.$buefy.snackbar.open({ message: this.$i18n.get('error_connectivity'), type: 'is-danger', diff --git a/src/views/admin/components/edition/filter-edition-form.vue b/src/views/admin/components/edition/filter-edition-form.vue index e3c609502..1486caba1 100644 --- a/src/views/admin/components/edition/filter-edition-form.vue +++ b/src/views/admin/components/edition/filter-edition-form.vue @@ -49,6 +49,45 @@ @focus="clearErrors('description')" /> + +   + + + + + + + + + + { this.form = {}; @@ -355,7 +408,7 @@ export default { let formObj = {}; for (let [key, value] of formData.entries()) { - if (key === 'begin_with_filter_collapsed' || key === 'display_in_repository_level_lists') + if (key === 'begin_with_filter_collapsed' || key === 'display_in_repository_level_lists' || key === 'description_bellow_name' ) formObj[key] = (value == 'yes' || value == true) ? 'yes' : 'no'; else formObj[key] = value; @@ -364,9 +417,10 @@ export default { formObj['begin_with_filter_collapsed'] = 'no'; if (formObj['display_in_repository_level_lists'] === undefined) formObj['display_in_repository_level_lists'] = 'no'; + if (formObj['description_bellow_name'] === undefined) + formObj['description_bellow_name'] = 'no'; this.fillExtraFormData(formObj); - this.isLoading = true; this.updateFilter({ filterId: filter.id, index: this.index, options: formObj }) .then(() => { this.form = {}; @@ -418,7 +472,7 @@ export default { -webkit-column-gap: 0; -webkit-column-rule: none; column-count: 2; - column-gap: 4em; + column-gap: 3em; column-rule: none; padding-bottom: 0.5em; diff --git a/src/views/admin/components/edition/item-bulk-edition-form.vue b/src/views/admin/components/edition/item-bulk-edition-form.vue index 4a0df4292..6c36974c6 100644 --- a/src/views/admin/components/edition/item-bulk-edition-form.vue +++ b/src/views/admin/components/edition/item-bulk-edition-form.vue @@ -110,7 +110,7 @@ v-if="item.document != '' && item.document_type != 'empty'" v-tooltip="{ delay: { - shown: 500, + show: 500, hide: 300, }, content: $i18n.get('label_document_uploaded'), @@ -128,7 +128,7 @@ - {{ option.label }} + + {{ option.label }} +  {{ "(" + option.total_items + ")" }} + class="facet-item-count has-text-gray"> {{ "(" + option.total_items + ")" }} + + +
+ + + +
+
@@ -102,15 +122,50 @@ data() { return { step: [Number, String], - showEditStepOptions: false + showEditStepOptions: false, + comparatorsObject: Object, + comparators: Array } }, created() { this.step = this.modelValue && this.modelValue.step ? this.modelValue.step : 1; + this.comparators = ( this.modelValue && this.modelValue.comparators ) ? this.modelValue.comparators : [ '=', '!=', '>', '>=', '<', '<=' ]; + this.comparatorsObject = { + '=': { + symbol: '=', + label: this.$i18n.get('is_equal_to'), + enabled: this.comparators.indexOf('=') < 0 ? 'no' : 'yes' + }, + '!=': { + symbol: '≠', + label: this.$i18n.get('is_not_equal_to'), + enabled: this.comparators.indexOf('!=') < 0 ? 'no' : 'yes' + }, + '>': { + symbol: '>', + label: this.$i18n.get('after'), + enabled: this.comparators.indexOf('>') < 0 ? 'no' : 'yes' + }, + '>=': { + symbol: '≥', + label: this.$i18n.get('after_or_on_day'), + enabled: this.comparators.indexOf('>=') < 0 ? 'no' : 'yes' + }, + '<': { + symbol: '<', + label: this.$i18n.get('before'), + enabled: this.comparators.indexOf('<') < 0 ? 'no' : 'yes' + }, + '<=': { + symbol: '≤', + label: this.$i18n.get('before_or_on_day'), + enabled: this.comparators.indexOf('<=') < 0 ? 'no' : 'yes' + } + }; }, methods: { - onUpdateStep(modelValue) { - this.$emit('update:model-value', { step: modelValue }); + emitValues() { + this.$emit('update:model-value', { step: this.step, comparators: this.comparators }); } } } diff --git a/src/views/admin/components/filter-types/numeric/TainacanFilterNumeric.vue b/src/views/admin/components/filter-types/numeric/TainacanFilterNumeric.vue index 4d6a77ea2..fed6bec47 100644 --- a/src/views/admin/components/filter-types/numeric/TainacanFilterNumeric.vue +++ b/src/views/admin/components/filter-types/numeric/TainacanFilterNumeric.vue @@ -1,6 +1,7 @@ - - =  {{ $i18n.get('is_equal_to') }} - - - ≠  {{ $i18n.get('is_not_equal_to') }} - - - >  {{ $i18n.get('greater_than') }} - - - ≥  {{ $i18n.get('greater_than_or_equal_to') }} - - - <  {{ $i18n.get('less_than') }} - - - ≤  {{ $i18n.get('less_than_or_equal_to') }} - + - @@ -89,19 +59,6 @@ comparator: '=' // =, !=, >, >=, <, <= } }, - computed: { - comparatorSymbol() { - switch(this.comparator) { - case '=': return '='; - case '!=': return '≠'; - case '>': return '>'; - case '>=': return '≥'; - case '<': return '<'; - case '<=': return '≤'; - default: return ''; - } - } - }, watch: { 'query': { handler() { @@ -110,6 +67,41 @@ deep: true } }, + created() { + this.comparatorsObject = { + '=': { + symbol: '=', + label: this.$i18n.get('is_equal_to'), + enabled: this.filterTypeOptions.comparators.indexOf('=') < 0 ? 'no' : 'yes' + }, + '!=': { + symbol: '≠', + label: this.$i18n.get('is_not_equal_to'), + enabled: this.filterTypeOptions.comparators.indexOf('!=') < 0 ? 'no' : 'yes' + }, + '>': { + symbol: '>', + label: this.$i18n.get('greater_than'), + enabled: this.filterTypeOptions.comparators.indexOf('>') < 0 ? 'no' : 'yes' + }, + '>=': { + symbol: '≥', + label: this.$i18n.get('greater_than_or_equal_to'), + enabled: this.filterTypeOptions.comparators.indexOf('>=') < 0 ? 'no' : 'yes' + }, + '<': { + symbol: '<', + label: this.$i18n.get('less_than'), + enabled: this.filterTypeOptions.comparators.indexOf('<') < 0 ? 'no' : 'yes' + }, + '<=': { + symbol: '≤', + label: this.$i18n.get('less_than_or_equal_to'), + enabled: this.filterTypeOptions.comparators.indexOf('<=') < 0 ? 'no' : 'yes' + }, + }; + this.comparator = this.filterTypeOptions.comparators[0]; + }, mounted() { this.updateSelectedValues(); }, @@ -165,15 +157,25 @@ height: auto; align-items: stretch; - @media screen and (min-width: 769px) and (max-width: 1500px) { + @supports not (contain: inline-size) { + @media screen and (min-width: 769px) and (max-width: 1500px) { + flex-wrap: wrap; + height: 60px; + } + } + + @container filterscomponentslist (max-width: 170px) { flex-wrap: wrap; - align-items: center; height: 60px; + + .dropdown { + flex-grow: 2 !important; + } } .dropdown { width: auto; - flex-grow: 2; + flex-grow: 0; .dropdown-trigger button { padding: 2px 0.5em 2px 0.5em !important; diff --git a/src/views/admin/components/filter-types/numeric/class-tainacan-numeric.php b/src/views/admin/components/filter-types/numeric/class-tainacan-numeric.php index b973d8460..e5bb818c7 100644 --- a/src/views/admin/components/filter-types/numeric/class-tainacan-numeric.php +++ b/src/views/admin/components/filter-types/numeric/class-tainacan-numeric.php @@ -16,7 +16,8 @@ class Numeric extends Filter_Type { $this->set_form_component('tainacan-filter-form-numeric'); $this->set_use_max_options(false); $this->set_default_options([ - 'step' => 1 + 'step' => 1, + 'comparators' => [ '=', '!=', '>', '>=', '<', '<=' ] ]); $this->set_preview_template('
@@ -77,6 +78,10 @@ class Numeric extends Filter_Type { 'step' => [ 'title' => __( 'Step', 'tainacan' ), 'description' => __( 'The amount to be increased or decreased when clicking on the filter control buttons. This also defines whether the input accepts decimal numbers.', 'tainacan' ), + ], + 'comparators' => [ + 'title' => __( 'Enabled comparators', 'tainacan' ), + 'description' => __( 'A list of comparators to be available in the filter, such as equal, greater than, smaller than, etc.', 'tainacan' ), ] ]; } @@ -89,13 +94,24 @@ class Numeric extends Filter_Type { if ( !in_array($filter->get_status(), apply_filters('tainacan-status-require-validation', ['publish','future','private'])) ) return true; - if ( empty($this->get_option('step')) ) { - return [ + $errors = []; + + if ( empty($this->get_option('step')) ) + $errors[] = [ 'step' => __('"Step" value is required','tainacan') ]; - } - return true; + if ( empty($this->get_option('comparators')) ) + $errors[] = [ + 'comparators' => __('"Comparators" array is required', 'tainacan') + ]; + + if ( count( $this->get_option('comparators') ) < 1 ) + $errors[] = [ + 'comparators' => __('At least one comparator should be provided', 'tainacan') + ]; + + return count($errors) ? $errors : true; } } @@ -134,6 +150,8 @@ class Numeric_Helper { case '<=': $filter_arguments['label'] = '≤ ' . $filter_arguments['label'][0]; break; + default: + $filter_arguments['label'] = $filter_arguments['label'][0]; } } diff --git a/src/views/admin/components/filter-types/numerics-intersection/FormNumericsIntersection.vue b/src/views/admin/components/filter-types/numerics-intersection/FormNumericsIntersection.vue new file mode 100644 index 000000000..bcab48793 --- /dev/null +++ b/src/views/admin/components/filter-types/numerics-intersection/FormNumericsIntersection.vue @@ -0,0 +1,410 @@ + + + + + \ No newline at end of file diff --git a/src/views/admin/components/filter-types/numerics-intersection/TainacanFilterNumericsIntersection.vue b/src/views/admin/components/filter-types/numerics-intersection/TainacanFilterNumericsIntersection.vue new file mode 100644 index 000000000..8a7520420 --- /dev/null +++ b/src/views/admin/components/filter-types/numerics-intersection/TainacanFilterNumericsIntersection.vue @@ -0,0 +1,150 @@ + + + + + diff --git a/src/views/admin/components/filter-types/numerics-intersection/class-tainacan-numerics-intersection.php b/src/views/admin/components/filter-types/numerics-intersection/class-tainacan-numerics-intersection.php new file mode 100644 index 000000000..3451cf38d --- /dev/null +++ b/src/views/admin/components/filter-types/numerics-intersection/class-tainacan-numerics-intersection.php @@ -0,0 +1,148 @@ +set_name( __('Numerics Intersection', 'tainacan') ); + $this->set_supported_types(['float']); + $this->set_component('tainacan-filter-numerics-intersection'); + $this->set_form_component('tainacan-filter-form-numerics-intersection'); + $this->set_default_options([ + 'step' => 1, + 'secondary_filter_metadatum_id' => '', + 'secondary_filter_metadatum_name' => '', + 'first_comparator' => '>=', + 'second_comparator' => '<=', + 'accept_numeric_interval' => 'no' + ]); + $this->set_use_max_options(false); + $this->set_preview_template(' +
+
+

+ +

+
+ +
+

+ +

+
+
+ '); + } + + public function get_form_labels(){ + return [ + 'step' => [ + 'title' => __( 'Step', 'tainacan' ), + 'description' => __( 'The amount to be increased or decreased when clicking on the filter control buttons. This also defines whether the input accepts decimal numbers.', 'tainacan' ), + ], + 'secondary_filter_metadatum_id' => [ + 'title' => __( 'Second numeric metadatum', 'tainacan' ), + 'description' => __( 'The other metadatum to which this filter will compare values to find if there is an intersection of numeric values.', 'tainacan' ), + ], + 'secondary_filter_metadatum_name' => [ + 'title' => __( 'Second numeric metadatum', 'tainacan' ), + 'description' => __( 'Label of the other metadatum to which this filter will compare values to find if there is an intersection of numeric values.', 'tainacan' ), + ], + 'first_comparator' => [ + 'title' => __( 'First comparator', 'tainacan' ), + 'description' => __( 'Comparator to be used for checking the first metadata value.', 'tainacan' ), + ], + 'second_comparator' => [ + 'title' => __( 'Second comparator', 'tainacan' ), + 'description' => __( 'Comparator to be used for checking the second metadata value.', 'tainacan' ), + ], + 'accept_numeric_interval' => [ + 'title' => __( 'Accept numeric interval', 'tainacan' ), + 'description' => __( 'If checked, the filter will accept numeric intervals as values.', 'tainacan' ), + ] + ]; + } + + + /** + * @param \Tainacan\Entities\Filter $filter + * @return array|bool true if is validate or array if has error + */ + public function validate_options(\Tainacan\Entities\Filter $filter) { + + if ( !in_array($filter->get_status(), apply_filters('tainacan-status-require-validation', ['publish','future','private'])) ) + return true; + + $errors = []; + + if ( empty($this->get_option('secondary_filter_metadatum_id')) ) + $errors['secondary_filter_metadatum_id'] = __('The secondary numeric metadatum is required.','tainacan'); + + if ( empty($this->get_option('first_comparator')) ) + $errors['first_comparator'] = __('The first comparator is required.','tainacan'); + + if ( empty($this->get_option('second_comparator')) ) + $errors['second_comparator'] = __('The second comparator is required.','tainacan'); + + if ( empty($this->get_option('accept_numeric_interval')) ) + $errors['accept_numeric_interval'] = __('The filter should define if it accepts a numeric interval.','tainacan'); + + return count($errors) > 0 ? $errors : true; + } + +} + +class Numerics_Intersection_Interval_Helper { + use \Tainacan\Traits\Singleton_Instance; + + protected function init() { + add_filter( 'tainacan-api-items-tainacan-filter-numerics-intersection-filter-arguments', [$this, 'format_filter_arguments']); + } + + function format_filter_arguments( $filter_arguments ) { + if ( + !isset($filter_arguments['compare']) || + !isset($filter_arguments['label']) + ) { + return $filter_arguments; + } + + if ( + is_array($filter_arguments['label']) && + count($filter_arguments['label']) === 2 + ) { + $filter_arguments['label'] = $filter_arguments['label'][0] . ' - ' . $filter_arguments['label'][1]; + } + if ( + isset( $filter_arguments['filter'] ) && + isset( $filter_arguments['filter']['metadatum'] ) && + isset( $filter_arguments['filter']['metadatum']['metadatum_name'] ) + ) { + $filter_arguments['filter']['name'] = $filter_arguments['filter']['metadatum']['metadatum_name']; + } + if ( + isset( $filter_arguments['filter'] ) && + isset( $filter_arguments['filter']['filter_type_options'] ) && + isset( $filter_arguments['filter']['filter_type_options']['secondary_filter_metadatum_name'] ) && + !empty( $filter_arguments['filter']['filter_type_options']['secondary_filter_metadatum_name'] ) + ) { + $filter_arguments['filter']['name'] = $filter_arguments['filter']['name'] . ' - ' . $filter_arguments['filter']['filter_type_options']['secondary_filter_metadatum_name']; + } + return $filter_arguments; + } +} +Numerics_Intersection_Interval_Helper::get_instance(); \ No newline at end of file diff --git a/src/views/admin/components/filter-types/selectbox/TainacanFilterSelectbox.vue b/src/views/admin/components/filter-types/selectbox/TainacanFilterSelectbox.vue index e7a260793..48773a048 100644 --- a/src/views/admin/components/filter-types/selectbox/TainacanFilterSelectbox.vue +++ b/src/views/admin/components/filter-types/selectbox/TainacanFilterSelectbox.vue @@ -6,7 +6,7 @@ v-if="!isLoadingOptions" :model-value="selected" :aria-labelledby="'filter-label-id-' + filter.id" - :placeholder="$i18n.get('label_selectbox_init')" + :placeholder="filter.placeholder ? filter.placeholder : $i18n.get('label_selectbox_init')" expanded @update:model-value="($event) => { resetPage(); onSelect($event) }">