Skip to content
Snippets Groups Projects
Commit 88bdb7dd authored by Chris Hallberg's avatar Chris Hallberg Committed by Robert Lange
Browse files

Fix headings order.

parent d39fc6e6
Branches
Tags
No related merge requests found
...@@ -4,20 +4,6 @@ ...@@ -4,20 +4,6 @@
// Save results/options to $this so they are available to sub-templates: // Save results/options to $this so they are available to sub-templates:
$this->results = $results = $this->recommend->getResults(); $this->results = $results = $this->recommend->getResults();
$this->options = $options = $results->getOptions(); $this->options = $options = $results->getOptions();
$collapsedFacets = $this->recommend->getCollapsedFacets();
$forceUncollapsedFacets = [];
// Make sure facets with active selections are not collapsed:
$filterList = $results->getParams()->getFilterList(true);
foreach ($filterList as $field => $filters) {
foreach ($filters as $filter) {
$index = isset($filter['field']) ? array_search($filter['field'], $collapsedFacets) : false;
if ($index !== false) {
unset($collapsedFacets[$index]); // Open if we have a match
$forceUncollapsedFacets[] = $filter['field'];
}
}
}
$hierarchicalFacets = $this->recommend->getHierarchicalFacets(); $hierarchicalFacets = $this->recommend->getHierarchicalFacets();
if ($hierarchicalFacets) { if ($hierarchicalFacets) {
...@@ -28,13 +14,13 @@ ...@@ -28,13 +14,13 @@
?> ?>
<button class="close-offcanvas btn btn-link" data-toggle="offcanvas"><?=$this->transEsc('navigate_back') ?></button> <button class="close-offcanvas btn btn-link" data-toggle="offcanvas"><?=$this->transEsc('navigate_back') ?></button>
<?php if ($results->getResultTotal() > 0): ?> <?php if ($results->getResultTotal() > 0): ?>
<h4><?=$this->transEsc($this->slot('side-facet-caption')->get('Narrow Search')) ?></h4> <h2><?=$this->transEsc(isset($this->overrideSideFacetCaption) ? $this->overrideSideFacetCaption : 'Narrow Search')?></h2>
<?php endif; ?> <?php endif; ?>
<?php $checkboxFilters = $this->recommend->getCheckboxFacetSet(); ?> <?php $checkboxFilters = $results->getParams()->getCheckboxFacets(); ?>
<?php $checkboxesShown = false; ?> <?php $checkboxesShown = false; ?>
<?php if (count($checkboxFilters) > 0): <?php if (count($checkboxFilters) > 0):
foreach ($checkboxFilters as $current) { foreach ($checkboxFilters as $current) {
if ($results->getResultTotal() > 0 || $current['alwaysVisible']) { if ($results->getResultTotal() > 0 || $current['selected'] || $current['alwaysVisible']) {
$checkboxesShown = true; $checkboxesShown = true;
break; break;
} }
...@@ -46,6 +32,16 @@ ...@@ -46,6 +32,16 @@
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php endif; ?>
<?php $extraFilters = isset($this->extraSideFacetFilters) ? $this->extraSideFacetFilters : []; ?>
<?php $collapsedFacets = $this->recommend->getCollapsedFacets() ?>
<?php $filterList = array_merge($results->getParams()->getFilterList(true), $extraFilters); ?>
<?php if (!empty($filterList)): ?>
<?=$this->context($this)->renderInContext('Recommend/SideFacets/filter-list.phtml', [
'collapsedFacets' => $collapsedFacets,
'extraFilters' => $extraFilters,
'filterList' => $filterList,
]); ?>
<?php endif; ?>
<?= isset($this->sideFacetExtraControls) ? $this->sideFacetExtraControls : '' ?> <?= isset($this->sideFacetExtraControls) ? $this->sideFacetExtraControls : '' ?>
<?php $sideFacetSet = $this->recommend->getFacetSet(); ?> <?php $sideFacetSet = $this->recommend->getFacetSet(); ?>
<?php $hierarchicalFacets = $this->recommend->getHierarchicalFacets() ?> <?php $hierarchicalFacets = $this->recommend->getHierarchicalFacets() ?>
...@@ -53,17 +49,16 @@ ...@@ -53,17 +49,16 @@
<?php if (!empty($sideFacetSet) && $results->getResultTotal() > 0): ?> <?php if (!empty($sideFacetSet) && $results->getResultTotal() > 0): ?>
<?php foreach ($sideFacetSet as $title => $cluster): ?> <?php foreach ($sideFacetSet as $title => $cluster): ?>
<div class="facet-group" id="side-panel-<?=$this->escapeHtmlAttr($title) ?>"> <div class="facet-group" id="side-panel-<?=$this->escapeHtmlAttr($title) ?>">
<button class="title<?php if (in_array($title, $collapsedFacets)): ?> collapsed<?php endif ?>" data-toggle="collapse" href="#side-collapse-<?=$this->escapeHtmlAttr($title) ?>" > <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'])?> <?=$this->transEsc($cluster['label'])?>
</button> </button>
<div id="side-collapse-<?=$this->escapeHtmlAttr($title) ?>" class="collapse<?php if (!in_array($title, $collapsedFacets)): ?> in<?php endif ?>"<?php if (in_array($title, $forceUncollapsedFacets)): ?> data-force-in="1"<?php endif ?>> <div id="side-collapse-<?=$this->escapeHtmlAttr($title) ?>" class="collapse<?php if(!in_array($title, $collapsedFacets)): ?> in<?php endif ?>">
<?=$this->context($this)->renderInContext( <?=$this->context($this)->renderInContext(
'Recommend/SideFacets/facet.phtml', 'Recommend/SideFacets/facet.phtml',
[ [
'facet' => $title, 'facet' => $title,
'cluster' => $cluster, 'cluster' => $cluster,
'collapsedFacets' => $collapsedFacets 'collapsedFacets' => $collapsedFacets ]
]
); ?> ); ?>
</div> </div>
</div> </div>
......
...@@ -5,20 +5,6 @@ ...@@ -5,20 +5,6 @@
$results = $this->recommend->getResults(); $results = $this->recommend->getResults();
$activeFacets = $this->recommend->getActiveFacets(); $activeFacets = $this->recommend->getActiveFacets();
$rangeFacets = $this->recommend->getAllRangeFacets(); $rangeFacets = $this->recommend->getAllRangeFacets();
$collapsedFacets = $this->recommend->getCollapsedFacets();
$forceUncollapsedFacets = [];
// Make sure facets with active selections are not collapsed:
$filterList = $results->getParams()->getFilterList(true);
foreach ($filterList as $field => $filters) {
foreach ($filters as $filter) {
$index = isset($filter['field']) ? array_search($filter['field'], $collapsedFacets) : false;
if ($index !== false) {
unset($collapsedFacets[$index]); // Open if we have a match
$forceUncollapsedFacets[] = $filter['field'];
}
}
}
foreach ($activeFacets as $field => $facetName) { foreach ($activeFacets as $field => $facetName) {
if (isset($rangeFacets[$field]) && 'date' === $rangeFacets[$field]['type']) { if (isset($rangeFacets[$field]) && 'date' === $rangeFacets[$field]['type']) {
...@@ -29,14 +15,14 @@ ...@@ -29,14 +15,14 @@
} }
?> ?>
<?php if ($results->getResultTotal() > 0): ?> <?php if ($results->getResultTotal() > 0): ?>
<h4><?=$this->transEsc($this->slot('side-facet-caption')->get('Narrow Search')) ?></h4> <h2><?=$this->transEsc(isset($this->overrideSideFacetCaption) ? $this->overrideSideFacetCaption : 'Narrow Search')?></h2>
<div class="side-facets-container-ajax" data-search-class-id="<?=$this->escapeHtmlAttr($this->searchClassId) ?>" data-location="<?=$this->escapeHtmlAttr($this->location) ?>" data-config-index="<?=$this->escapeHtmlAttr($this->configIndex) ?>"> <div class="side-facets-container-ajax" data-search-class-id="<?=$this->escapeHtmlAttr($this->searchClassId) ?>" data-location="<?=$this->escapeHtmlAttr($this->location) ?>" data-config-index="<?=$this->escapeHtmlAttr($this->configIndex) ?>">
<?php endif; ?> <?php endif; ?>
<?php $checkboxFilters = $this->recommend->getCheckboxFacetSet(); ?> <?php $checkboxFilters = $results->getParams()->getCheckboxFacets(); ?>
<?php $checkboxesShown = false; ?> <?php $checkboxesShown = false; ?>
<?php if (count($checkboxFilters) > 0): <?php if (count($checkboxFilters) > 0):
foreach ($checkboxFilters as $current) { foreach ($checkboxFilters as $current) {
if ($results->getResultTotal() > 0 || $current['alwaysVisible']) { if ($results->getResultTotal() > 0 || $current['selected'] || $current['alwaysVisible']) {
$checkboxesShown = true; $checkboxesShown = true;
break; break;
} }
...@@ -48,6 +34,16 @@ ...@@ -48,6 +34,16 @@
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php endif; ?>
<?php $extraFilters = isset($this->extraSideFacetFilters) ? $this->extraSideFacetFilters : []; ?>
<?php $collapsedFacets = $this->recommend->getCollapsedFacets() ?>
<?php $filterList = array_merge($results->getParams()->getFilterList(true), $extraFilters); ?>
<?php if (!empty($filterList)): ?>
<?=$this->context($this)->renderInContext('Recommend/SideFacets/filter-list.phtml', [
'collapsedFacets' => $collapsedFacets,
'extraFilters' => $extraFilters,
'filterList' => $filterList,
]); ?>
<?php endif; ?>
<?= isset($this->sideFacetExtraControls) ? $this->sideFacetExtraControls : '' ?> <?= isset($this->sideFacetExtraControls) ? $this->sideFacetExtraControls : '' ?>
<?php $sideFacetSet = $this->recommend->getFacetSet(); ?> <?php $sideFacetSet = $this->recommend->getFacetSet(); ?>
<?php $hierarchicalFacets = $this->recommend->getHierarchicalFacets() ?> <?php $hierarchicalFacets = $this->recommend->getHierarchicalFacets() ?>
...@@ -59,7 +55,7 @@ ...@@ -59,7 +55,7 @@
<button class="title<?php if (in_array($field, $collapsedFacets)): ?> collapsed<?php endif ?>" data-toggle="collapse" href="#side-collapse-<?=$this->escapeHtmlAttr($field) ?>" > <button class="title<?php if (in_array($field, $collapsedFacets)): ?> collapsed<?php endif ?>" data-toggle="collapse" href="#side-collapse-<?=$this->escapeHtmlAttr($field) ?>" >
<?=$this->transEsc($facetName)?> <?=$this->transEsc($facetName)?>
</button> </button>
<div id="side-collapse-<?=$this->escapeHtmlAttr($field) ?>" class="collapse<?php if (!in_array($field, $collapsedFacets)): ?> in<?php endif ?>" data-facet="<?=$this->escapeHtmlAttr($field) ?>"<?php if (in_array($field, $forceUncollapsedFacets)): ?> data-force-in="1"<?php endif ?>> <div id="side-collapse-<?=$this->escapeHtmlAttr($field) ?>" class="collapse<?php if (!in_array($field, $collapsedFacets)): ?> in<?php endif ?>" data-facet="<?=$this->escapeHtmlAttr($field) ?>">
<span class="facet-load-indicator hidden"> <span class="facet-load-indicator hidden">
<span class="text"> <span class="text">
<i class="fa fa-spinner fa-spin"></i> <?=$this->transEsc('Loading')?>... <i class="fa fa-spinner fa-spin"></i> <?=$this->transEsc('Loading')?>...
......
<footer class="hidden-print"> <footer class="hidden-print">
<div class="footer-container"> <div class="footer-container">
<div class="footer-column"> <div class="footer-column">
<?php $this->slot('footer-left')->start(); ?> <h2><?=$this->transEsc('Search Options')?></h2>
<p><strong><?=$this->transEsc('Search Options')?></strong></p> <ul>
<ul> <li><a href="<?=$this->url('search-history')?>"><?=$this->transEsc('Search History')?></a></li>
<li><a href="<?=$this->url('search-history')?>"><?=$this->transEsc('Search History')?></a></li> <li><a href="<?=$this->url('search-advanced')?>"><?=$this->transEsc('Advanced Search')?></a></li>
<li><a href="<?=$this->url('search-advanced')?>"><?=$this->transEsc('Advanced Search')?></a></li> </ul>
</ul>
<?=$this->slot('footer-left')->end(); ?>
</div> </div>
<div class="footer-column"> <div class="footer-column">
<?php $this->slot('footer-center')->start(); ?> <h2><?=$this->transEsc('Find More')?></h2>
<p><strong><?=$this->transEsc('Find More')?></strong></p> <ul>
<ul> <li><a href="<?=$this->url('browse-home')?>"><?=$this->transEsc('Browse the Catalog')?></a></li>
<li><a href="<?=$this->url('browse-home')?>"><?=$this->transEsc('Browse the Catalog')?></a></li> <li><a href="<?=$this->url('alphabrowse-home')?>"><?=$this->transEsc('Browse Alphabetically')?></a></li>
<li><a href="<?=$this->url('alphabrowse-home')?>"><?=$this->transEsc('Browse Alphabetically')?></a></li> <li><a href="<?=$this->url('channels-home')?>"><?=$this->transEsc('channel_explore')?></a></li>
<li><a href="<?=$this->url('channels-home')?>"><?=$this->transEsc('channel_explore')?></a></li> <li><a href="<?=$this->url('search-reserves')?>"><?=$this->transEsc('Course Reserves')?></a></li>
<li><a href="<?=$this->url('search-reserves')?>"><?=$this->transEsc('Course Reserves')?></a></li> <li><a href="<?=$this->url('search-newitem')?>"><?=$this->transEsc('New Items')?></a></li>
<li><a href="<?=$this->url('search-newitem')?>"><?=$this->transEsc('New Items')?></a></li> </ul>
</ul>
<?=$this->slot('footer-center')->end(); ?>
</div> </div>
<div class="footer-column"> <div class="footer-column">
<?php $this->slot('footer-right')->start(); ?> <h2><?=$this->transEsc('Need Help?')?></h2>
<p><strong><?=$this->transEsc('Need Help?')?></strong></p> <ul>
<ul> <li><a href="<?=$this->url('help-home')?>?topic=search&amp;_=<?=time() ?>" data-lightbox class="help-link"><?=$this->transEsc('Search Tips')?></a></li>
<li><a href="<?=$this->url('help-home')?>?topic=search&amp;_=<?=time() ?>" data-lightbox class="help-link"><?=$this->transEsc('Search Tips')?></a></li> <li><a href="<?=$this->url('content-page', ['page' => 'asklibrary']) ?>"><?=$this->transEsc('Ask a Librarian')?></a></li>
<li><a href="<?=$this->url('content-page', ['page' => 'asklibrary']) ?>"><?=$this->transEsc('Ask a Librarian')?></a></li> <li><a href="<?=$this->url('content-page', ['page' => 'faq']) ?>"><?=$this->transEsc('FAQs')?></a></li>
<li><a href="<?=$this->url('content-page', ['page' => 'faq']) ?>"><?=$this->transEsc('FAQs')?></a></li> </ul>
</ul>
<?=$this->slot('footer-right')->end(); ?>
</div> </div>
</div> </div>
<div class="poweredby"> <div class="poweredby">
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment