forked from vufind-org/vufind
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request vufind-org#14 from samuli/search-tabs
[ALLI-3219] Search tabs.
- Loading branch information
Showing
12 changed files
with
8,425 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,3 +51,4 @@ | |
// Finna extensions | ||
@import "image-popup.less"; | ||
@import "finnaicons.less"; | ||
@import "tabs.less"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
.finna-main-tabs { | ||
background-color: @brand-secondary; | ||
margin-bottom: 30px; | ||
|
||
& ul.nav-tabs { | ||
border-bottom: none; | ||
margin: 0; | ||
|
||
> li { | ||
color: #fff; | ||
margin: 0 4px 0 0; | ||
|
||
> a { | ||
background-color: @brand-primary; | ||
padding: 10px 15px 10px 15px; | ||
margin-bottom: 0; | ||
border: 0; | ||
border-radius: 0; | ||
font-size: 1em; | ||
font-weight: bold; | ||
color: #fff; | ||
transition: none; | ||
} | ||
|
||
&.active { | ||
> a { | ||
background-color: #fff; | ||
color: #4d4d4d; | ||
border: none; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
.main.template-name-advanced .finna-main-tabs { | ||
padding-top: 25px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
<? | ||
// Set page title. | ||
$this->headTitle($this->translate('Advanced Search')); | ||
|
||
// Disable top search box -- this page has a special layout. | ||
$this->layout()->searchbox = false; | ||
|
||
// Set up breadcrumbs: | ||
$this->layout()->breadcrumbs = '<li class="active">' . $this->transEsc('Advanced Search') . '</li>'; | ||
|
||
// Set up saved search details: | ||
if (isset($this->saved) && is_object($this->saved)) { | ||
$searchDetails = $this->saved->getParams()->getQuery(); | ||
if ($searchDetails instanceof \VuFindSearch\Query\Query) { | ||
// Not an advanced query -- ignore it. | ||
$searchDetails = $groups = false; | ||
} else { | ||
$groups = $searchDetails->getQueries(); | ||
} | ||
$hasDefaultsApplied = $this->saved->getParams()->hasDefaultsApplied(); | ||
$searchFilters = $this->saved->getParams()->getFilterList(); | ||
} else { | ||
$hasDefaultsApplied = $searchDetails = $searchFilters = $groups = false; | ||
} | ||
?> | ||
<form id="advSearchForm" name="searchForm" method="get" action="<?=$this->url($this->options->getSearchAction())?>" class="form-horizontal"> | ||
<input type="hidden" name="join" value="AND" /> | ||
<div class="row"> | ||
<div class="<?=$this->layoutClass('mainbody')?>"> | ||
<? | ||
$this->searchType = 'advanced'; | ||
$this->layout()->finnaMainTabs = $this->render('search/searchTabs'); | ||
?> | ||
<h3><?=$this->transEsc('Advanced Search')?></h3> | ||
<? /* fallback to a fixed set of search groups/fields if JavaScript is turned off */ ?> | ||
<? if ($groups !== false) { | ||
$numGroups = count($groups); | ||
} | ||
if (!isset($numGroups) || $numGroups < 3) { | ||
$numGroups = 1; | ||
} | ||
?> | ||
<? for ($i = 0; $i < $numGroups; $i++): ?> | ||
<input type="hidden" name="bool<?=$i?>[]" value="AND" /> | ||
<div class="group well row" id="group<?=$i?>"> | ||
<div class="col-sm-2" id="group<?=$i?>SearchHolder"><label><?=$this->transEsc("adv_search_label")?>:</label></div> | ||
<div class="col-sm-10"> | ||
<? | ||
if (isset($groups[$i])) { | ||
$currentGroup = $groups[$i]->getQueries(); | ||
$numRows = count($currentGroup); | ||
} else { | ||
$currentGroup = false; | ||
} | ||
if (!isset($numRows) || $numRows < 3) { | ||
$numRows = 3; | ||
} | ||
?> | ||
<? for ($j = 0; $j < $numRows; $j++): ?> | ||
<? $currRow = isset($currentGroup[$j]) ? $currentGroup[$j] : false; ?> | ||
<div class="row"> | ||
<div class="col-sm-3"> | ||
<select id="search_type<?=$i?>_<?=$j?>" name="type<?=$i?>[]" class="form-control"> | ||
<? foreach ($this->options->getAdvancedHandlers() as $searchVal => $searchDesc): ?> | ||
<option value="<?=$this->escapeHtmlAttr($searchVal)?>"<?=($currRow && $currRow->getHandler() == $searchVal)?' selected="selected"':''?>><?=$this->transEsc($searchDesc)?></option> | ||
<? endforeach; ?> | ||
</select> | ||
</div> | ||
<div class="col-sm-3"> | ||
<select name="op<?=$i?>[]" id="searchForm_op<?=$i?>_<?=$j?>" class="form-control"> | ||
<? foreach ($this->options->getAdvancedOperators() as $searchVal => $searchDesc): ?> | ||
<option value="<?=$this->escapeHtmlAttr($searchVal)?>"<?=($currRow && $currRow->getOperator() == $searchVal)?' selected="selected"':''?>><?=$this->transEsc($searchDesc)?></option> | ||
<? endforeach; ?> | ||
</select> | ||
</div> | ||
<div class="col-sm-6"> | ||
<input id="search_lookfor<?=$i?>_<?=$j?>" type="text" value="<?=$currRow?$this->escapeHtmlAttr($currRow->getString()):''?>" size="30" name="lookfor<?=$i?>[]" class="form-control"/> | ||
</div> | ||
</div> | ||
<? endfor; ?> | ||
</div> | ||
</div> | ||
<? endfor; ?> | ||
<? $lastSort = $this->options->getLastSort(); ?> | ||
<? if (!empty($lastSort)): ?> | ||
<input type="hidden" name="sort" value="<?=$this->escapeHtmlAttr($lastSort)?>" /> | ||
<? endif; ?> | ||
<input type="submit" class="btn btn-primary" name="submit" value="<?=$this->transEsc("Find")?>"/> | ||
</div> | ||
|
||
<div class="<?=$this->layoutClass('sidebar')?>"> | ||
<? if ($hasDefaultsApplied): ?> | ||
<input type="hidden" name="dfApplied" value="1" /> | ||
<? endif ?> | ||
<? if (!empty($searchFilters)): ?> | ||
<h4><?=$this->transEsc("adv_search_filters")?></h4> | ||
<ul class="list-group"> | ||
<li class="list-group-item"> | ||
<div class="checkbox"> | ||
<label> | ||
<?=$this->transEsc("adv_search_select_all")?> | ||
<input type="checkbox" checked="checked" class="checkbox-select-all" /> | ||
</label> | ||
</div> | ||
</li> | ||
</ul> | ||
<? foreach ($searchFilters as $field => $data): ?> | ||
<div> | ||
<ul class="list-group"> | ||
<li class="list-group-item title"><?=$this->transEsc($field)?></li> | ||
<? foreach ($data as $value): ?> | ||
<li class="list-group-item"> | ||
<div class="checkbox"> | ||
<label> | ||
<input type="checkbox" class="checkbox-select-item" checked="checked" name="filter[]" value='<?=$this->escapeHtmlAttr($value['field'])?>:"<?=$this->escapeHtmlAttr($value['value'])?>"' /> <?=$this->escapeHtml($value['displayText'])?> | ||
</label> | ||
</div> | ||
</li> | ||
<? endforeach; ?> | ||
</ul> | ||
</div> | ||
<? endforeach; ?> | ||
<? endif; ?> | ||
</div> | ||
</div> | ||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<? | ||
// Set page title. | ||
$this->headTitle($this->translate('Advanced Search')); | ||
|
||
// Disable top search box -- this page has a special layout. | ||
$this->layout()->searchbox = false; | ||
|
||
// Set up breadcrumbs: | ||
$this->layout()->breadcrumbs = '<li>' . $this->getLastSearchLink($this->transEsc('Search'), '', '</li> ') | ||
. '<li class="active">' . $this->transEsc('Advanced') . '</li>'; | ||
|
||
// Set up saved search details: | ||
if (isset($this->saved) && is_object($this->saved)) { | ||
$searchDetails = $this->saved->getParams()->getQuery(); | ||
if ($searchDetails instanceof \VuFindSearch\Query\Query) { | ||
// Not an advanced query -- ignore it. | ||
$searchDetails = $groups = false; | ||
} else { | ||
$groups = $searchDetails->getQueries(); | ||
} | ||
$hasDefaultsApplied = $this->saved->getParams()->hasDefaultsApplied(); | ||
$searchFilters = $this->saved->getParams()->getFilterList(); | ||
} else { | ||
$hasDefaultsApplied = $searchDetails = $searchFilters = $groups = false; | ||
} | ||
|
||
// Set up Javascript: | ||
// Step 1: Define our search arrays so they are usuable in the javascript | ||
$this->headScript()->appendScript($this->render('search/advanced/globals.phtml')); | ||
// Step 2: Call the javascript to make use of the above | ||
$this->headScript()->appendFile( | ||
isset($this->advancedSearchJsOverride) ? $this->advancedSearchJsOverride : 'advanced_search.js' | ||
); | ||
// Step 3: Build the page | ||
$this->headScript()->appendScript( | ||
$this->partial( | ||
isset($this->buildPageOverride) ? $this->buildPageOverride : 'search/advanced/build_page.phtml', | ||
array('searchDetails' => $searchDetails) | ||
) | ||
); | ||
?> | ||
|
||
<?=$this->flashmessages()?> | ||
<form role="search" name="searchForm" id="advSearchForm" method="get" action="<?=$this->url($this->options->getSearchAction())?>"> | ||
<div class="row"> | ||
<div class="<?=$this->layoutClass('mainbody')?>"> | ||
<input type="hidden" name="sort" value="relevance"> | ||
<? | ||
$this->searchType = 'advanced'; | ||
$this->layout()->finnaMainTabs = $this->render('search/searchTabs'); | ||
?> | ||
<div class="clearfix"> | ||
<p class="lead pull-left"><?=$this->transEsc('Advanced Search')?></p> | ||
<div id="groupJoin" class="form-inline pull-right hidden"> | ||
<label for="groupJoinOptions"><?=$this->transEsc("search_match")?>:</label> | ||
<select id="groupJoinOptions" name="join" class="form-control"> | ||
<option value="AND"<? if($searchDetails && $searchDetails->getOperator()=='ALL'):?> selected<?endif?>><?= $this->transEsc('group_AND') ?></option> | ||
<option value="OR"<? if($searchDetails && $searchDetails->getOperator()=='OR'):?> selected<?endif?>><?= $this->transEsc('group_OR') ?></option> | ||
</select> | ||
</div> | ||
</div> | ||
<span id="groupPlaceHolder"> | ||
<i class="fa fa-plus-circle"></i> <a href="#" onClick="addGroup()"><?= $this->transEsc('add_search_group') ?></a> | ||
</span> | ||
<input class="btn btn-primary pull-right" type="submit" value="<?= $this->transEsc('Find')?>"> | ||
<? if (isset($this->extraAdvancedControls)): ?> | ||
<?=$this->extraAdvancedControls ?> | ||
<input class="btn btn-primary pull-right" type="submit" value="<?= $this->transEsc('Find')?>"/> | ||
<? endif; ?> | ||
</div> | ||
|
||
<div class="<?=$this->layoutClass('sidebar')?>"> | ||
<? if ($hasDefaultsApplied): ?> | ||
<input type="hidden" name="dfApplied" value="1" /> | ||
<? endif ?> | ||
<? if (!empty($searchFilters)): ?> | ||
<h4><?=$this->transEsc("adv_search_filters")?></h4> | ||
<ul class="list-group"> | ||
<label class="list-group-item checkbox"><?=$this->transEsc("adv_search_select_all")?> <input type="checkbox" checked="checked" class="checkbox-select-all"/></label> | ||
</ul> | ||
<? foreach ($searchFilters as $field => $data): ?> | ||
<ul class="list-group"> | ||
<li class="list-group-item title"><?=$this->transEsc($field)?></li> | ||
<? foreach ($data as $value): ?> | ||
<label class="list-group-item checkbox"><input class="checkbox-select-item" type="checkbox" checked="checked" name="filter[]" value='<?=$this->escapeHtmlAttr($value['field'])?>:"<?=$this->escapeHtmlAttr($value['value'])?>"' /> <?=$this->escapeHtml($value['displayText'])?></label> | ||
<? endforeach; ?> | ||
</ul> | ||
<? endforeach; ?> | ||
<? endif; ?> | ||
<div class="sidegroup"> | ||
<h4><?=$this->transEsc("Search Tips")?></h4> | ||
<ul class="list-group"> | ||
<a class="list-group-item help-link" href="<?=$this->url('help-home')?>?topic=advsearch" title="<?=$this->transEsc('Help with Advanced Search')?>"><?=$this->transEsc("Help with Advanced Search")?></a> | ||
<a class="list-group-item help-link" href="<?=$this->url('help-home')?>?topic=search" title="<?=$this->transEsc('Help with Search Operators')?>"><?=$this->transEsc("Help with Search Operators")?></a> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters