From b9ba24553e2e1de3c3ac0faeba59231ec512fa67 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 1 Jul 2020 20:27:45 -0700 Subject: refactor release and container search Based on fatcat-scholar refactoring. This doesn't include refactoring of stats, aggregates, or histograms yet, just the direct queries. Don't have any test coverage yet; intend to try elasticmock or figuring out how to ingest mock JSON results directly. --- python/fatcat_web/templates/container_search.html | 16 ++++++++-------- python/fatcat_web/templates/entity_macros.html | 10 +++++----- python/fatcat_web/templates/release_search.html | 20 ++++++++++---------- 3 files changed, 23 insertions(+), 23 deletions(-) (limited to 'python/fatcat_web/templates') diff --git a/python/fatcat_web/templates/container_search.html b/python/fatcat_web/templates/container_search.html index 1a804595..2566f542 100644 --- a/python/fatcat_web/templates/container_search.html +++ b/python/fatcat_web/templates/container_search.html @@ -2,8 +2,8 @@ {% extends "base.html" %} {% block title %} -{% if query %} - Search: {{ query }} +{% if query.q %} + Search: {{ query.q }} {% else %} Release Search {% endif %} @@ -18,9 +18,9 @@
- +
-
Can also lookup by identifier or search releases. +
Can also lookup by identifier or search releases.
@@ -32,7 +32,7 @@ {% if found %} {% if found.results %} - {{ entity_macros.top_results(found) }} + {{ entity_macros.top_results(query, found) }} {% for entity in found.results %}
@@ -55,13 +55,13 @@ {% if found.results|length > 8 %}
- {{ entity_macros.bottom_results(found, endpoint='container_search') }} + {{ entity_macros.bottom_results(query, found, endpoint='container_search') }}
{% endif %} {% else %} - Raw query was: {{ found.query.q }} + Raw query was: {{ query.q }}
@@ -72,7 +72,7 @@

No results found!

You could try elsewhere:

diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html index c22eb106..0e7f135a 100644 --- a/python/fatcat_web/templates/entity_macros.html +++ b/python/fatcat_web/templates/entity_macros.html @@ -262,7 +262,7 @@ yellow {% endif %} {%- endmacro %} -{% macro top_results(found) -%} +{% macro top_results(query, found) -%} Showing {% if found.offset == 0 %} @@ -278,13 +278,13 @@ yellow {%- endmacro %} -{% macro bottom_results(found, endpoint='release_search') -%} +{% macro bottom_results(query, found, endpoint='release_search') -%} {% if found.offset > 0 %} {% if found.offset - found.limit < 0 %} - « Previous + « Previous {% else %} - « Previous + « Previous {% endif %} {% else %} « Previous @@ -294,7 +294,7 @@ yellow found.count_returned }} out of {{ found.count_found }} results   {% if found.offset + found.limit < found.count_found and found.offset + found.limit < found.deep_page_limit %} - Next » + Next » {% else %} Next » {% endif %} diff --git a/python/fatcat_web/templates/release_search.html b/python/fatcat_web/templates/release_search.html index a600f1b2..58aa35d6 100644 --- a/python/fatcat_web/templates/release_search.html +++ b/python/fatcat_web/templates/release_search.html @@ -2,8 +2,8 @@ {% extends "base.html" %} {% block title %} -{% if query %} - Search: {{ query }} +{% if query.q %} + Search: {{ query.q }} {% else %} Release Search {% endif %} @@ -18,14 +18,14 @@
- +
-
Can also lookup by identifier or search for containers (eg, journals). +
Can also lookup by identifier or search for containers (eg, journals).
@@ -37,7 +37,7 @@ {% if found %} {% if found.results %} - {{ entity_macros.top_results(found) }} + {{ entity_macros.top_results(query, found) }} {% for paper in found.results %} {{ entity_macros.release_search_result_row(paper) }} @@ -46,13 +46,13 @@ {% if found.results|length > 8 %}
- {{ entity_macros.bottom_results(found, endpoint='release_search') }} + {{ entity_macros.bottom_results(query, found, endpoint='release_search') }}
{% endif %} {% else %} - Raw query was: {{ found.query.q }} + Raw query was: {{ query.q }}
@@ -63,9 +63,9 @@

No results found!

You could try elsewhere:

-- cgit v1.2.3