Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions config_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,12 @@
</div>
</div>





<div class="field">
<div class="two columns alpha">
<label><?php echo CONFIG_LABEL_SEARCHBAR_ON_RESULTS; ?></label>
</div>
<div class="inputs five columns omega">
<p class="explanation"><?php echo __('Adds an additional searchbar at the results page'); ?></p>
<?php echo $view->formCheckbox(SearchConfig::OPTION_SEARCHBAR_ON_RESULTS, true, array('checked' => (boolean)get_option(SearchConfig::OPTION_SEARCHBAR_ON_RESULTS))); ?>
</div>
</div>
3 changes: 3 additions & 0 deletions models/SearchConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
define('CONFIG_LABEL_PDFSEARCH', __('PDF Search'));
define('CONFIG_LABEL_RELATIONSHIPS_VIEW', __('Relationships View'));
define('CONFIG_LABEL_TITLES_ONLY', __('Titles Only'));
define('CONFIG_LABEL_SEARCHBAR_ON_RESULTS', __('Searchbar on results'));

class SearchConfig extends ConfigOptions
{
Expand All @@ -21,6 +22,7 @@ class SearchConfig extends ConfigOptions
const OPTION_PDFSEARCH = 'avantsearch_pdfsearch';
const OPTION_RELATIONSHIPS_VIEW = 'avantsearch_relationships_view';
const OPTION_TITLES_ONLY = 'avantsearch_titles_only';
const OPTION_SEARCHBAR_ON_RESULTS = 'avantsearch_searchbar_on_results';

public static function emitInnoDbMessage($engine)
{
Expand Down Expand Up @@ -303,6 +305,7 @@ public static function saveConfiguration()
self::saveOptionDataForIntegerSorting();

set_option(self::OPTION_TITLES_ONLY, intval($_POST[self::OPTION_TITLES_ONLY]));
set_option(self::OPTION_SEARCHBAR_ON_RESULTS, intval($_POST[self::OPTION_SEARCHBAR_ON_RESULTS]));
set_option(self::OPTION_RELATIONSHIPS_VIEW, intval($_POST[self::OPTION_RELATIONSHIPS_VIEW]));
set_option(self::OPTION_ADDRESS_SORTING, intval($_POST[self::OPTION_ADDRESS_SORTING]));
set_option(self::OPTION_ELASTICSEARCH, $elasticsearchOption);
Expand Down
44 changes: 44 additions & 0 deletions views/public/simple-searchbar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!-- Simple searchbar -->

<search id="simple-search">
<form id="search-form" class="advanced-search-form" action="find" aria-label="Search">
<input id="query" class="advanced-search-form input" name="keywords" type="search" placeholder="Search Items" value="<?php echo htmlspecialchars($_GET["keywords"] ?? "", ENT_QUOTES, 'UTF-8'); ?>">
<?php if (isset($_GET["condition"])) : ?> <input type="hidden" name="condition" value="<?php echo htmlspecialchars($_GET["condition"], ENT_QUOTES, 'UTF-8'); ?>"> <?php endif; ?>
<?php if (isset($_GET["tags"])) : ?> <input type="hidden" name="tags" value="<?php echo htmlspecialchars($_GET["tags"], ENT_QUOTES, 'UTF-8'); ?>"> <?php endif; ?>
<?php if (isset($_GET["year_start"])) : ?> <input type="hidden" name="year_start" value="<?php echo htmlspecialchars($_GET["year_start"], ENT_QUOTES, 'UTF-8'); ?>"> <?php endif; ?>
<?php if (isset($_GET["year_end"])) : ?> <input type="hidden" name="year_end" value="<?php echo htmlspecialchars($_GET["year_end"], ENT_QUOTES, 'UTF-8'); ?>"> <?php endif; ?>
<button id="submit_search" class="advanced-search-form button" type="submit"></button>
<a href="find/advanced" id="advanced-search-link">→ Advanced Search</a>
</form>
</search>

<style>
#simple-search {
margin-top: 3rem;
margin-bottom: 3rem;
}

#simple-search input[type="search"]#query {
margin-bottom: 0px;
}

#search-form {
box-shadow: none;
}

#submit_search {
padding-right: 10px;
margin-left: 10px;
margin-bottom: 0px;
}

#advanced-search-link {
margin-left: 20px;
margin-right: 20px;
margin-bottom: 0px;
white-space: nowrap;
display: flex;
justify-content: center;
align-items: center;
}
</style>
6 changes: 6 additions & 0 deletions views/public/table-view.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@
echo head(array('title' => $resultsMessage));
echo "<div id='{$searchResults->getSearchResultsContainerName()}'>";

if(get_option(SearchConfig::OPTION_SEARCHBAR_ON_RESULTS))
{
include 'simple-searchbar.php';
// echo $this->partial('simple-searchbar.php', array('query' => $_REQUEST["keywords"]));
}

$paginationLinks = pagination_links();
echo "<div id='search-results-title'><span>$resultsMessage</span>$paginationLinks</div>";

Expand Down