diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fa2756..9cb487a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Keywords are indexed for searching. +- Introduce "Also search in text" option. ## [2.1.0] - 2024-09-06 diff --git a/languages/fau-degree-program-output-de_DE.mo b/languages/fau-degree-program-output-de_DE.mo index e641745..82ab8d8 100644 Binary files a/languages/fau-degree-program-output-de_DE.mo and b/languages/fau-degree-program-output-de_DE.mo differ diff --git a/languages/fau-degree-program-output-de_DE.po b/languages/fau-degree-program-output-de_DE.po index 1a03bec..74db9f7 100644 --- a/languages/fau-degree-program-output-de_DE.po +++ b/languages/fau-degree-program-output-de_DE.po @@ -2,8 +2,8 @@ msgid "" msgstr "" "Project-Id-Version: FAU Degree Program Output 0.0.4\n" "Report-Msgid-Bugs-To: https://github.com/RRZE-Webteam/FAU-Studium-Embed\n" -"POT-Creation-Date: 2024-07-18T12:59:56+00:00\n" -"PO-Revision-Date: 2024-07-18 16:07+0300\n" +"POT-Creation-Date: 2024-12-23T06:39:22+00:00\n" +"PO-Revision-Date: 2024-12-23 08:42+0200\n" "Last-Translator: \n" "Language-Team: \n" "Language: de_DE\n" @@ -11,7 +11,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 3.4.2\n" +"X-Generator: Poedit 3.5\n" "X-Domain: fau-degree-program-output\n" #. Plugin Name of the plugin @@ -527,16 +527,21 @@ msgstr "" "Die Studiengangsdaten werden gerade verarbeitet. Bitte versuche es in ein " "paar Minuten erneut." -#: templates/search/text-input-search.php:39 +#: templates/search/text-input-search.php:41 msgctxt "frontoffice: degree programs search form" msgid "Please enter search term..." msgstr "Bitte Suchbegriff eingeben…" -#: templates/search/text-input-search.php:47 +#: templates/search/text-input-search.php:49 msgctxt "frontoffice: degree programs search form" msgid "Search" msgstr "Suchen" +#: templates/search/text-input-search.php:69 +msgctxt "frontoffice: degree programs search form" +msgid "Also search in text" +msgstr "Auch im Text suchen" + #: templates/single-degree-program-short.php:37 #: templates/single-degree-program/details.php:25 msgctxt "frontoffice: single view" diff --git a/languages/fau-degree-program-output-de_DE_formal.mo b/languages/fau-degree-program-output-de_DE_formal.mo index a9dc04a..380f946 100644 Binary files a/languages/fau-degree-program-output-de_DE_formal.mo and b/languages/fau-degree-program-output-de_DE_formal.mo differ diff --git a/languages/fau-degree-program-output-de_DE_formal.po b/languages/fau-degree-program-output-de_DE_formal.po index 9aec34d..c724f25 100644 --- a/languages/fau-degree-program-output-de_DE_formal.po +++ b/languages/fau-degree-program-output-de_DE_formal.po @@ -2,8 +2,8 @@ msgid "" msgstr "" "Project-Id-Version: FAU Degree Program Output 0.0.4\n" "Report-Msgid-Bugs-To: https://github.com/RRZE-Webteam/FAU-Studium-Embed\n" -"POT-Creation-Date: 2024-07-18T12:59:56+00:00\n" -"PO-Revision-Date: 2024-07-18 16:06+0300\n" +"POT-Creation-Date: 2024-12-23T06:39:22+00:00\n" +"PO-Revision-Date: 2024-12-23 08:42+0200\n" "Last-Translator: \n" "Language-Team: \n" "Language: de_DE\n" @@ -11,7 +11,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 3.4.2\n" +"X-Generator: Poedit 3.5\n" "X-Domain: fau-degree-program-output\n" #. Plugin Name of the plugin @@ -527,16 +527,21 @@ msgstr "" "Die Studiengangsdaten werden gerade verarbeitet. Bitte versuchen Sie es in " "ein paar Minuten erneut." -#: templates/search/text-input-search.php:39 +#: templates/search/text-input-search.php:41 msgctxt "frontoffice: degree programs search form" msgid "Please enter search term..." msgstr "Bitte Suchbegriff eingeben…" -#: templates/search/text-input-search.php:47 +#: templates/search/text-input-search.php:49 msgctxt "frontoffice: degree programs search form" msgid "Search" msgstr "Suchen" +#: templates/search/text-input-search.php:69 +msgctxt "frontoffice: degree programs search form" +msgid "Also search in text" +msgstr "Auch im Text suchen" + #: templates/single-degree-program-short.php:37 #: templates/single-degree-program/details.php:25 msgctxt "frontoffice: single view" diff --git a/languages/fau-degree-program-output.pot b/languages/fau-degree-program-output.pot index 00047d1..2177b37 100644 --- a/languages/fau-degree-program-output.pot +++ b/languages/fau-degree-program-output.pot @@ -2,14 +2,14 @@ # This file is distributed under the GPL-2.0-or-later. msgid "" msgstr "" -"Project-Id-Version: FAU Degree Program Output 2.0.0-beta.5\n" +"Project-Id-Version: FAU Degree Program Output 2.1.0\n" "Report-Msgid-Bugs-To: https://github.com/RRZE-Webteam/FAU-Studium-Embed\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2024-07-18T12:59:56+00:00\n" +"POT-Creation-Date: 2024-12-23T06:39:22+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.9.0\n" "X-Domain: fau-degree-program-output\n" @@ -517,16 +517,21 @@ msgctxt "frontoffice: degree programs search form" msgid "The degree program data is being processed. Please try again in a few minutes." msgstr "" -#: templates/search/text-input-search.php:39 +#: templates/search/text-input-search.php:41 msgctxt "frontoffice: degree programs search form" msgid "Please enter search term..." msgstr "" -#: templates/search/text-input-search.php:47 +#: templates/search/text-input-search.php:49 msgctxt "frontoffice: degree programs search form" msgid "Search" msgstr "" +#: templates/search/text-input-search.php:69 +msgctxt "frontoffice: degree programs search form" +msgid "Also search in text" +msgstr "" + #: templates/single-degree-program-short.php:37 #: templates/single-degree-program/details.php:25 msgctxt "frontoffice: single view" diff --git a/resources/scss/components/search/_search-form.scss b/resources/scss/components/search/_search-form.scss index 27e4401..3c9c8ae 100644 --- a/resources/scss/components/search/_search-form.scss +++ b/resources/scss/components/search/_search-form.scss @@ -17,6 +17,10 @@ display: flex; } + &__options { + margin-top: 10px; + } + &__search-icon { width: 28px; height: 28px; diff --git a/resources/ts/filters/filters-handler.ts b/resources/ts/filters/filters-handler.ts index 511ac58..fd61545 100644 --- a/resources/ts/filters/filters-handler.ts +++ b/resources/ts/filters/filters-handler.ts @@ -8,6 +8,7 @@ import { updateDegreeProgramOverviewDataset } from '../degree-program-overview/d const FILTER_SELECTOR = '.c-filter-checkbox'; export const LANGUAGE_SKILLS_INPUT = 'german-language-skills-for-international-students'; +const EXTENDED_INPUT = 'extended'; const filters = document.querySelectorAll< HTMLElement >( FILTER_SELECTOR ); @@ -68,8 +69,10 @@ filters.forEach( ( filterControl ) => { } checkbox?.addEventListener( 'change', ( e ) => { - toggleActiveFilter( filterControl, checkbox ); - updateFiltersCount( checkbox ); + if ( ! checkbox.name.startsWith( EXTENDED_INPUT ) ) { + toggleActiveFilter( filterControl, checkbox ); + updateFiltersCount( checkbox ); + } if ( checkbox.name.startsWith( LANGUAGE_SKILLS_INPUT ) ) { languageCertificateCheckedCheckboxes += checkbox.checked ? 1 : -1; diff --git a/src/Infrastructure/Search/SearchableContentUpdater.php b/src/Infrastructure/Search/SearchableContentUpdater.php index 5f4a247..50e03c0 100644 --- a/src/Infrastructure/Search/SearchableContentUpdater.php +++ b/src/Infrastructure/Search/SearchableContentUpdater.php @@ -17,6 +17,7 @@ final class SearchableContentUpdater { public const SEARCHABLE_CONTENT_KEY = 'fau_degree_program_searchable_content'; + public const SEARCHABLE_CONTENT_EXTENDED_KEY = 'fau_degree_program_searchable_content_extended'; public function __construct( private DegreeProgramCollectionRepository $degreeProgramCollectionRepository, @@ -68,6 +69,11 @@ private function update(CollectionCriteria $criteria): void self::SEARCHABLE_CONTENT_KEY . '_' . $code, $this->buildSearchableContent($rawView, $code) ); + update_post_meta( + $rawView->id()->asInt(), + self::SEARCHABLE_CONTENT_EXTENDED_KEY . '_' . $code, + $this->buildSearchableContentExtended($rawView, $code) + ); } } } @@ -83,10 +89,24 @@ private function buildSearchableContent( $parts = [ $rawView->title()->asString($languageCode), $rawView->subtitle()->asString($languageCode), - $rawView->content()->about()->description()->asString($languageCode), ...array_values($rawView->keywords()->asArrayOfStrings($languageCode)->getArrayCopy()), ]; return implode(' ', $parts); } + + /** + * @psalm-param LanguageCodes $languageCode + */ + private function buildSearchableContentExtended( + DegreeProgramViewRaw $rawView, + string $languageCode + ): string { + + $parts = [ + $rawView->content()->about()->description()->asString($languageCode), + ]; + + return implode(' ', $parts); + } } diff --git a/templates/search/text-input-search.php b/templates/search/text-input-search.php index dac0085..57c511c 100644 --- a/templates/search/text-input-search.php +++ b/templates/search/text-input-search.php @@ -2,6 +2,7 @@ declare(strict_types=1); +use Fau\DegreeProgram\Common\Infrastructure\TemplateRenderer\Renderer; use Fau\DegreeProgram\Output\Infrastructure\Component\Component; use Fau\DegreeProgram\Output\Infrastructure\Component\Icon; @@ -13,6 +14,7 @@ * name: string, * } $data * @var array $data + * @var Renderer $renderer */ [ @@ -58,4 +60,21 @@ class="c-degree-programs-searchform__input" ) ?> +
+ + render( + 'search/filter/checkbox-item', + [ + 'filterId' => 'extended', + 'label' => esc_html_x( + 'Also search in text', + 'frontoffice: degree programs search form', + 'fau-degree-program-output' + ), + 'value' => 'enable', + 'isSelected' => false, + ] + ) ?> + +