diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2021-07-27 18:48:14 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2021-07-27 18:48:14 -0700 |
commit | fa2ba60834cf3cb3edea05af3c1830e6fc0d5bcc (patch) | |
tree | 2ae1f69f218c2caf05bce736edc3c3b29665ce27 | |
parent | db88516724e3e0afc4f1c88356c0ee7f39fbb38c (diff) | |
download | fatcat-fa2ba60834cf3cb3edea05af3c1830e6fc0d5bcc.tar.gz fatcat-fa2ba60834cf3cb3edea05af3c1830e6fc0d5bcc.zip |
refs: several small improvements to web UI
5 files changed, 71 insertions, 35 deletions
diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html index 37bb2d90..562b99d3 100644 --- a/python/fatcat_web/templates/entity_macros.html +++ b/python/fatcat_web/templates/entity_macros.html @@ -391,7 +391,7 @@ yellow {# this is useful for things like showing lists of releases in tables #} {% macro release_summary(release) %} <b><a href="/release/{{ release.ident }}">{{ release.title }}</a></b> - {% if release.release_type not in ["article-journal", "conference-paper"] %} + {% if release.release_type not in ["article-journal", "paper-conference"] %} <b>[{{ release.release_type or "unknown-type" }}]</b> {% endif %} {% if release.contribs %}<br>{% endif %} @@ -405,7 +405,14 @@ yellow {% endfor %} {% if release.contribs | length > 8 %} <i>(+ more)</i> {%endif %} {% if release.release_year or release.container or (release.extra and release.extra.container_name) %}<br>{% endif %} - {% if release.release_year %}{{ release.release_year }} {% endif %} + {% if release.release_year %} + {% if release.release_date %} + <span title="{{ release.release_date }}">{{ release.release_year }}</span> + {% else %} + {{ release.release_year }} + {% endif %} + + {% endif %} {% if release.container %} <a href="/container/{{ release.container.ident }}" style="color: black;"><i>{{ release.container.name }}</i></a> {% elif release.extra and release.extra.container_name %} diff --git a/python/fatcat_web/templates/openlibrary_view_fuzzy_refs.html b/python/fatcat_web/templates/openlibrary_view_fuzzy_refs.html index 161a7b50..21bf76f2 100644 --- a/python/fatcat_web/templates/openlibrary_view_fuzzy_refs.html +++ b/python/fatcat_web/templates/openlibrary_view_fuzzy_refs.html @@ -19,11 +19,7 @@ <i>Refernces from this book to other entities.</i> {% endif %} -{% if hits.result_refs %} - {{ refs_macros.refs_table(hits, direction) }} -{% else %} - <br><br><p><b>None found</b> -{% endif %} +{{ refs_macros.refs_table(hits, direction) }} {% endblock %} diff --git a/python/fatcat_web/templates/refs_macros.html b/python/fatcat_web/templates/refs_macros.html index ba4d18ad..3db47064 100644 --- a/python/fatcat_web/templates/refs_macros.html +++ b/python/fatcat_web/templates/refs_macros.html @@ -1,37 +1,67 @@ {% import "entity_macros.html" as entity_macros %} -{% macro pagination_row(hits, direction) %} - - {% if hits.offset %} +{% macro pagination_row(hits, with_links=False) %} + {% if with_links and hits.offset %} <a href="?offset={{ hits.offset - hits.limit }}">« prev</a> {% endif %} - Showing {{ hits.offset + 1 }} - {{ hits.offset + hits.count_returned }} of {{ hits.count_total}} references (in {{ hits.query_wall_time_ms }}ms) - {% if hits.count_total != hits.count_returned and hits.offset + hits.limit < hits.count_total %} + {% if hits.count_returned == 0 %} + Showing 0 references + {% else %} + Showing {{ hits.offset + 1 }} - {{ hits.offset + hits.count_returned }} of {{ hits.count_total}} references + {% endif %} + {% if with_links and hits.count_total != hits.count_returned and hits.offset + hits.limit < hits.count_total %} <a href="?offset={{ hits.offset + hits.limit }}">next »</a> {% endif %} {% endmacro %} {% macro refs_table(hits, direction) %} +<div class="ui warning message"> + <div class="header"> + Fuzzy reference matching is a work in progress! + </div> + Read more about quality, completeness, and caveats <a href="https://guide.fatcat.wiki/#TODO">in the fatcat guide</a>. +</div> <table class="ui table"> <thead> <tr><th colspan="3"> - {{ pagination_row(hits) }} + {{ pagination_row(hits, with_links=False) }} + (in {{ hits.query_wall_time_ms }}ms) </thead> <tbody> +{% if hits.count_total == 0 %} + <tr><td class="ui placeholder segment"> + <div class="ui icon header"> + <i class="unlink icon"></i> + No References Found + </div> +{% endif %} {% for row in hits.result_refs %} {% set release = row.release %} - <tr><td class="collapsing left aligned top aligned"> + <tr> + <td class="collapsing left aligned top aligned"> {# TODO: ref_locator? #} {% if direction == "out" %} {% if row.ref.ref_key %} <code title="index={{ row.ref.ref_index }}">[{{ row.ref.ref_key }}]</code><br> {% endif %} {% endif %} - <b>{{ row.ref.match_status }}</b><br> - {% if row.ref.match_provenance %} - via {{ row.ref.match_provenance }} + + {% if row.ref.match_status == "exact" %} + {% set match_icon = "linkify" %} + {% elif row.ref.match_status == "unmatched" %} + {% set match_icon = "question circle outline" %} + {% else %} + {% set match_icon = "magic" %} {% endif %} + <i class="{{ match_icon }} icon" title="{{ row.ref.match_status }} {{ row.ref.match_reason }}"></i><br> + {% if row.ref.match_provenance and row.ref.match_provenance == "fatcat-pubmed" %} + {# this is a common case and making the column render wide #} + via pubmed + {% elif row.ref.match_provenance %} + via {{ row.ref.match_provenance }}<br> + {% endif %} + <td class=""> {% if release %} {{ entity_macros.release_summary(release) }} @@ -62,7 +92,7 @@ <td class="center aligned"> {% if row.access %} {% for access in row.access %} - <a href="{{ access.access_url}}" class="ui tiny green active button"> + <a href="{{ access.access_url}}" class="ui green label" style="background-color: #2ca048;"> {%- if access.access_type.name == "wayback" %} web.archive.org {%- elif access.access_type.name == "ia_file" -%} @@ -83,18 +113,23 @@ <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/> <input type="hidden" name="raw_citation" value="{{ row.ref.target_unstructured }}"> <button class="ui tiny primary submit button" type="submit" name="submit_type" value="parse"> - parse + re-parse </button> </form> {% endif %} {% endfor %} </tbody> -{% if hits.count_total != hits.count_returned %} - <tfoot> - <tr><th colspan="3"> - {{ pagination_row(hits) }} - </tfoot> -{% endif %} +<tfoot> + <tr><th colspan="3"> + <div style="float: right;"> + <a href="{{ request.path }}.json?{{ request.query_string.decode() }}">JSON</a> + </div> + {% if hits.count_returned != hits.count_total %} + <center> + {{ pagination_row(hits, with_links=True) }} + </center> + {% endif %} +</tfoot> </table> {% endmacro %} diff --git a/python/fatcat_web/templates/release_view_fuzzy_refs.html b/python/fatcat_web/templates/release_view_fuzzy_refs.html index ffca0bc9..8cba4f4e 100644 --- a/python/fatcat_web/templates/release_view_fuzzy_refs.html +++ b/python/fatcat_web/templates/release_view_fuzzy_refs.html @@ -13,13 +13,15 @@ {% elif direction == "out" %} <h3>References</h3> <i>NOTE: currently batch computed and may include additional references sources, or be missing recent changes, compared to entity reference list.</i> -{% endif %} -{% if hits.result_refs %} - {{ refs_macros.refs_table(hits, direction) }} -{% else %} - <br><br><p><b>None found</b> + {% if hits.count_total == 0 and release.refs %} + <div class="ui positive message"> + <p>No <i>fuzzy</i> references found, but there are <a href="/release/{{ release.ident }}/references">{{ release.refs|count }} legacy references</a> + </div> + {% endif %} {% endif %} +{{ refs_macros.refs_table(hits, direction) }} + {% endblock %} diff --git a/python/fatcat_web/templates/wikipedia_view_fuzzy_refs.html b/python/fatcat_web/templates/wikipedia_view_fuzzy_refs.html index 5b53d692..3e1453c1 100644 --- a/python/fatcat_web/templates/wikipedia_view_fuzzy_refs.html +++ b/python/fatcat_web/templates/wikipedia_view_fuzzy_refs.html @@ -17,11 +17,7 @@ <i>Refernces from wikipedia article to other entities.</i> {% endif %} -{% if hits.result_refs %} - {{ refs_macros.refs_table(hits, direction) }} -{% else %} - <br><br><p><b>None found</b> -{% endif %} +{{ refs_macros.refs_table(hits, direction) }} {% endblock %} |