mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-24 02:13:15 +00:00
Back button to cancel facet selection
This commit is contained in:
@@ -217,6 +217,7 @@
|
||||
{% if GV_thesaurus %}
|
||||
<div id="proposals" class="PNB" style="top:85px;"
|
||||
ondblclick="return(thesau_dblclickThesaurus(event));" onclick="return(thesau_clickThesaurus(event));">
|
||||
<button id="facets-back-btn" style="display:none;">back</button>
|
||||
</div>
|
||||
<div id="thesaurus_tab" class="PNB" style="top:52px;">
|
||||
<div id="THPD_tabs">
|
||||
|
||||
@@ -552,21 +552,40 @@ function getFacetsTree() {
|
||||
var $searchForm;
|
||||
var $searchInput;
|
||||
var $facetsBackButton;
|
||||
var facetsQueriesStack = [];
|
||||
|
||||
function facetSearch(query) {
|
||||
function facetCombinedSearch(query) {
|
||||
var currentQuery = $searchInput.val();
|
||||
facetsQueriesStack.push(currentQuery);
|
||||
$facetsBackButton.show();
|
||||
if (currentQuery) {
|
||||
query = '(' + currentQuery + ') AND (' + query + ')';
|
||||
}
|
||||
facetSearch(query);
|
||||
}
|
||||
|
||||
function facetSearch(query) {
|
||||
checkFilters();
|
||||
newSearch();
|
||||
$searchInput.val(query);
|
||||
$searchForm.trigger('submit');
|
||||
}
|
||||
|
||||
function facetsBack() {
|
||||
var previousQuery = facetsQueriesStack.pop();
|
||||
if (previousQuery != null) {
|
||||
facetSearch(previousQuery);
|
||||
}
|
||||
if (!facetsQueriesStack.length) {
|
||||
$facetsBackButton.hide();
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$searchForm = $('#searchForm');
|
||||
$searchInput = $searchForm.find('input[name="qry"]');
|
||||
$facetsBackButton = $('#facets-back-btn');
|
||||
$facetsBackButton.on('click', facetsBack);
|
||||
});
|
||||
|
||||
function answerSizer() {
|
||||
|
||||
Reference in New Issue
Block a user