summaryrefslogtreecommitdiffstats
path: root/fatcat_scholar/templates
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-06-03 18:56:10 -0700
committerBryan Newbold <bnewbold@archive.org>2020-06-03 18:56:10 -0700
commit9722f39e38a45d3201c836f0c2805ae9f6c1f581 (patch)
tree5d75dc4aceb87c568eefbf85072b59f865957151 /fatcat_scholar/templates
parent042399269d593024cc8ed4a5d1e1251d435c5972 (diff)
downloadfatcat-scholar-9722f39e38a45d3201c836f0c2805ae9f6c1f581.tar.gz
fatcat-scholar-9722f39e38a45d3201c836f0c2805ae9f6c1f581.zip
partially resolve HTML form/hidden weirdness
Diffstat (limited to 'fatcat_scholar/templates')
-rw-r--r--fatcat_scholar/templates/search.html7
-rw-r--r--fatcat_scholar/templates/search_macros.html9
2 files changed, 13 insertions, 3 deletions
diff --git a/fatcat_scholar/templates/search.html b/fatcat_scholar/templates/search.html
index 9e2f06e..1f7a9b9 100644
--- a/fatcat_scholar/templates/search.html
+++ b/fatcat_scholar/templates/search.html
@@ -4,6 +4,12 @@
{% block fullmain %}
<div class="tablet-only" style="margin-top: 1.0em;">
+ <!-- these hidden query fields should be *before* any form/button that could override them -->
+ {{ search_macros.query_hidden(query.time_options, query.filter_time) }}
+ {{ search_macros.query_hidden(query.type_options, query.filter_type) }}
+ {{ search_macros.query_hidden(query.availability_options, query.filter_availability) }}
+ {{ search_macros.query_hidden(query.sort_options, query.sort_order) }}
+
<details class="search_filters">
<summary style="float: right;"><i class="filter icon"></i>{{ _("Filters") }}</summary>
<p>
@@ -106,5 +112,6 @@
</div>
{% endif %}
</div>
+
</div>
{% endblock %}
diff --git a/fatcat_scholar/templates/search_macros.html b/fatcat_scholar/templates/search_macros.html
index 1b1ada2..07a4510 100644
--- a/fatcat_scholar/templates/search_macros.html
+++ b/fatcat_scholar/templates/search_macros.html
@@ -198,9 +198,6 @@
{% macro query_option(options, selected) -%}
<span style="color: rgba(0,0,0,0.4);">{{ _(options.label) }}</span>
<div class="ui link list" style="margin-top: 0.3em;">
- {% if selected %}
- <input form="search_form" type="hidden" name="{{ options.slug }}" value="{{ selected }}">
- {% endif %}
{% for opt in options.list %}
<button class="text-button" form="search_form" type="submit" name="{{ options.slug }}" value="{{ opt.slug }}">
{% if selected == opt.slug or (not selected and opt.slug == options.default) %}
@@ -217,3 +214,9 @@
</div>
<br>
{% endmacro %}
+
+{% macro query_hidden(options, selected) -%}
+{% if selected %}
+ <input form="search_form" type="hidden" name="{{ options.slug }}" value="{{ selected }}">
+{% endif %}
+{% endmacro %}