From 0b0fd3e35fb0344e145d8b3f45bda03a6158de36 Mon Sep 17 00:00:00 2001 From: Gregor Gawol <gawol@ub.uni-leipzig.de> Date: Wed, 25 Aug 2021 09:05:46 +0200 Subject: [PATCH] refs #20465 [fid_adlr] sidefacets as structured list ul/li * set text hover * set remove-filter color * remove span filter list value --- themes/fid_adlr/scss/compiled.scss | 8 ++ .../templates/Recommend/SideFacets.phtml | 4 +- .../Recommend/SideFacets/filter-list.phtml | 77 ++++++++++--------- .../Recommend/SideFacets/single-facet.phtml | 32 ++++++-- 4 files changed, 77 insertions(+), 44 deletions(-) diff --git a/themes/fid_adlr/scss/compiled.scss b/themes/fid_adlr/scss/compiled.scss index cead2b964c3..bd256a039a5 100644 --- a/themes/fid_adlr/scss/compiled.scss +++ b/themes/fid_adlr/scss/compiled.scss @@ -2060,6 +2060,10 @@ input.searchForm_lookfor { border-bottom: 2px solid $violet; } + .remove-filter { + color: $violet; + } + .date-fields { label { font-family: $font-family-monospace; @@ -2083,6 +2087,10 @@ input.searchForm_lookfor { > span { display: inline-block; } + + &:hover { + color: $azure; + } } } diff --git a/themes/fid_adlr/templates/Recommend/SideFacets.phtml b/themes/fid_adlr/templates/Recommend/SideFacets.phtml index 635d083feba..827b8e7bd51 100644 --- a/themes/fid_adlr/templates/Recommend/SideFacets.phtml +++ b/themes/fid_adlr/templates/Recommend/SideFacets.phtml @@ -62,7 +62,7 @@ if ($hierarchicalFacets) { <button class="title<?php if(in_array($title, $collapsedFacets)): ?> collapsed<?php endif ?>" data-toggle="collapse" href="#side-collapse-<?=$this->escapeHtmlAttr($title) ?>" > <?=$this->transEsc($cluster['label'])?> </button> - <div id="side-collapse-<?=$this->escapeHtmlAttr($title)?>" class="collapse<?php if (!in_array($title, $collapsedFacets)): ?> in<?php endif ?>"> + <ul id="side-collapse-<?=$this->escapeHtmlAttr($title)?>" class="collapse<?php if (!in_array($title, $collapsedFacets)): ?> in<?php endif ?>"> <?=$this->context($this)->renderInContext( 'Recommend/SideFacets/facet.phtml', [ @@ -70,7 +70,7 @@ if ($hierarchicalFacets) { 'cluster' => $cluster, 'collapsedFacets' => $collapsedFacets ] ); ?> - </div> + </ul> </div> <?php endforeach; ?> <?php endif; ?> diff --git a/themes/fid_adlr/templates/Recommend/SideFacets/filter-list.phtml b/themes/fid_adlr/templates/Recommend/SideFacets/filter-list.phtml index 80a3ff1db14..96bc0ff47c1 100644 --- a/themes/fid_adlr/templates/Recommend/SideFacets/filter-list.phtml +++ b/themes/fid_adlr/templates/Recommend/SideFacets/filter-list.phtml @@ -1,49 +1,54 @@ <!-- fid_adlr: Recommend - SideFacets - filter-list --> <div class="facet-group active-filters flex-column-reverse"> <span class="flex-column-default"> - <?php $filterCount = 0; ?> - <?php foreach ($filterList as $field => $filters): ?> - <?php foreach ($filters as $i => $filter): ?> - <?php - $filterCount++; - $index = isset($filter['field']) ? array_search($filter['field'], $collapsedFacets) : false; - if ($index !== false) { - unset($collapsedFacets[$index]); // Open if we have a match - } - if (!isset($removeAllLinkQuery)) { - $removeAllLinkQuery = $results->getUrlQuery(); - } - if (isset($filter['specialType']) && $filter['specialType'] == 'keyword') { - $removeLink = $this->currentPath() . $results->getUrlQuery()->replaceTerm($filter['value'], ''); - $removeAllLinkQuery = $removeAllLinkQuery->replaceTerm($filter['value'], ''); - } else { - $removeLink = $this->currentPath() . $results->getUrlQuery()->removeFacet($filter['field'], $filter['value'], $filter['operator']); - $removeAllLinkQuery = $removeAllLinkQuery->removeFacet($filter['field'], $filter['value'], $filter['operator']); - } - if ($filter['displayText'] == '[* TO *]') { - $filter['displayText'] = $this->translate('filter_wildcard'); - } - ?> - <a class="facet" href="<?=$removeLink ?>" title="<?=$this->transEsc('clear_tag_filter') ?>"> - <span class="text"> + <ul> + <?php $filterCount = 0; ?> + <?php foreach ($filterList as $field => $filters): ?> + <?php foreach ($filters as $i => $filter): ?> + <?php + $filterCount++; + $index = isset($filter['field']) ? array_search($filter['field'], $collapsedFacets) : false; + if ($index !== false) { + unset($collapsedFacets[$index]); // Open if we have a match + } + if (!isset($removeAllLinkQuery)) { + $removeAllLinkQuery = $results->getUrlQuery(); + } + if (isset($filter['specialType']) && $filter['specialType'] == 'keyword') { + $removeLink = $this->currentPath() . $results->getUrlQuery()->replaceTerm($filter['value'], ''); + $removeAllLinkQuery = $removeAllLinkQuery->replaceTerm($filter['value'], ''); + } else { + $removeLink = $this->currentPath() . $results->getUrlQuery()->removeFacet($filter['field'], $filter['value'], $filter['operator']); + $removeAllLinkQuery = $removeAllLinkQuery->removeFacet($filter['field'], $filter['value'], $filter['operator']); + } + if ($filter['displayText'] == '[* TO *]') { + $filter['displayText'] = $this->translate('filter_wildcard'); + } + ?> + <li class="facet"> + <a class="remove-filter" href="<?=$removeLink ?>" title="<?=$this->transEsc('clear_tag_filter') ?>"> + <span class="sr-only"><?=$this->transEsc('clear_tag_filter') ?></span> + <span class="text"> <i class="icon icon-close" aria-hidden="true"></i> <?php if ($filter['operator'] == 'NOT'): ?><?=$this->transEsc('NOT') ?><?php endif; ?> - <?php if ($filter['operator'] == 'OR' && $i > 0): ?><?=$this->transEsc('OR') ?><?php endif; ?> - <?=$this->transEsc($field) ?>: <?=$this->escapeHtml($filter['displayText']) ?> - </span> - <?php /* fid_adlr: Move icon refs #15646 - GG */ ?> - <?php /* */ ?> - </a> - <?php endforeach; ?> - <?php endforeach; ?> + <?php if ($filter['operator'] == 'OR' && $i > 0): ?><?=$this->transEsc('OR') ?><?php endif; ?> + <?=$this->transEsc($field) ?>: <?=$this->escapeHtml($filter['displayText']) ?> + </span> + <?php /* fid_adlr: Move icon refs #15646 - GG */ ?> + <?php /* */ ?> + </a> + </li> + <?php endforeach; ?> + <?php endforeach; ?> + </ul> </span> <?php if ($filterCount > 1 && !empty($removeAllLinkQuery)): ?> - <a class="facet all-filters" href="<?= $this->currentPath() . $removeAllLinkQuery ?>" title="<?= $this->transEsc('clear_tag_filter_all') ?>"> + <a class="facet all-filters" href="<?= $this->currentPath() . $removeAllLinkQuery ?>" title="<?= $this->transEsc('clear_tag_filter_all') ?>"> <span class="text"> <i class="icon icon-trash-2" aria-hidden="true"></i> <?= $this->transEsc('clear_tag_filter_all') ?> </span> - </a> - <?php endif; ?> + </a> + <?php endif; ?> </div> <!-- fid_adlr: Recommend - SideFacets - filter-list - END --> \ No newline at end of file diff --git a/themes/fid_adlr/templates/Recommend/SideFacets/single-facet.phtml b/themes/fid_adlr/templates/Recommend/SideFacets/single-facet.phtml index d2497cecdaa..d19cc16bff3 100644 --- a/themes/fid_adlr/templates/Recommend/SideFacets/single-facet.phtml +++ b/themes/fid_adlr/templates/Recommend/SideFacets/single-facet.phtml @@ -1,3 +1,4 @@ +<!-- fid_adlr - Recommend - SideFacets - single-facet --> <?php $toggleUrl = $this->facet['isApplied'] ? $this->urlBase . $this->url->removeFacet($this->group, $this->facet['value'], $this->facet['operator']) @@ -20,6 +21,9 @@ $displayText = $this->escapeHtml($this->facet['value']); } + // #18509 decorate special untranslated terms with language tags + $displayText = $this->sideFacet()->getLanguageTag($displayText, 'span', $this->layout()->userLang); + if ($this->facet['operator'] == 'OR') { $displayText = '<i class="icon ' . ($this->facet['isApplied'] ? 'icon-check' : 'icon-square') . '" aria-hidden="true"></i> ' @@ -30,11 +34,24 @@ <?php if ($hasSubLinks): ?> <li class="<?=implode(' ', $classList) ?>"> <?php else: ?> - <a href="<?=$toggleUrl ?>" class="<?=implode(' ', $classList) ?>" data-title="<?=$this->escapeHtmlAttr($this->facet['displayText']) ?>" data-count="<?=$this->facet['count'] ?>"<?php if($this->facet['isApplied']): ?> title="<?=$this->transEsc('applied_filter') ?>"<?php endif;?> data-lightbox-ignore> + <li> + <a + <?php if ($this->facet['isApplied']): ?>id="<?=$this->sideFacet()->setAppliedFacet($this->transEsc('Skip to facet', ['%%filter_name%%' => $this->facet['displayText']])) ?>"<?php endif; ?> + href="<?=$toggleUrl ?>" + class="<?=implode(' ', $classList) ?>" + data-title="<?=$this->escapeHtmlAttr($this->facet['displayText']) ?>" + data-count="<?=$this->facet['count'] ?>" + title="<?php if($this->facet['isApplied']): ?><?=$this->transEsc('applied_filter')?> - <?=$this->transEsc('page_reload_on_deselect_hint', ['%%filter_name%%' => $this->facet['displayText']])?><?php else: ?><?=$this->transEsc('page_reload_on_select_hint', ['%%filter_name%%' => $this->facet['displayText']])?><?php endif;?>" + data-lightbox-ignore> <?php endif; ?> <?php if ($hasSubLinks): ?> - <a class="text" href="<?=$toggleUrl ?>" data-lightbox-ignore data-title="<?=$this->escapeHtmlAttr($this->facet['displayText']) ?>" data-count="<?=$this->facet['count'] ?>"<?php if($this->facet['isApplied']): ?> title="<?=$this->transEsc('applied_filter') ?>"<?php endif;?>> + <a class="text" + href="<?=$toggleUrl ?>" + data-lightbox-ignore + data-title="<?=$this->escapeHtmlAttr($this->facet['displayText']) ?>" + data-count="<?=$this->facet['count'] ?>" + title="<?php if($this->facet['isApplied']): ?><?=$this->transEsc('applied_filter')?> - <?=$this->transEsc('page_reload_on_deselect_hint', ['%%filter_name%%' => $this->facet['displayText']])?> <?=$this->escapeHtmlAttr($this->facet['displayText']) ?><?php else: ?><?=$this->transEsc('page_reload_on_select_hint', ['%%filter_name%%' => $this->facet['displayText']])?><?php endif;?>"> <?=$displayText ?> </a> <?php else: ?> @@ -45,13 +62,16 @@ <?/* php if (!$this->facet['isApplied']): ?> <span class="badge"> - <?=$this->localizedNumber($this->facet['count']) ?> + <?=$this->localizedNumber($this->facet['count']) ?><span class="sr-only"><?=$this->transEsc('results') ?></span> </span> <?php endif;*/ ?> - <?php if ($this->exclude && !$this->facet['isApplied']): ?> + <?php if ($hasSubLinks): ?> <?php $excludeURL = $this->urlBase . $this->url->addFacet($this->group, $this->facet['value'], 'NOT'); ?> - <a href="<?=$excludeURL ?>" data-lightbox-ignore title="<?=$this->transEsc('exclude_facet') ?>" class="exclude"><i class="icon icon-minus-circle" aria-hidden="true"></i></a> + <a href="<?=$excludeURL ?>" data-lightbox-ignore class="exclude" title="<?= $this->transEsc('exclude_filter', ['%%filter_name%%' => $this->facet['displayText']]) ?>, <?= $this->transEsc('page_reload_hint') ?>"> + <i class="fa fa-times" aria-hidden="true"></i> + </a> <?php endif; ?> -<?=$hasSubLinks ? '</li>' : '</a>'; ?> +<?=$hasSubLinks ? '</li>' : '</a></li>'; ?> +<!-- fid_adlr - Recommend - SideFacets - single-facet - END --> -- GitLab