Skip to content

Commit

Permalink
Highlight option should not be forced to [sc-11389]
Browse files Browse the repository at this point in the history
  • Loading branch information
ebrehault committed Jan 10, 2025
1 parent b237a66 commit 2a9f178
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 0 deletions.
51 changes: 51 additions & 0 deletions libs/common/common.babel
Original file line number Diff line number Diff line change
Expand Up @@ -27492,6 +27492,57 @@
</concept_node>
</children>
</folder_node>
<folder_node>
<name>highlight</name>
<children>
<concept_node>
<name>toggle-description</name>
<description/>
<comment/>
<translations>
<translation>
<language>ca-ES</language>
<approved>false</approved>
</translation>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-ES</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-FR</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>toggle-label</name>
<description/>
<comment/>
<translations>
<translation>
<language>ca-ES</language>
<approved>false</approved>
</translation>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-ES</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-FR</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
</children>
</folder_node>
<folder_node>
<name>preselected-filters</name>
<children>
Expand Down
2 changes: 2 additions & 0 deletions libs/common/src/assets/i18n/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,8 @@
"search.configuration.search-box.filters.filter-by-labels": "Filtrar per etiquetes",
"search.configuration.search-box.filters.toggle-description": "L’usuari podrà aplicar filtres a la cerca.",
"search.configuration.search-box.filters.toggle-label": "Mostra el botó per filtrar",
"search.configuration.search-box.highlight.toggle-description": "Ressaltar les paraules clau trobades.",
"search.configuration.search-box.highlight.toggle-label": "Ressaltar",
"search.configuration.search-box.preselected-filters.assistant.add-expression-button": "Afegeix expressió",
"search.configuration.search-box.preselected-filters.assistant.add-filter": "Afegeix un filtre",
"search.configuration.search-box.preselected-filters.assistant.delete-expression-button": "Esborra l’expressió",
Expand Down
2 changes: 2 additions & 0 deletions libs/common/src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,8 @@
"search.configuration.search-box.filters.filter-by-labels": "Filter by labels",
"search.configuration.search-box.filters.toggle-description": "The user will be able to apply filters to the search.",
"search.configuration.search-box.filters.toggle-label": "Show button to filter",
"search.configuration.search-box.highlight.toggle-description": "Highlight matched keywords.",
"search.configuration.search-box.highlight.toggle-label": "Highlight",
"search.configuration.search-box.preselected-filters.assistant.add-expression-button": "Add expression",
"search.configuration.search-box.preselected-filters.assistant.add-filter": "Add filter",
"search.configuration.search-box.preselected-filters.assistant.delete-expression-button": "Delete expression",
Expand Down
2 changes: 2 additions & 0 deletions libs/common/src/assets/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,8 @@
"search.configuration.search-box.filters.filter-by-labels": "Filtrar per etiquetas",
"search.configuration.search-box.filters.toggle-description": "El usuario podrá aplicar filtros a la búsqueda.",
"search.configuration.search-box.filters.toggle-label": "Mostrar botón para filtrar",
"search.configuration.search-box.highlight.toggle-description": "Resaltar las palabras clave encontradas.",
"search.configuration.search-box.highlight.toggle-label": "Destacar",
"search.configuration.search-box.preselected-filters.assistant.add-expression-button": "Añadir expresión",
"search.configuration.search-box.preselected-filters.assistant.add-filter": "Añadir filtro",
"search.configuration.search-box.preselected-filters.assistant.delete-expression-button": "Eliminar expresión",
Expand Down
2 changes: 2 additions & 0 deletions libs/common/src/assets/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,8 @@
"search.configuration.search-box.filters.filter-by-labels": "Filtrer par étiquettes",
"search.configuration.search-box.filters.toggle-description": "L’utilisateur pourra appliquer des filtres à la recherche.",
"search.configuration.search-box.filters.toggle-label": "Afficher le bouton pour filtrer",
"search.configuration.search-box.highlight.toggle-description": "Mettre en évidence les mots-clés trouvés.",
"search.configuration.search-box.highlight.toggle-label": "Souligner",
"search.configuration.search-box.preselected-filters.assistant.add-expression-button": "Ajouter une expression",
"search.configuration.search-box.preselected-filters.assistant.add-filter": "Ajouter un filtre",
"search.configuration.search-box.preselected-filters.assistant.delete-expression-button": "Supprimer l’expression",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,19 @@
</pa-radio>
</pa-radio-group>
</div>
<div class="config-form-field">
<pa-toggle
formControlName="highlight"
withBackground
spaceBetweenLabelAndToggle>
<span class="toggle-label">
{{ 'search.configuration.search-box.highlight.toggle-label' | translate }}
</span>
</pa-toggle>
<div class="config-form-help">
{{ 'search.configuration.search-box.highlight.toggle-description' | translate }}
</div>
</div>
@if (synonymsEnabled | async) {
<div class="config-form-field">
<pa-toggle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export class SearchBoxFormComponent implements OnInit, OnDestroy {
autocompleteFromNERs: new FormControl<boolean>(false, { nonNullable: true }),
preselectedFilters: new FormControl<string>('', { nonNullable: true, updateOn: 'blur' }),
useSynonyms: new FormControl<boolean>(false, { nonNullable: true }),
highlight: new FormControl<boolean>(false, { nonNullable: true }),
prependTheQuery: new FormControl<boolean>(false, { nonNullable: true }),
queryPrepend: new FormControl<string>('', { nonNullable: true, updateOn: 'blur' }),
rephraseQuery: new FormControl<boolean>(false, { nonNullable: true }),
Expand Down
3 changes: 3 additions & 0 deletions libs/common/src/lib/search-widget/search-widget.models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface SearchBoxConfig {
setPreselectedFilters: boolean;
suggestions: boolean;
useSynonyms: boolean;
highlight: boolean;
suggestResults: boolean;
autocompleteFromNERs: boolean;
preselectedFilters: string;
Expand Down Expand Up @@ -155,6 +156,7 @@ export const DEFAULT_SEARCH_BOX_CONFIG: SearchBoxConfig = {
suggestResults: false,
autocompleteFromNERs: false,
useSynonyms: false,
highlight: false,
prependTheQuery: false,
queryPrepend: '',
rephraseQuery: true,
Expand Down Expand Up @@ -284,6 +286,7 @@ export function getFeatures(config: SearchConfiguration, widgetOptions: WidgetCo
orFilterLogic: config.searchBox.filter && config.searchBox.filterLogic === 'or',
autofilter: config.searchBox.autofilter,
useSynonyms: config.searchBox.useSynonyms,
highlight: config.searchBox.highlight,
suggestions: config.searchBox.suggestions,
autocompleteFromNERs: config.searchBox.suggestions && config.searchBox.autocompleteFromNERs,
showHidden: config.searchBox.showHiddenResources,
Expand Down

0 comments on commit 2a9f178

Please sign in to comment.