allow protocol navigator to be unselected if only one button is shown

after activating navi/facetfilter
pull/97/head
reger 8 years ago
parent 437e535e5c
commit 8e2cef5f07

@ -71,7 +71,7 @@
<p class="navbutton"></p> <p class="navbutton"></p>
<div class="btn-group btn-group-justified"> <div class="btn-group btn-group-justified">
#{element}# #{element}#
<div class="btn-group btn-group-xs"><button type="button" class="btn btn-default#(on)#:: active#(/on)#"#(on)# onclick="window.location.href='#[url]#';"::#(/on)#>#[name]# (#[count]#)</button></div> <div class="btn-group btn-group-xs"><button type="button" class="btn btn-default#(on)#:: active#(/on)#"#(onclick)# onclick="window.location.href='#[url]#';"::#(/onclick)#>#[name]# (#[count]#)</button></div>
#{/element}# #{/element}#
</div> </div>
#(/nav-protocols)# #(/nav-protocols)#

@ -256,22 +256,25 @@ public class yacysearchtrailer {
if (oldProtocolModifier == null || !oldProtocolModifier.equals(name)) { if (oldProtocolModifier == null || !oldProtocolModifier.equals(name)) {
pos++; pos++;
prop.put("nav-protocols_element_" + i + "_on", 0); prop.put("nav-protocols_element_" + i + "_on", 0);
prop.put("nav-protocols_element_" + i + "_onclick", 0);
prop.put(fileType, "nav-protocols_element_" + i + "_modifier", nav); prop.put(fileType, "nav-protocols_element_" + i + "_modifier", nav);
} else { } else {
neg++; neg++;
prop.put("nav-protocols_element_" + i + "_on", 1); prop.put("nav-protocols_element_" + i + "_on", 1);
prop.put("nav-protocols_element_" + i + "_onclick", 1);
prop.put(fileType, "nav-protocols_element_" + i + "_modifier", "-" + nav); prop.put(fileType, "nav-protocols_element_" + i + "_modifier", "-" + nav);
nav=""; nav="";
rawNav = ""; rawNav = "";
} }
prop.put(fileType, "nav-protocols_element_" + i + "_name", name); prop.put(fileType, "nav-protocols_element_" + i + "_name", name);
String url = QueryParams.navurl(fileType, 0, theSearch.query, rawNav, false).toString(); String url = QueryParams.navurl(fileType, 0, theSearch.query, rawNav, false).toString();
prop.put("nav-protocols_element_" + i + "_on_url", url); prop.put("nav-protocols_element_" + i + "_onclick_url", url);
prop.put(fileType, "nav-protocols_element_" + i + "_url", url); prop.put(fileType, "nav-protocols_element_" + i + "_url", url);
prop.put("nav-protocols_element_" + i + "_count", count); prop.put("nav-protocols_element_" + i + "_count", count);
prop.put("nav-protocols_element_" + i + "_nl", 1); prop.put("nav-protocols_element_" + i + "_nl", 1);
i++; i++;
} }
if (i == 1) prop.put("nav-protocols_element_0_onclick", 0); // allow to unselect, if only one button
theSearch.query.modifier.protocol = oldProtocolModifier; theSearch.query.modifier.protocol = oldProtocolModifier;
if (oldProtocolModifier != null && oldProtocolModifier.length() > 0) theSearch.query.modifier.add(oldProtocolModifier.startsWith("/") ? oldProtocolModifier : "/" + oldProtocolModifier); if (oldProtocolModifier != null && oldProtocolModifier.length() > 0) theSearch.query.modifier.add(oldProtocolModifier.startsWith("/") ? oldProtocolModifier : "/" + oldProtocolModifier);
theSearch.query.getQueryGoal().query_original = oldQuery; theSearch.query.getQueryGoal().query_original = oldQuery;

Loading…
Cancel
Save