diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2022-02-09 00:24:46 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2022-02-09 17:35:50 -0800 |
commit | 5bc77c47eed20676cd3db162c9675311f77c6cf9 (patch) | |
tree | 7769bc192aa1a51d893675e06629018cb0b09c7a /python/fatcat_web/templates | |
parent | 9ab3cd54aa039393d294cdc85871353651c35576 (diff) | |
download | fatcat-5bc77c47eed20676cd3db162c9675311f77c6cf9.tar.gz fatcat-5bc77c47eed20676cd3db162c9675311f77c6cf9.zip |
web: move search-in-container to dedicated tab
Diffstat (limited to 'python/fatcat_web/templates')
-rw-r--r-- | python/fatcat_web/templates/container_view.html | 5 | ||||
-rw-r--r-- | python/fatcat_web/templates/container_view_search.html | 70 | ||||
-rw-r--r-- | python/fatcat_web/templates/entity_base.html | 1 |
3 files changed, 73 insertions, 3 deletions
diff --git a/python/fatcat_web/templates/container_view.html b/python/fatcat_web/templates/container_view.html index d88b44ab..abb31e06 100644 --- a/python/fatcat_web/templates/container_view.html +++ b/python/fatcat_web/templates/container_view.html @@ -24,12 +24,11 @@ {% endif %} {% if container.state == "active" %} -<h3>Search Releases from this Container</h3> -<form class="" role="search" action="/release/search" method="get"> +<h3>Search Content</h3> +<form class="" role="search" action="/container/{{ container.ident }}/search" method="get"> <div class="ui form"> <div class="ui action input large fluid"> <input type="text" placeholder="Search Articles..." name="q" aria-label="search release metadata"> - <input type="hidden" name="container_id" value="{{ container.ident }}"> <button class="ui button">Search</button> </div> </div> diff --git a/python/fatcat_web/templates/container_view_search.html b/python/fatcat_web/templates/container_view_search.html new file mode 100644 index 00000000..289c8dad --- /dev/null +++ b/python/fatcat_web/templates/container_view_search.html @@ -0,0 +1,70 @@ +{% set container = entity %} +{% set entity_view = "search" %} +{% set entity_type = "container" %} +{% import "entity_macros.html" as entity_macros %} +{% import "search_macros.html" as search_macros %} +{% extends "entity_base.html" %} + +{% block entity_main %} +<div class="ui container text"> + +<div class="ui message"> +<h3>Search inside Container</h3> +<form class="" role="search" action="/container/{{ entity.ident }}/search" method="get"> + <div class="ui form"> + <div class="ui action input huge fluid"> + <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> + <br>Can also search <b><a href="/release/search?q={{ query.q or "" }}">all releases</a></b>. + </div> +</form> +</div> + +<br> +{% if found %} + {% if found.results %} + + {{ search_macros.top_results(query, found) }} + + {% for paper in found.results %} + {{ entity_macros.release_search_result_row(paper) }} + {% endfor %} + + {% if found.results|length > 8 %} + <div class="ui divider"></div> + <div style="text-align: center"> + {{ search_macros.bottom_results(query, found, endpoint='release_search') }} + </div> + {% endif %} + + {% else %} + + Raw query was: <i>{{ query.q }}</i> + + <div class="ui centered stackable grid" style="padding-top: 15%;"> + <div class="row"> + <div class="four wide column"> + <img src="/static/paper_man_confused.gif" alt="confused paper man"> + </div> + <div class="six wide column"> + <h2>No results found!</h2> + <p>You could try elsewhere:</p> + <ul> + <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> + </div> + + {% endif %} + +{% elif es_error %} + {{ search_macros.es_error_msg(es_error) }} +{% endif %} + +</div> +{% endblock %} + diff --git a/python/fatcat_web/templates/entity_base.html b/python/fatcat_web/templates/entity_base.html index c3d6096b..2782edd5 100644 --- a/python/fatcat_web/templates/entity_base.html +++ b/python/fatcat_web/templates/entity_base.html @@ -83,6 +83,7 @@ {{ entity_tab("overview", "Overview", "") }} {% if entity_type == "container" and entity.state == 'active' and not editgroup %} {{ entity_tab("coverage", "Preservation", "/coverage") }} + {{ entity_tab("search", "Search", "/search") }} {% elif entity_type == "release" and entity.state != 'deleted' %} {{ entity_tab("contribs", "Authors", "/contribs", entity._authors|count ) }} {% if entity.state == 'active' %} |