From dae926fcccb6e62ab474496f8c0b4c07b921aeab Mon Sep 17 00:00:00 2001 From: Alexander Purr <purr@ub.uni-leipzig.de> Date: Fri, 17 Jan 2020 19:17:01 +0100 Subject: [PATCH] refs #16672 [fid_adlr] move advanced search information and linking from header into the content section * show always searchbox / searchForm, even if advanced search was used * add partial within content section, repositioning offcanvas-toggler * add translations --- themes/fid_adlr/languages/de.ini | 5 +++- themes/fid_adlr/languages/en.ini | 5 +++- themes/fid_adlr/scss/compiled.scss | 3 ++ .../search/advanced_search_information.phtml | 29 +++++++++++++++++++ .../fid_adlr/templates/search/results.phtml | 14 +++++---- .../fid_adlr/templates/search/searchbox.phtml | 21 ++------------ 6 files changed, 52 insertions(+), 25 deletions(-) create mode 100644 themes/fid_adlr/templates/search/advanced_search_information.phtml diff --git a/themes/fid_adlr/languages/de.ini b/themes/fid_adlr/languages/de.ini index aaa4201c7c0..ff7e9018671 100644 --- a/themes/fid_adlr/languages/de.ini +++ b/themes/fid_adlr/languages/de.ini @@ -74,4 +74,7 @@ general_question = "Ich habe eine allgemeine Frage." catalogue_error = "Ich habe einen Fehler im Katalog gefunden." account_question = "Ich habe eine Frage zu meinem Konto." resource_not_found = "Ich habe eine Ressource nicht gefunden." -purchase_request = "Ich habe einen Anschaffungswunsch." \ No newline at end of file +purchase_request = "Ich habe einen Anschaffungswunsch." + +Your search terms = "Ihre erweiterte Suche" +Edit this Advanced Search = "Suche bearbeiten" \ No newline at end of file diff --git a/themes/fid_adlr/languages/en.ini b/themes/fid_adlr/languages/en.ini index 6afe4b2c2cd..fbcfe187f3b 100644 --- a/themes/fid_adlr/languages/en.ini +++ b/themes/fid_adlr/languages/en.ini @@ -76,4 +76,7 @@ general_question = "I have a general question." catalogue_error = "I found an error in the catalogue." account_question = "I have a question about my account." resource_not_found = "I didn't find a resource." -purchase_request = "I have a purchase request." \ No newline at end of file +purchase_request = "I have a purchase request." + +Your search terms = "Your advanced search" +Edit this Advanced Search = "Edit search" \ No newline at end of file diff --git a/themes/fid_adlr/scss/compiled.scss b/themes/fid_adlr/scss/compiled.scss index aae2732464c..7339c9c87d5 100644 --- a/themes/fid_adlr/scss/compiled.scss +++ b/themes/fid_adlr/scss/compiled.scss @@ -1516,6 +1516,9 @@ input.searchForm_lookfor { .search-stats { padding-bottom: 3em; + @media screen and (max-width: $screen-md-min) { + padding-bottom: 0; + } } .search-controls a { diff --git a/themes/fid_adlr/templates/search/advanced_search_information.phtml b/themes/fid_adlr/templates/search/advanced_search_information.phtml new file mode 100644 index 00000000000..7b7a21444cf --- /dev/null +++ b/themes/fid_adlr/templates/search/advanced_search_information.phtml @@ -0,0 +1,29 @@ +<?php +/* following section adaption from themes/finc/templates/search/results.phtml */ + +$searchType = $this->params->getSearchType(); +$searchId = $this->results->getSearchId(); +$searchClassId = $this->params->getSearchClassId(); +$lookfor = $this->results->getUrlQuery()->isQuerySuppressed() ? '' : $this->params->getDisplayQuery(); + +/* following section adaption from themes/finc/templates/search/searchbox.phtml */ + +// Set default value if necessary: +if (!isset($this->searchClassId)) { + $this->searchClassId = 'Solr'; +} +// Load search actions and settings (if any): +$options = $this->searchOptions($this->searchClassId); +$advSearch = $options->getAdvancedSearchAction(); +?> + +<?php if ($searchType == 'advanced'): ?> + <div id="advanced_search_info"> + <div class="alert alert-success"> + <?=$this->transEsc("Your search terms")?> : "<strong><?=$this->escapeHtml($lookfor)?></strong>"</p> + </div> + <a href="<?=$this->url($advSearch)?>?edit=<?=$this->escapeHtmlAttr($searchId)?>" class="btn btn-primary"> + <?=$this->transEsc("Edit this Advanced Search")?> + </a> + </div> +<?php endif; ?> \ No newline at end of file diff --git a/themes/fid_adlr/templates/search/results.phtml b/themes/fid_adlr/templates/search/results.phtml index 4b96f3a6868..61ea6b13d36 100644 --- a/themes/fid_adlr/templates/search/results.phtml +++ b/themes/fid_adlr/templates/search/results.phtml @@ -57,7 +57,15 @@ $this->headScript()->appendFile("check_save_statuses.js"); <?=$this->recommend($current, 'top', $index)?> <?php endforeach; ?> <?php endif; ?> + <span class="offcanvas-toggler"> + <button class="search-filter-toggle visible-xs visible-sm" href="#search-sidebar" data-toggle="offcanvas" title="<?=$this->transEsc('sidebar_expand') ?>"> + <?=$this->transEsc('Refine Results') ?><i class="icon icon-filter right" aria-hidden="true"></i> + </button> + </span> <?=$this->flashmessages()?> + + <?= $this->render('search/advanced_search_information.phtml'); ?> + <?php /* finc: remove 'hidden' below to show search-stats; we also hide the entire bar on xs + sm - CK */ ?> <nav class="search-header hidden-print"> <div class="search-stats"> @@ -66,11 +74,7 @@ $this->headScript()->appendFile("check_save_statuses.js"); <span class="hit-stats hidden-xs hidden-sm"> <?/*=$this->context()->renderInContext('search/controls/showing.phtml', ['lookfor' => $lookfor, 'recordTotal' => $recordTotal])*/ ?> </span> - <span class="offcanvas-toggler"> - <button class="search-filter-toggle visible-xs visible-sm" href="#search-sidebar" data-toggle="offcanvas" title="<?=$this->transEsc('sidebar_expand') ?>"> - <?=$this->transEsc('Refine Results') ?><i class="icon icon-filter right" aria-hidden="true"></i> - </button> - </span> + <?php else: ?> <h2><?=$this->transEsc('nohit_heading')?></h2> <?php endif; ?> diff --git a/themes/fid_adlr/templates/search/searchbox.phtml b/themes/fid_adlr/templates/search/searchbox.phtml index bd0adcc2dec..b943d77e3b5 100644 --- a/themes/fid_adlr/templates/search/searchbox.phtml +++ b/themes/fid_adlr/templates/search/searchbox.phtml @@ -25,27 +25,12 @@ if (empty($hiddenFilters) && !$ignoreHiddenFilterMemory) { $hiddenFilterParams = $this->searchTabs()->getCurrentHiddenFilterParams($this->searchClassId, $ignoreHiddenFilterMemory, '?'); ?> <?php $tabConfig = $this->searchTabs()->getTabConfig($this->searchClassId, $this->lookfor, $this->searchIndex, $this->searchType, $hiddenFilters); ?> -<?php if ($this->searchType == 'advanced'): ?> - <?php /* finc: keep .no-margin-t or advanced search box will be pushed down too far (navbar-form) */ ?> - <div class="navbar-form navbar-left flip no-margin-t"> - <?php $tabs = $this->context($this)->renderInContext('search/searchTabs', ['searchTabs' => $tabConfig['tabs']]); ?> - <?php if (!empty($tabs)): ?><?=$tabs?> - <div class="tab-content clearfix no-gutter-all"><?php endif; ?> - <p class="adv_search_terms"><?=$this->transEsc("Your search terms")?> : "<strong><?=$this->escapeHtml($this->lookfor)?></strong>"</p> - <?php /* finc: we use an ul li list, CK */ ?> - <ul class="adv_search_links"> - <li><a href="<?=$this->url($advSearch)?>?edit=<?=$this->escapeHtmlAttr($this->searchId)?>"><?=$this->transEsc("Edit this Advanced Search")?></a></li> - <li><a href="<?=$this->url($advSearch) . $hiddenFilterParams?>"><?=$this->transEsc("Start a new Advanced Search")?></a></li> - <li><a href="<?=$this->url($searchHome) . $hiddenFilterParams?>"><?=$this->transEsc("Start a new Basic Search")?></a></li> - </ul> - <?php if (!empty($tabs)): ?></div><?php endif; ?> - </div> -<?php else: ?> + <form id="searchForm" class="searchForm navbar-left flip" method="get" action="<?=$this->url($basicSearch)?>" name="searchForm" autocomplete="off"> <?= $this->context($this)->renderInContext('search/searchTabs', ['searchTabs' => $tabConfig['tabs']]); ?> <?php $placeholder = $this->searchbox()->getPlaceholderText($tabConfig['selected']['id'] ?? null); ?> <?php /* finc: keep "required" */ ?> - <input id="searchForm_lookfor" class="searchForm_lookfor form-control search-query<?php if($this->searchbox()->autocompleteEnabled($this->searchClassId)):?> autocomplete searcher:<?=$this->escapeHtmlAttr($this->searchClassId) ?><?=$this->searchbox()->autocompleteAutoSubmit($this->searchClassId) ? ' ac-auto-submit' : '' ?><?php endif ?>" type="text" name="lookfor" value="<?=$this->escapeHtmlAttr($this->lookfor)?>"<?php if ($placeholder): ?> placeholder="<?=$this->transEsc($placeholder) ?>"<?php endif ?> aria-label="<?=$this->transEsc("search_terms")?>" required="required" placeholder="<?=$this->transEsc("enter-search-term")?>" /> + <input id="searchForm_lookfor" class="searchForm_lookfor form-control search-query<?php if($this->searchbox()->autocompleteEnabled($this->searchClassId)):?> autocomplete searcher:<?=$this->escapeHtmlAttr($this->searchClassId) ?><?=$this->searchbox()->autocompleteAutoSubmit($this->searchClassId) ? ' ac-auto-submit' : '' ?><?php endif ?>" type="text" name="lookfor" value="<?= ($this->searchType != "advanced") ? $this->escapeHtmlAttr($this->lookfor) : ""?>"<?php if ($placeholder): ?> placeholder="<?=$this->transEsc($placeholder) ?>"<?php endif ?> aria-label="<?=$this->transEsc("search_terms")?>" required="required" placeholder="<?=$this->transEsc("enter-search-term")?>" /> <?php /* finc: We use a list here, CK */ ?> <ul class="navbar-left list-unstyled"> <?php @@ -148,7 +133,7 @@ $hiddenFilterParams = $this->searchTabs()->getCurrentHiddenFilterParams($this->s } ?> </form> -<?php endif; ?> + <script type="text/javascript"> $(document).ready(function() { <?php /* still needed in bootstrap 3 for dropdown within dropdown */ ?> -- GitLab