diff --git a/src/classes/entities/class-tainacan-filter.php b/src/classes/entities/class-tainacan-filter.php index 108b09c02..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; @@ -195,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 @@ -301,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/repositories/class-tainacan-filters.php b/src/classes/repositories/class-tainacan-filters.php index 06a9dc2c8..68415bf13 100644 --- a/src/classes/repositories/class-tainacan-filters.php +++ b/src/classes/repositories/class-tainacan-filters.php @@ -118,6 +118,16 @@ class Filters extends Repository { '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/views/admin/components/edition/filter-edition-form.vue b/src/views/admin/components/edition/filter-edition-form.vue index dfb820cfb..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,27 @@ @focus="clearErrors('description')" /> + +   + + + + + { this.form = {}; @@ -385,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; @@ -394,6 +417,8 @@ 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.updateFilter({ filterId: filter.id, index: this.index, options: formObj }) diff --git a/src/views/admin/components/filter-types/tainacan-filter-item.vue b/src/views/admin/components/filter-types/tainacan-filter-item.vue index 04b0e33ef..2ce80d509 100644 --- a/src/views/admin/components/filter-types/tainacan-filter-item.vue +++ b/src/views/admin/components/filter-types/tainacan-filter-item.vue @@ -13,17 +13,6 @@
+

+ {{ filter.description }} +

@@ -218,6 +225,15 @@ outline: none; padding: 0 !important; margin: 0; + + .tainacan-help-tooltip-trigger { + font-size: 1.188em; + + .icon { + margin-right: 0px; + margin-left: 6px; + } + } } } @@ -227,6 +243,13 @@ width: 100%; } + .filter-description-help-info { + font-size: 0.75em; + color: var(--tainacan-info-color); + margin-top: -0.25em; + margin-bottom: 0.75em; + } + .taginput-container { border-radius: var(--tainacan-input-border-radius, 1px) !important; box-shadow: none !important; diff --git a/src/views/admin/components/other/help-button.vue b/src/views/admin/components/other/help-button.vue index 969233179..e95f020c7 100644 --- a/src/views/admin/components/other/help-button.vue +++ b/src/views/admin/components/other/help-button.vue @@ -30,8 +30,8 @@ export default { }, computed: { getHelperTooltipContent() { - return `
` + this.title + `
-

` + ((this.message != '' && this.message != undefined) ? this.message : this.$i18n.get('info_no_description_provided')) + `

`; + return ( this.title ? ( `

` + this.title + `

` ) : '' ) + + `

` + ((this.message != '' && this.message != undefined) ? this.message : this.$i18n.get('info_no_description_provided')) + `

`; } } } @@ -39,7 +39,7 @@ export default {