Skip to content

Commit

Permalink
Fix institutional search box options (#1635)
Browse files Browse the repository at this point in the history
- Fixed institutional search options not showing up in BS2 theme, and
advanced search options not auto-expanding on the browse page when using
the showAdvanced url parameter.
- Changed the search box to have global search as the default option
- Fixed institutional search in arArchivesCanadaPlugin by moving the
quick links bar to be after the header in the template.
- Removed the search input area having the placeholder include the
repository name since this might be confusing as it doesn't update when
the user clicks an institutional search option radio button.
  • Loading branch information
anvit committed Oct 17, 2023
1 parent 18afdb6 commit 1490c23
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

<a
href="#"
class="advanced-search-toggle <?php echo $show ? 'open' : ''; ?>"
aria-expanded="<?php echo $show ? 'true' : 'false'; ?>"
class="advanced-search-toggle <?php echo $showAdvanced ? 'open' : ''; ?>"
aria-expanded="<?php echo $showAdvanced ? 'true' : 'false'; ?>"
data-cy="advanced-search-toggle"
>
<?php echo __('Advanced search options'); ?>
</a>

<div class="advanced-search animateNicely"
<?php echo !$show ? 'style="display: none;"' : ''; ?>>
<?php echo !$showAdvanced ? 'style="display: none;"' : ''; ?>>

<?php echo $form->renderFormTag(
url_for(['module' => 'informationobject', 'action' => 'browse']),
Expand Down
12 changes: 2 additions & 10 deletions apps/qubit/modules/search/templates/_box.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
<input type="hidden" name="topLod" value="0"/>
<input type="hidden" name="sort" value="relevance"/>

<?php if (isset($repository) && !sfConfig::get('app_enable_institutional_scoping')) { ?>
<input type="text" name="query"<?php echo isset($sf_request->query) ? ' class="focused"' : ''; ?> aria-label="<?php echo __('Search %1%', ['%1%' => strip_markdown($repository)]); ?>" value="<?php echo $sf_request->query; ?>" placeholder="<?php echo __('Search %1%', ['%1%' => strip_markdown($repository)]); ?>"/>
<?php } else { ?>
<input type="text" name="query"<?php echo isset($sf_request->query) ? ' class="focused"' : ''; ?> aria-label="<?php echo __('%1%', ['%1%' => sfConfig::get('app_ui_label_globalSearch')]); ?>" value="<?php echo !$sf_user->getAttribute('search-realm') || !sfConfig::get('app_enable_institutional_scoping') ? $sf_request->query : ''; ?>" placeholder="<?php echo __('%1%', ['%1%' => sfConfig::get('app_ui_label_globalSearch')]); ?>"/>
<?php } ?>
<input type="text" name="query"<?php echo isset($sf_request->query) ? ' class="focused"' : ''; ?> aria-label="<?php echo __('%1%', ['%1%' => sfConfig::get('app_ui_label_globalSearch')]); ?>" value="<?php echo !$sf_user->getAttribute('search-realm') || !sfConfig::get('app_enable_institutional_scoping') ? $sf_request->query : ''; ?>" placeholder="<?php echo __('%1%', ['%1%' => sfConfig::get('app_ui_label_globalSearch')]); ?>"/>

<button aria-label="<?php echo __('Search'); ?>"></button>

Expand All @@ -21,19 +17,15 @@

<div>
<label>
<?php if (isset($repository)) { ?>
<input name="repos" type="radio" value data-placeholder="<?php echo __('Search'); ?>">
<?php } else { ?>
<input name="repos" type="radio" value checked="checked" data-placeholder="<?php echo __('Search'); ?>">
<?php } ?>
<?php echo __('Global search'); ?>
</label>
</div>

<?php if (isset($repository)) { ?>
<div>
<label>
<input name="repos" checked="checked" type="radio" value="<?php echo $repository->id; ?>" data-placeholder="<?php echo __('Search %1%', ['%1%' => strip_markdown($repository)]); ?>"/>
<input name="repos" type="radio" value="<?php echo $repository->id; ?>" data-placeholder="<?php echo __('Search %1%', ['%1%' => strip_markdown($repository)]); ?>"/>
<?php echo __('Search <span>%1%</span>', ['%1%' => render_title($repository)]); ?>
</label>
</div>
Expand Down
16 changes: 8 additions & 8 deletions apps/qubit/templates/_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
</h1>
<?php } ?>

<div id="search-bar">

<?php echo get_component('menu', 'browseMenu', ['sf_cache_key' => $sf_user->getCulture().$sf_user->getUserID()]); ?>

<?php echo get_component('search', 'box'); ?>

</div>

<nav>

<?php echo get_component('menu', 'userMenu'); ?>
Expand All @@ -38,14 +46,6 @@

</nav>

<div id="search-bar">

<?php echo get_component('menu', 'browseMenu', ['sf_cache_key' => $sf_user->getCulture().$sf_user->getUserID()]); ?>

<?php echo get_component('search', 'box'); ?>

</div>

<?php echo get_component_slot('header'); ?>

</header>
Expand Down
4 changes: 4 additions & 0 deletions plugins/arArchivesCanadaPlugin/css/less/header.less
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@
}
}

.header-bar {
display: flex;
flex-direction: column-reverse;
}
@media (max-width: 530px) {
#header-search #search-form-wrapper {
width: 75%;
Expand Down
14 changes: 3 additions & 11 deletions plugins/arArchivesCanadaPlugin/modules/search/templates/_box.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@

<div class="input-append">

<?php if (isset($repository)) { ?>
<input type="text" name="query"<?php echo isset($sf_request->query) ? ' class="focused"' : ''; ?> value="<?php echo $sf_request->query; ?>" placeholder="<?php echo __('Search %1%', ['%1%' => strip_markdown($repository)]); ?>"/>
<?php } else { ?>
<input type="text" name="query"<?php echo isset($sf_request->query) ? ' class="focused"' : ''; ?> value="<?php echo $sf_request->query; ?>" placeholder="<?php echo __('Search'); ?>"/>
<?php } ?>
<input type="text" name="query"<?php echo isset($sf_request->query) ? ' class="focused"' : ''; ?> value="<?php echo $sf_request->query; ?>" placeholder="<?php echo __('Search'); ?>"/>

<div class="btn-group">
<button class="btn dropdown-toggle" data-toggle="dropdown">
Expand Down Expand Up @@ -60,19 +56,15 @@

<div>
<label>
<?php if (isset($repository)) { ?>
<input name="repos" type="radio" value data-placeholder="<?php echo __('Search'); ?>">
<?php } else { ?>
<input name="repos" type="radio" value checked="checked" data-placeholder="<?php echo __('Search'); ?>">
<?php } ?>
<input name="repos" type="radio" value checked="checked" data-placeholder="<?php echo __('Search'); ?>">
<?php echo __('Global search'); ?>
</label>
</div>

<?php if (isset($repository)) { ?>
<div>
<label>
<input name="repos" checked="checked" type="radio" value="<?php echo $repository->id; ?>"/>
<input name="repos" type="radio" value="<?php echo $repository->id; ?>"/>
<?php echo __('Search <span>%1%</span>', ['%1%' => render_title($repository)]); ?>
</label>
</div>
Expand Down
114 changes: 58 additions & 56 deletions plugins/arArchivesCanadaPlugin/templates/_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,84 +12,86 @@
</div>
<?php } ?>

<?php if ($sf_user->isAuthenticated()) { ?>
<div id="top-bar">
<nav>
<?php echo get_component('menu', 'userMenu'); ?>
<?php echo get_component('menu', 'quickLinksMenu'); ?>
<?php if (sfConfig::get('app_toggleLanguageMenu')) { ?>
<?php echo get_component('menu', 'changeLanguageMenu'); ?>
<?php } ?>
<?php echo get_component('menu', 'mainMenu', ['sf_cache_key' => $sf_user->getCulture().$sf_user->getUserID()]); ?>
</nav>
</div>
<?php } ?>

<div id="header">
<div class="header-bar">
<div id="header">

<div class="container">
<div class="container">

<div id="header-lvl1">
<div class="row">
<div class="span12">

<?php if ('fr' == $sf_user->getCulture()) { ?>
<a id="header-council" href="http://cdncouncilarchives.ca"><?php echo image_tag('/plugins/arArchivesCanadaPlugin/images/council.fr.png', ['width' => '156', 'height' => '42', 'alt' => __('Canadian Council of Archives')]); ?></a>
<?php } else { ?>
<a id="header-council" href="http://cdncouncilarchives.ca"><?php echo image_tag('/plugins/arArchivesCanadaPlugin/images/council.en.png', ['width' => '156', 'height' => '42', 'alt' => __('Canadian Council of Archives')]); ?></a>
<?php } ?>

<ul id="header-nav" class="nav nav-pills">
<div id="header-lvl1">
<div class="row">
<div class="span12">

<?php if ('fr' == $sf_user->getCulture()) { ?>
<li><?php echo link_to(__('Home'), 'http://archivescanada.ca/homeFR'); ?></li>
<a id="header-council" href="http://cdncouncilarchives.ca"><?php echo image_tag('/plugins/arArchivesCanadaPlugin/images/council.fr.png', ['width' => '156', 'height' => '42', 'alt' => __('Canadian Council of Archives')]); ?></a>
<?php } else { ?>
<li><?php echo link_to(__('Home'), 'http://archivescanada.ca'); ?></li>
<a id="header-council" href="http://cdncouncilarchives.ca"><?php echo image_tag('/plugins/arArchivesCanadaPlugin/images/council.en.png', ['width' => '156', 'height' => '42', 'alt' => __('Canadian Council of Archives')]); ?></a>
<?php } ?>

<?php if ('fr' == $sf_user->getCulture()) { ?>
<li><?php echo link_to(__('Contactez-nous'), ['module' => 'staticpage', 'slug' => 'contact']); ?></li>
<?php } else { ?>
<li><?php echo link_to(__('Contact us'), ['module' => 'staticpage', 'slug' => 'contact']); ?></li>
<?php } ?>
<ul id="header-nav" class="nav nav-pills">

<?php foreach (['en', 'fr'] as $item) { ?>
<?php if ($sf_user->getCulture() != $item) { ?>
<li><?php echo link_to(format_language($item, $item), ['sf_culture' => $item] + $sf_data->getRaw('sf_request')->getParameterHolder()->getAll()); ?></li>
<?php break; ?>
<?php if ('fr' == $sf_user->getCulture()) { ?>
<li><?php echo link_to(__('Home'), 'http://archivescanada.ca/homeFR'); ?></li>
<?php } else { ?>
<li><?php echo link_to(__('Home'), 'http://archivescanada.ca'); ?></li>
<?php } ?>
<?php } ?>

<?php if (!$sf_user->isAuthenticated()) { ?>
<li><?php echo link_to(__('Log in'), ['module' => 'user', 'action' => 'login']); ?></li>
<?php } ?>
<?php if ('fr' == $sf_user->getCulture()) { ?>
<li><?php echo link_to(__('Contactez-nous'), ['module' => 'staticpage', 'slug' => 'contact']); ?></li>
<?php } else { ?>
<li><?php echo link_to(__('Contact us'), ['module' => 'staticpage', 'slug' => 'contact']); ?></li>
<?php } ?>

<?php foreach (['en', 'fr'] as $item) { ?>
<?php if ($sf_user->getCulture() != $item) { ?>
<li><?php echo link_to(format_language($item, $item), ['sf_culture' => $item] + $sf_data->getRaw('sf_request')->getParameterHolder()->getAll()); ?></li>
<?php break; ?>
<?php } ?>
<?php } ?>

<?php if (!$sf_user->isAuthenticated()) { ?>
<li><?php echo link_to(__('Log in'), ['module' => 'user', 'action' => 'login']); ?></li>
<?php } ?>

</ul>
</ul>

</div>
</div>
</div>
</div>

<div id="header-lvl2">
<div class="row">
<div id="header-lvl2">
<div class="row">

<div id="logo-and-name" class="span6">
<?php if ('fr' == $sf_user->getCulture()) { ?>
<h1><?php echo link_to(image_tag('/plugins/arArchivesCanadaPlugin/images/logo.png', ['alt' => __('Archives Canada')]), 'http://archivescanada.ca/homeFR', ['rel' => 'home']); ?></h1>
<?php } else { ?>
<h1><?php echo link_to(image_tag('/plugins/arArchivesCanadaPlugin/images/logo.png', ['alt' => __('Archives Canada')]), 'http://archivescanada.ca', ['rel' => 'home']); ?></h1>
<?php } ?>
</div>
<div id="logo-and-name" class="span6">
<?php if ('fr' == $sf_user->getCulture()) { ?>
<h1><?php echo link_to(image_tag('/plugins/arArchivesCanadaPlugin/images/logo.png', ['alt' => __('Archives Canada')]), 'http://archivescanada.ca/homeFR', ['rel' => 'home']); ?></h1>
<?php } else { ?>
<h1><?php echo link_to(image_tag('/plugins/arArchivesCanadaPlugin/images/logo.png', ['alt' => __('Archives Canada')]), 'http://archivescanada.ca', ['rel' => 'home']); ?></h1>
<?php } ?>
</div>

<div id="header-search" class="span6">
<?php echo get_component('search', 'box'); ?>
<div id="header-search" class="span6">
<?php echo get_component('search', 'box'); ?>

<?php echo get_component('menu', 'clipboardMenu'); ?>
</div>
<?php echo get_component('menu', 'clipboardMenu'); ?>
</div>

</div>
</div>

</div>

</div>
<?php if ($sf_user->isAuthenticated()) { ?>
<div id="top-bar">
<nav>
<?php echo get_component('menu', 'userMenu'); ?>
<?php echo get_component('menu', 'quickLinksMenu'); ?>
<?php if (sfConfig::get('app_toggleLanguageMenu')) { ?>
<?php echo get_component('menu', 'changeLanguageMenu'); ?>
<?php } ?>
<?php echo get_component('menu', 'mainMenu', ['sf_cache_key' => $sf_user->getCulture().$sf_user->getUserID()]); ?>
</nav>
</div>
<?php } ?>

</div>
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<div class="accordion mb-3 adv-search" role="search">
<div class="accordion-item">
<h2 class="accordion-header" id="heading-adv-search">
<button class="accordion-button<?php echo $show ? '' : ' collapsed'; ?>" type="button" data-bs-toggle="collapse" data-bs-target="#collapse-adv-search" aria-expanded="<?php echo $show ? 'true' : 'false'; ?>" aria-controls="collapse-adv-search" data-cy="advanced-search-toggle">
<button class="accordion-button<?php echo $showAdvanced ? '' : ' collapsed'; ?>" type="button" data-bs-toggle="collapse" data-bs-target="#collapse-adv-search" aria-expanded="<?php echo $showAdvanced ? 'true' : 'false'; ?>" aria-controls="collapse-adv-search" data-cy="advanced-search-toggle">
<?php echo __('Advanced search options'); ?>
</button>
</h2>
<div id="collapse-adv-search" class="accordion-collapse collapse<?php echo $show ? ' show' : ''; ?>" aria-labelledby="heading-adv-search">
<div id="collapse-adv-search" class="accordion-collapse collapse<?php echo $showAdvanced ? ' show' : ''; ?>" aria-labelledby="heading-adv-search">
<div class="accordion-body">
<?php echo $form->renderFormTag(url_for(['module' => 'informationobject', 'action' => 'browse']), ['name' => 'advanced-search-form', 'method' => 'get']); ?>

Expand Down
3 changes: 1 addition & 2 deletions plugins/arDominionB5Plugin/modules/search/templates/_box.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class="form-check-input"
type="radio"
name="repos"
id="search-realm-global"
<?php echo !isset($repository) ? 'checked' : ''; ?>
checked
value>
<label class="form-check-label" for="search-realm-global">
<?php echo __('Global search'); ?>
Expand All @@ -39,7 +39,6 @@ class="form-check-input"
type="radio"
name="repos"
id="search-realm-repo"
checked
value="<?php echo $repository->id; ?>">
<label class="form-check-label" for="search-realm-repo">
<?php echo __('Search <span>%1%</span>', ['%1%' => render_title($repository)]); ?>
Expand Down

0 comments on commit 1490c23

Please sign in to comment.