diff options
author | bnewbold <bnewbold@archive.org> | 2020-04-27 18:44:54 +0000 |
---|---|---|
committer | bnewbold <bnewbold@archive.org> | 2020-04-27 18:44:54 +0000 |
commit | 05878da547dc959a2ae70fbb8d55f7a59e66a3f4 (patch) | |
tree | cc3fd27e8c545ba048ac4dcf0fa549a1cbfecf1c /python/fatcat_web/templates | |
parent | 9b4d87a4e20e97fa40c0a4ff37d459628f1978b2 (diff) | |
parent | 0cb1fd066e4bbefce6b9aba4ac29916c37ffd738 (diff) | |
download | fatcat-05878da547dc959a2ae70fbb8d55f7a59e66a3f4.tar.gz fatcat-05878da547dc959a2ae70fbb8d55f7a59e66a3f4.zip |
Merge branch 'bnewbold-search-tweaks' into 'master'
tweaks to search result pages
See merge request webgroup/fatcat!50
Diffstat (limited to 'python/fatcat_web/templates')
-rw-r--r-- | python/fatcat_web/templates/container_search.html | 89 | ||||
-rw-r--r-- | python/fatcat_web/templates/entity_macros.html | 76 | ||||
-rw-r--r-- | python/fatcat_web/templates/release_search.html | 59 |
3 files changed, 132 insertions, 92 deletions
diff --git a/python/fatcat_web/templates/container_search.html b/python/fatcat_web/templates/container_search.html index 1a089643..1a804595 100644 --- a/python/fatcat_web/templates/container_search.html +++ b/python/fatcat_web/templates/container_search.html @@ -9,6 +9,7 @@ {% endif %} {% endblock %} + {% block fullmain %} <div class="ui vertical stripe segment" style="background-color: #EEE; padding-top: 4.5em;"> @@ -17,8 +18,7 @@ <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 %}{{ query }}{% 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>. </div> @@ -30,49 +30,56 @@ <br> {% if found %} -{% if found.results %} - {{ entity_macros.top_results(found) }} + {% if found.results %} -{% for entity in found.results %} -<div> - <h4 style="margin-top: 1em; margin-bottom: 4px; font-size: 1.1em;"> - <a href="/container/{{ entity.ident }}" style="color: #2224c7;">{{ entity['name'] }}</a> - {% if entity.is_oa %}<i class="icon unlock orange small"></i>{% endif %} - </h4> - {% if entity.publisher %} - <h5 style="margin-top: 4px; margin-bottom: 4px; font-size: 1em;">{{ entity.publisher }}</h5> - {% endif %} - {% if entity.issnl %} - <a href="https://portal.issn.org/resource/ISSN/{{entity.issnl }}" style="color: green;">issn:{{ entity.issnl }}</a> - {% endif %} - {% if entity.container_type %} - {{ entity.container_type }} - {% endif %} -</div> -{% endfor %} -{% if found.results|length > 8 %} - <div class="ui divider"></div> - <div style="text-align: center"> - {{ entity_macros.bottom_results(found, endpoint='container_search')}} - </div> -{% endif %} -{% else %} + {{ entity_macros.top_results(found) }} -Raw query was: <i>{{ found.query.q }}</i> + {% for entity in found.results %} + <div> + <h4 style="margin-top: 1em; margin-bottom: 4px; font-size: 1.1em;"> + <a href="/container/{{ entity.ident }}" style="color: #2224c7;">{{ entity['name'] }}</a> + {% if entity.is_oa %}<i class="icon unlock orange small"></i>{% endif %} + </h4> + {% if entity.publisher %} + <h5 style="margin-top: 4px; margin-bottom: 4px; font-size: 1em;">{{ entity.publisher }}</h5> + {% endif %} + {% if entity.issnl %} + <a href="https://portal.issn.org/resource/ISSN/{{entity.issnl }}" style="color: green;">issn:{{ entity.issnl }}</a> + {% endif %} + {% if entity.container_type %} + {{ entity.container_type }} + {% endif %} + </div> + {% endfor %} + + {% if found.results|length > 8 %} + <div class="ui divider"></div> + <div style="text-align: center"> + {{ entity_macros.bottom_results(found, endpoint='container_search') }} + </div> + {% endif %} -<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"> + {% else %} + + Raw query was: <i>{{ found.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://scholar.google.com/scholar?q={{ found.query.q | urlencode }}">Google Scholar</a></li> + </ul> + </div> + </div> </div> - <div class="six wide column"> - <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> - </ul> -</div> -{% endif %} + + {% endif %} + {% endif %} </div> diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html index 3308a3d5..c22eb106 100644 --- a/python/fatcat_web/templates/entity_macros.html +++ b/python/fatcat_web/templates/entity_macros.html @@ -158,17 +158,35 @@ [blank] {% endif %} </a> + + {# release type suffix #} + {% if paper.release_type in ("article-journal", "paper-conference") %} + {# pass #} + {% elif paper.release_type in ("book", "chapter", "dataset") %} + <b style="text-transform: uppercase;">[{{ paper.release_type }}]</b> + {% elif not paper.release_type %} + <b style="text-transform: uppercase; color: black;">[unknown-media]</b> + {% else %} + <b style="text-transform: uppercase;">[{{ paper.release_type }}]</b> + {% endif %} + + {# show original_title #} + {% if paper.original_title and paper.title != paper.original_title %} + <br> + <i style="font-weight: normal;"> + {{ paper.original_title[:512] }} {% if paper.original_title|length > 512 %}...{% endif %} + </i> + {% endif %} + </h4> + {% if paper.best_pdf_url %} <div style="float: right; padding: 4px;"> <a href="{{ paper.best_pdf_url }}" class="ui violet tag label"><i class="file icon"></i>fulltext</a> </div> {% endif %} - {# - <h5 style="margin-top: 4px; margin-bottom: 4px; font-size: 1em;">{{ ", ".join(paper.contrib_names[:12]) }} - {% if paper.contrib_names|length > 12 %}<i>(+{{ paper.contrib_names|length - 12 }} others)</i>{% endif %} - </h5> - #} + + {# ### AUTHOR ROW #} {% if paper.contrib_names %} <div style="margin-top: 0px; margin-bottom: 0px; font-size: 1em;"> <b> @@ -177,25 +195,14 @@ </b> </div> {% endif %} + + + {# ### JOURNAL ROW #} {% if paper.release_year %} {{ paper.release_year }} {% endif %} - {% if paper.release_type %} - {% if paper.release_type in ("article-journal", "paper-conference") %} - <span class="ui black basic label small">{{ paper.release_type }}</span> - {% elif paper.release_type in ("book") %} - <span class="ui brown basic label small">{{ paper.release_type }}</span> - {% else %} - <span class="ui grey basic label small">{{ paper.release_type }}</span> - {% endif %} - {% endif %} - {% if paper.withdrawn_status %} - <span class="ui red label small">{{ paper.withdrawn_status }}</span> - {% endif %} - {% if paper.release_stage and paper.release_stage != "published" %} - <span class="ui pink basic label small">{{ paper.release_stage }}</span> - {% elif not paper.release_stage %} - <span class="ui red basic label small">unknown</span> + {% if paper.release_year and paper.container_name %} + | {% endif %} {% if paper.container_name %} {% if paper.container_id %} @@ -205,8 +212,22 @@ {% endif %} {% if paper.container_is_oa %}<i class="icon unlock orange small"></i>{% endif %} {% endif %} - {% if paper.doi or paper.pmid or paper.arxiv_id or paper.jstor_id %} - <br> + {% if paper.withdrawn_status %} + <b style="color: red;"><code>[{{ paper.withdrawn_status }}]</code></b> + {% endif %} + {% if paper.release_stage == "accepted" %} + <b style="color: darkmagenta;"><code>[{{ paper.release_stage }} manuscript]</code></b> + {% elif paper.release_stage == "submitted" %} + <b style="color: magenta;"><code>[pre-print]</code></b> + {% elif paper.release_stage and paper.release_stage != "published" %} + <b style="color: magenta;"><code>[{{ paper.release_stage }}]</code></b> + {% elif not paper.release_stage %} + <b style="color: red;"><code>[unpublished?]</code></b> + {% endif %} + + {# ### IDENTIFIERS #} + {% if paper.doi or paper.pmid or paper.arxiv_id or paper.jstor_id or paper.pmcid %} + <br> {% endif %} {% if paper.doi %} <a href="https://doi.org/{{paper.doi }}" style="color: green;">doi:{{ paper.doi }}</a> @@ -214,13 +235,18 @@ {% if paper.pmid %} <a href="https://www.ncbi.nlm.nih.gov/pubmed/{{paper.pmid }}" style="color: green;">pmid:{{ paper.pmid }}</a> {% endif %} + {% if paper.pmcid %} + <a href="https://pubmed.ncbi.nlm.nih.gov/{{paper.pmcid }}/" style="color: green;">pmcid:{{ paper.pmcid }}</a> + {% endif %} {% if paper.arxiv_id %} <a href="https://arxiv.org/abs/{{paper.arxiv_id }}" style="color: green;">arXiv:{{ paper.arxiv_id }}</a> {% endif %} - {% if False %} {# XXX: elastic release work grouping searches #} + +{# WIP: elastic release work grouping searches <br> <a href="/work/{{ paper.work_id }}"><i class="sitemap icon"></i> and 5 other versions of the same work!</a> - {% endif %} +#} + </div> {% endmacro %} diff --git a/python/fatcat_web/templates/release_search.html b/python/fatcat_web/templates/release_search.html index 47f4330a..70c46c0a 100644 --- a/python/fatcat_web/templates/release_search.html +++ b/python/fatcat_web/templates/release_search.html @@ -35,37 +35,44 @@ <br> {% if found %} -{% if found.results %} + {% if found.results %} + {{ entity_macros.top_results(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"> - {{ entity_macros.bottom_results(found)}} - </div> -{% endif %} -{% else %} + {% 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"> + {{ entity_macros.bottom_results(found, endpoint='release_search') }} + </div> + {% endif %} + + {% else %} -Raw query was: <i>{{ found.query.q }}</i> + Raw query was: <i>{{ found.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 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={{ 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> + </ul> + </div> + </div> </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={{ 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> - </ul> -</div> -{% endif %} + + {% endif %} + {% endif %} </div> |