diff options
author | bnewbold <bnewbold@archive.org> | 2020-07-24 17:25:35 +0000 |
---|---|---|
committer | bnewbold <bnewbold@archive.org> | 2020-07-24 17:25:35 +0000 |
commit | 655de9edfb4fab6c861332bf60e02adf67ebfac6 (patch) | |
tree | 5053f9790f5adbab75c010bed988fe3c09838785 /python/fatcat_web/templates | |
parent | 8b00843af1366cf019c896057706ace4afff27ba (diff) | |
parent | 7010abf54fae6a04f4a0700651e64a1fe5b5b2c8 (diff) | |
download | fatcat-655de9edfb4fab6c861332bf60e02adf67ebfac6.tar.gz fatcat-655de9edfb4fab6c861332bf60e02adf67ebfac6.zip |
Merge branch 'bnewbold-es-refactor' into 'master'
web ES search refactor
See merge request webgroup/fatcat!68
Diffstat (limited to 'python/fatcat_web/templates')
-rw-r--r-- | python/fatcat_web/templates/container_search.html | 16 | ||||
-rw-r--r-- | python/fatcat_web/templates/entity_macros.html | 10 | ||||
-rw-r--r-- | python/fatcat_web/templates/release_search.html | 20 |
3 files changed, 23 insertions, 23 deletions
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 @@ <form class="" role="search" action="/container/search" method="get"> <div class="ui form"> <div class="ui action input huge fluid"> - <input type="text" placeholder="Query..." name="q" value="{% if query %}{{ query }}{% endif %}" aria-label="search container metadata"> <button class="ui button">Search</button> + <input type="text" placeholder="Query..." name="q" value="{% if query.q %}{{ query.q }}{% endif %}" aria-label="search container metadata"> <button class="ui button">Search</button> </div> - <br>Can also lookup by <b><a href="/container/lookup">identifier</a></b> or search <b><a href="/release/search?q={{ query or "" }}">releases</a></b>. + <br>Can also lookup by <b><a href="/container/lookup">identifier</a></b> or search <b><a href="/release/search?q={{ query.q or "" }}">releases</a></b>. </div> </form> </div> @@ -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 %} <div> @@ -55,13 +55,13 @@ {% if found.results|length > 8 %} <div class="ui divider"></div> <div style="text-align: center"> - {{ entity_macros.bottom_results(found, endpoint='container_search') }} + {{ entity_macros.bottom_results(query, found, endpoint='container_search') }} </div> {% endif %} {% else %} - Raw query was: <i>{{ found.query.q }}</i> + Raw query was: <i>{{ query.q }}</i> <div class="ui centered stackable grid" style="padding-top: 15%;"> <div class="row"> @@ -72,7 +72,7 @@ <h2>No results found!</h2> <p>You could try elsewhere:</p> <ul> - <li>Search <a href="https://scholar.google.com/scholar?q={{ found.query.q | urlencode }}">Google Scholar</a></li> + <li>Search <a href="https://scholar.google.com/scholar?q={{ query.q | urlencode }}">Google Scholar</a></li> </ul> </div> </div> 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) -%} <i>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 %} - <a href="{{ url_for(endpoint, q=found.query.q, offset=0) }}">« Previous</a> + <a href="{{ url_for(endpoint, q=query.q, offset=0) }}">« Previous</a> {% else %} - <a href="{{ url_for(endpoint, q=found.query.q, offset=found.offset - found.limit) }}">« Previous</a> + <a href="{{ url_for(endpoint, q=query.q, offset=found.offset - found.limit) }}">« Previous</a> {% endif %} {% else %} <span style="color:gray">« Previous</span> @@ -294,7 +294,7 @@ yellow found.count_returned }} out of {{ found.count_found }} results</i> {% if found.offset + found.limit < found.count_found and found.offset + found.limit < found.deep_page_limit %} - <a href="{{ url_for(endpoint, q=found.query.q, offset=found.offset + found.limit) }}">Next »</a> + <a href="{{ url_for(endpoint, q=query.q, offset=found.offset + found.limit) }}">Next »</a> {% else %} <span style="color:gray">Next »</span> {% 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 @@ <form class="" role="search" action="/release/search" method="get"> <div class="ui form"> <div class="ui action input huge fluid"> - <input type="text" placeholder="Query..." name="q" value="{% if query %}{{ query }}{% endif %}" aria-label="search release metadata"> + <input type="text" placeholder="Query..." name="q" value="{% if query.q %}{{ query.q }}{% endif %}" aria-label="search release metadata"> <button class="ui primary button">Search</button> </div> <div class="ui checkbox" style="float: right; margin: 1em;"> <input type="checkbox" name="fulltext_only" id="fulltext_only" value="true" {% if fulltext_only %}checked{% endif %}> <label for="fulltext_only">Fulltext Available Only</label> </div> - <br>Can also lookup by <b><a href="/release/lookup">identifier</a></b> or search for <b><a href="/container/search?q={{ query or "" }}">containers</a></b> (eg, journals). + <br>Can also lookup by <b><a href="/release/lookup">identifier</a></b> or search for <b><a href="/container/search?q={{ query.q or "" }}">containers</a></b> (eg, journals). </div> </form> </div> @@ -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 %} <div class="ui divider"></div> <div style="text-align: center"> - {{ entity_macros.bottom_results(found, endpoint='release_search') }} + {{ entity_macros.bottom_results(query, found, endpoint='release_search') }} </div> {% endif %} {% else %} - Raw query was: <i>{{ found.query.q }}</i> + Raw query was: <i>{{ query.q }}</i> <div class="ui centered stackable grid" style="padding-top: 15%;"> <div class="row"> @@ -63,9 +63,9 @@ <h2>No results found!</h2> <p>You could try elsewhere:</p> <ul> - <li>Search <a href="https://dissem.in/search?q={{ found.query.q | urlencode }}">dissem.in</a></li> - <li>Search <a href="https://www.base-search.net/Search/Results?lookfor={{ found.query.q | urlencode }}">BASE</a></li> - <li>Search <a href="https://scholar.google.com/scholar?q={{ found.query.q | urlencode }}">Google Scholar</a></li> + <li>Search <a href="https://dissem.in/search?q={{ query.q | urlencode }}">dissem.in</a></li> + <li>Search <a href="https://www.base-search.net/Search/Results?lookfor={{ query.q | urlencode }}">BASE</a></li> + <li>Search <a href="https://scholar.google.com/scholar?q={{ query.q | urlencode }}">Google Scholar</a></li> </ul> </div> </div> |