diff --git a/fid_adlr/languages/en.ini b/fid_adlr/languages/en.ini index 986ace31aa1a4da92bfc9bb78bceff217cc65f67..5095c9be351cdb251c274a578aa11d3d28f15f0e 100644 --- a/fid_adlr/languages/en.ini +++ b/fid_adlr/languages/en.ini @@ -64,6 +64,7 @@ Apply Filters = "apply filter" Apply Format Filters = "apply format filter" Close Search = "close search" Open Search = "open search" +basic_search_keep_filters = "Retain Filters" Format = "Media Type" view_worldcat = "Also available in these libraries" diff --git a/themes/fid_adlr/scss/_customMixins.scss b/themes/fid_adlr/scss/_customMixins.scss index 5f26b4eb749b65de69ada8fe0648ee860ae447bc..49fbe9b9592578ef6465699f9851c092383d104c 100644 --- a/themes/fid_adlr/scss/_customMixins.scss +++ b/themes/fid_adlr/scss/_customMixins.scss @@ -316,20 +316,6 @@ padding: 0; position: relative; - .adv-srch-btn { - font-size: medium; - left: 189px; - position: absolute; - top: 71px; - } - - &.affix { - .adv-srch-btn { - display: none; // FIXME: why should link disappear at all? - top: 67px; - } - } - .btn.btn-lg { height: $search-input-height-fixed; margin-top: 1px; @@ -539,16 +525,18 @@ } min-width: $search-filter-width-lg; + padding-right: 20px; + position: relative; + text-align: center; + text-decoration: none; + text-transform: uppercase; @if $screen-border != 'mobile' { - padding-left: 5px; + padding-left: 0; + padding-right: 5px; padding-top: $navbar-default-padding; } - position: relative; - text-decoration: none; - text-transform: uppercase; - @if $screen-border == 'mobile' { width: 118px; } @else { diff --git a/themes/fid_adlr/scss/_customVariables.scss b/themes/fid_adlr/scss/_customVariables.scss index fcab9c74f6ea98e99182e05a992fcba1bb3aa27a..0d3fef14a72855b5322160baae2568c4200b6edd 100644 --- a/themes/fid_adlr/scss/_customVariables.scss +++ b/themes/fid_adlr/scss/_customVariables.scss @@ -278,7 +278,7 @@ $navbar-extended-padding: calc(2 * #{$navbar-default-padding}); //// NAVBAR - END // ++ Search Form -$search-form-height-xs: 330px; // + 3px border +$search-form-height-xs: 280px; // + 3px border $search-form-height-sm: 250px; // + 3px border $search-form-height-lg: 310px; // + 3px border diff --git a/themes/fid_adlr/scss/compiled.scss b/themes/fid_adlr/scss/compiled.scss index edbf56aa9f471f4c9b2af866ed2a0442707488d5..aae2732464cedf94c6446670925f699bad41d18f 100644 --- a/themes/fid_adlr/scss/compiled.scss +++ b/themes/fid_adlr/scss/compiled.scss @@ -412,10 +412,6 @@ a { min-width: 35px; } - &.icon-settings { - font-size: $font-size-large; - } - .btn-primary { float: right; font-size: calc(#{$font-size-base} * 1.5); @@ -638,12 +634,12 @@ header, } @media (max-width: $screen-xs-max) { - top: calc(#{$navbar-header-height} + 6 * #{$line-height-submenu} + #{$content-top-padding}); + top: calc(#{$navbar-header-height} + 7 * #{$line-height-submenu} + #{$content-top-padding}); } @media (min-width:$screen-sm-min) and (max-width:$screen-md-max) { left: calc(#{$logo-max-width} / 2 + #{$navbar-margin-left}); - top: calc(#{$navbar-header-height} + 7 * #{$line-height-submenu} + 8 * #{$navbar-default-padding}); + top: calc(#{$navbar-header-height} + 8 * #{$line-height-submenu} + 9 * #{$navbar-default-padding}); .btn { font-size: calc(#{$font-size-menu-sm} - 15px); } @@ -684,13 +680,13 @@ header, } @media (max-width: $screen-xs-max) { - top: calc(#{$navbar-header-height} + 7 * #{$line-height-submenu} + #{$content-top-padding}); + top: calc(#{$navbar-header-height} + 8 * #{$line-height-submenu} + #{$content-top-padding}); } @media (min-width:$screen-sm-min) and (max-width:$screen-md-max) { font-size: calc(#{$font-size-menu-sm} - 15px); left: calc(#{$logo-max-width} / 2 + #{$navbar-margin-left}); - top: calc(#{$navbar-header-height} + 8 * #{$line-height-submenu} + 9 * #{$navbar-default-padding}); + top: calc(#{$navbar-header-height} + 9 * #{$line-height-submenu} + 10 * #{$navbar-default-padding}); } } @@ -947,12 +943,12 @@ body:not(.template-name-home) { } @media screen and (min-width: $screen-lg-min) and (max-width: $screen-lg-max){ - height: 130px; + height: 120px; width: $search-form-width-affix-lg; } @media screen and (min-width: $screen-xl-min) { - height: 130px; + height: 120px; max-width: $search-form-width-max; width: $search-form-width-xl; } @@ -1353,8 +1349,7 @@ input.searchForm_lookfor { } #quickfilter-dd, -.search-button, -.adv-srch-btn { +.search-button { &:hover, &:focus { color: $white; @@ -1434,12 +1429,16 @@ input.searchForm_lookfor { @include basic-dropdown-menu; // parameter $is_collapsed, $is_mobile @include search-filter-styles(true, false); // gear within search text input - left: -220px; + left: -200px; padding: 5px; - top: 84px; - - @media screen and (max-width: $screen-md-max) { - top: 80px; + top: 60px; + + #searchFormKeepFilters { + cursor: pointer; + height: 35px; + user-select: none; + white-space: nowrap; + width: max-content; } } } @@ -1453,30 +1452,21 @@ input.searchForm_lookfor { } } -// ++++++ Adv. Search Link -.adv-srch-btn { - color: $white; - display: inline-block; - text-decoration: underline; - - @media screen and (min-width: $screen-sm-min) { - margin-top: 1em; - } +// fix bug of clicking twice in quickfilter for mobile +.dropdown-backdrop { + display: none; } -// Set font size for input field and advanced search link -.searchForm_lookfor, -.adv-srch-btn { +// Set font size for input field +.searchForm_lookfor { @media screen and (max-width: $screen-md-max) { font-size: 16px; } } -// ++++++ Adv. Search Link - END - // ******************************************************** -// headr +// header // ******************************************************** // ++++ SEARCH BOX - END @@ -2486,7 +2476,7 @@ div[class$="-tab"] { // +++++ Home Page - START .home.container { margin-bottom: 100px; - margin-top: 50px; + margin-top: 0; @media screen and (min-width: $screen-md-min) { margin-top: 100px; @@ -2579,7 +2569,7 @@ div[class$="-tab"] { font-size: $font-size-base; } &.box { - margin-bottom: 70px; + margin-bottom: 43px; margin-left: 40px; @media screen and (max-width: $screen-sm-max) { margin-left: 0; diff --git a/themes/fid_adlr/templates/header.phtml b/themes/fid_adlr/templates/header.phtml index ee178b08819663826851cecfd1765465bf05ae2c..13822770d31522d6864b8ba50b5d14e56171d4c1 100644 --- a/themes/fid_adlr/templates/header.phtml +++ b/themes/fid_adlr/templates/header.phtml @@ -163,6 +163,13 @@ <div class="collapse header-menu-collapse" id="submenu"> <ul class="submenu-collapse"> + <li> + <?php $searchOptions = $this->searchOptions("Solr"); ?> + <?php if (!empty($advSearch = $searchOptions->getAdvancedSearchAction())): ?> + <li> + <a href="<?=$this->url($advSearch)?>"><?=$this->transEsc("Advanced Search")?></a> + </li> + <?php endif; ?> <li> <a href="<?= $this->url('myresearch/databases') ?>"><?= $this->transEsc('Specific Databases') ?></a> </li> diff --git a/themes/fid_adlr/templates/search/home.phtml b/themes/fid_adlr/templates/search/home.phtml index da6b682da54be35ba828c616ca1c4cf44959ce70..6f98b4b7f6967a414506677204a298f3908acb0f 100644 --- a/themes/fid_adlr/templates/search/home.phtml +++ b/themes/fid_adlr/templates/search/home.phtml @@ -25,6 +25,12 @@ $this->layout()->breadcrumbs = false; href="<?php $this->currentPath() ?><?= $this->url('search-results') . $this->config()->get('config')->RawQueries['new_releases']?>"><span class="icon icon-arrow-right"></span> <?= $this->transEsc('new_print_publications') ?></a> <?php endif; ?> + <?php $searchOptions = $this->searchOptions("Solr"); ?> + <?php if (!empty($advSearch = $searchOptions->getAdvancedSearchAction())): ?> + <a class="navbar-header-link small" + href="<?=$this->url($advSearch)?>"><span + class="icon icon-arrow-right"></span> <?= $this->transEsc('Advanced Search') ?></a> + <?php endif; ?> </div> </div> diff --git a/themes/fid_adlr/templates/search/searchbox.phtml b/themes/fid_adlr/templates/search/searchbox.phtml index cd1675f3e90e111dd5e211123f22cc715e259a15..bd0adcc2dec4deec2bb755df8e9121a7cbf3ea67 100644 --- a/themes/fid_adlr/templates/search/searchbox.phtml +++ b/themes/fid_adlr/templates/search/searchbox.phtml @@ -7,11 +7,7 @@ if (!isset($this->searchClassId)) { // Load search actions and settings (if any): $options = $this->searchOptions($this->searchClassId); -$handlers = $this->searchbox()->getHandlers( - $this->searchClassId, - isset($this->searchIndex) ? $this->searchIndex : null -); -$handlerCount = count($handlers); + $basicSearch = $this->searchbox()->combinedHandlersActive() ? 'combined-searchbox' : $options->getSearchAction(); $searchHome = $options->getSearchHomeAction(); $advSearch = $options->getAdvancedSearchAction(); @@ -52,29 +48,45 @@ $hiddenFilterParams = $this->searchTabs()->getCurrentHiddenFilterParams($this->s <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")?>" /> <?php /* finc: We use a list here, CK */ ?> <ul class="navbar-left list-unstyled"> - <?php if ($handlerCount > 1): ?> - <?php /* adlr custom quickfilter */ ?> - <li class="quickfilter dropdown"> - <a href="#" class="btn btn-transparent searchForm_type" id="quickfilter-dd" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> - <i class="icon icon-settings" aria-hidden="true"></i> - <span class="sr-only"><?=$this->transEsc("Apply Filters")?></span> - </a> - <ul id="quickfilter" class="dropdown-menu" aria-labelledby="quickfilter-dd"> - <li> - <label class="w-100"><?=$this->transEsc('Apply Filters')?></label> - <? foreach ($handlers as $handler): ?> - <span class="filter-option"> - <input id="<?=$this->escapeHtmlAttr($handler['value'])?>" type="radio" name="type" value="<?=$this->escapeHtmlAttr($handler['value'])?>" <?=$handler['selected'] ? 'checked' : ''?>> <?=$handler['indent'] ? '-- ' : ''?> - <label for="<?=$this->escapeHtmlAttr($handler['value'])?>"><?=$this->transEsc($handler['label'])?></label> - </span> - <? endforeach; ?> - </li> - </ul> - </li> - <?php /* adlr custom quickfilter - END */ ?> - <?php elseif ($handlerCount == 1): ?> - <input type="hidden" name="type" value="<?=$this->escapeHtmlAttr($handlers[0]['value'])?>" /> + <?php + $filterDetails = $this->searchbox()->getFilterDetails( + isset($this->filterList) && is_array($this->filterList) ? $this->filterList : [], + isset($this->checkboxFilters) && is_array($this->checkboxFilters) ? $this->checkboxFilters : [] + ); + ?> + <?php if (!empty($filterDetails) || (($tabConfig["tabs"][0]["label"] ?? "") !== ($tabConfig["selected"]["label"] ?? ""))): ?> + <?php /* adlr custom quickfilter */ ?> + <li class="quickfilter dropdown custom"> + <a href="#" class="btn btn-transparent searchForm_type" id="quickfilter-dd" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + <i class="icon icon-filter2 icon-1.5x" aria-hidden="true"></i> + <span class="sr-only"><?=$this->transEsc("Apply Filters")?></span> + </a> + <ul id="keepfilter-toggle" class="dropdown-menu" aria-labelledby="quickfilter-dd"> + <li> + <?php /* copied from /finc/templates/search/searchbox.phtml */ ?> + <?php $defaultFilterState = $options->getRetainFilterSetting() ? ' checked="checked"' : ''; ?> + <div id="searchFormKeepFilters"> + <input id="keepfilters" type="checkbox"<?=$defaultFilterState?> class="searchFormKeepFilters"/> + <label for="keepfilters"> + <?=$this->transEsc("basic_search_keep_filters")?> + </label> + </div> + <div class="hidden"> + <?php foreach ($filterDetails as $current): ?> + <input class="applied-filter" id="<?=$this->escapeHtmlAttr($current['id'])?>" type="checkbox"<?=$defaultFilterState?> name="filter[]" value="<?=$this->escapeHtmlAttr($current['value'])?>"/> + <label for="<?=$this->escapeHtmlAttr($current['id'])?>"><?=$this->escapeHtml($current['value'])?></label> + <?php endforeach; ?> + <?php if (isset($hasDefaultsApplied) && $hasDefaultsApplied): ?> + <!-- this is a hidden element that flags whether or not default filters have been applied; + it is intentionally unlabeled, as users are not meant to manipulate it directly. --> + <input class="applied-filter" id="dfApplied" type="checkbox" name="dfApplied" value="1"<?=$defaultFilterState?> /> + </div> + </li> + <?php endif; ?> + </ul> + </li> <?php endif; ?> + <?php /* adlr custom quickfilter - END */ ?> <li class="find-button"> <button type="submit" class="btn btn-lg"><span class="find-label"><?=$this->transEsc("Find")?></span></button> </li> @@ -85,12 +97,6 @@ $hiddenFilterParams = $this->searchTabs()->getCurrentHiddenFilterParams($this->s </li> </ul> - <?php /* adlr. adv- search */ ?> - <?php if ($advSearch): ?> - <br /><a href="<?=$this->url($advSearch) . ((isset($this->searchId) && $this->searchId) ? '?edit=' . $this->escapeHtmlAttr($this->searchId) : $hiddenFilterParams)?>" class="adv-srch-btn" role="button" rel="nofollow"><span><?=$this->transEsc("Advanced Search")?></span></a> - <?php endif; ?> - <?php /* adlr. adv- search - END */ ?> - <?php /* finc: We hide this for small and keep the solution using labels, same below - CK */ ?> <div class="checkbox hidden-xs"> <?php $shards = $options->getShards(); @@ -143,4 +149,36 @@ $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 */ ?> + $('#searchFormKeepFilters').on('click', function () { + $('.quickfilter.dropdown.custom').toggleClass("open"); + }); + + $('#keepfilters').on('click', function () { + // reset type / category filter to default: All + if ($('input[id ="keepfilters"]').prop('checked') == false) { + var typeOptions = $('input[name ="format-pre-filter"]'); + for (var opt, j = 0; opt = typeOptions[j]; j++) { + if (opt.id.includes("All")) { + opt.checked = true; + setCategoryFilterText($('label[for="' + opt.id + '"]').html()); + } else { + opt.checked = false; + } + } + } + }); + + $('input[name="format-pre-filter"]').change(function() { + setCategoryFilterText($('label[for="' + $(this)[0].id + '"]').html()); + }); + + function setCategoryFilterText(text) { + $('#quickfilter-format') + .html("<span class=\"sr-only\">Select format pre-filter</span>" + text.substring(0,6) + "<i class=\"icon icon-caret-down\" aria-hidden=\"true\"></i>"); + } + }); +</script> <!-- fid_adlr: search - searchbox - END -->