diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2021-07-23 17:48:35 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2021-07-23 17:48:35 -0700 |
commit | 1125eddcac0c9b2673dbfb1f62bb0fa9b1ab4054 (patch) | |
tree | 66ce18702f6396fdaaf25966dd5cc98c5f1f6fe0 /python/fatcat_web/templates/release_view_fuzzy_refs.html | |
parent | f58d4c2605bb028fd8844b25d345b524a5d47a87 (diff) | |
download | fatcat-1125eddcac0c9b2673dbfb1f62bb0fa9b1ab4054.tar.gz fatcat-1125eddcac0c9b2673dbfb1f62bb0fa9b1ab4054.zip |
web: refactor refs table into separate refs_macros file
Diffstat (limited to 'python/fatcat_web/templates/release_view_fuzzy_refs.html')
-rw-r--r-- | python/fatcat_web/templates/release_view_fuzzy_refs.html | 74 |
1 files changed, 3 insertions, 71 deletions
diff --git a/python/fatcat_web/templates/release_view_fuzzy_refs.html b/python/fatcat_web/templates/release_view_fuzzy_refs.html index 43860a31..ffca0bc9 100644 --- a/python/fatcat_web/templates/release_view_fuzzy_refs.html +++ b/python/fatcat_web/templates/release_view_fuzzy_refs.html @@ -1,19 +1,9 @@ {% set release = entity %} {% set entity_view = "refs-" + direction %} {% set entity_type = "release" %} -{% import "entity_macros.html" as entity_macros %} +{% import "refs_macros.html" as refs_macros %} {% extends "entity_base.html" %} -{% macro pagination_row(hits) %} - - {% if 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 %} - <a href="?offset={{ hits.offset + hits.limit }}">next »</a> - {% endif %} -{% endmacro %} {% block entity_main %} @@ -25,66 +15,8 @@ <i>NOTE: currently batch computed and may include additional references sources, or be missing recent changes, compared to entity reference list.</i> {% endif %} -{% if enriched_refs %} -<table class="ui table"> -<thead> - <tr><th colspan="3"> - {{ pagination_row(hits) }} -</thead> -<tbody> -{% for row in enriched_refs %} - {% set release = row.release %} - <tr><td class="collapsing left aligned top aligned"> - {# TODO: ref_locator? #} - {% if direction == "out" %} - {% if row.ref.ref_key %} - <code>[{{ 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 }} - {% endif %} - <td class=""> - {% if release %} - {{ entity_macros.release_summary(release) }} - {% elif row.ref.target_unstructured %} - <code>{{ row.ref.target_unstructured }}</code> - {% else %} - <i>blank</i> - {% endif %} - <td class="center aligned"> - {% if row.access %} - {% for access in row.access %} - <a href="{{ access.access_url}}" class="ui tiny green active button">{{ access.access_type.name }}</a><br> - {% endfor %} - {% elif row.ref.target_unstructured %} - <form class="ui form" id="reference_match" method="POST" action="/reference/match"> - <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 - </button> - </form> - {% endif %} - - {# TODO: include these as access options instead #} - {% if row.ref.target_openlibrary_work %} - <a href="https://openlibrary.org/work/{{ row.ref.target_openlibrary_work }}" class="ui tiny green active button">openlibrary.org</a> - {% endif %} - {% if row.ref.target_url %} - <a href="{{ ref.target_url | safe }}" class="ui tiny green active button">web</a> - <br><a href="https://web.archive.org/web/*/{{ row.ref.target_url | safe }}" class="ui tiny green active button">wayback (?)</a> - {% endif %} -{% endfor %} -</tbody> -{% if hits.count_total != hits.count_returned %} - <tfoot> - <tr><th colspan="3"> - {{ pagination_row(hits) }} - </tfoot> -{% endif %} -</table> +{% if hits.result_refs %} + {{ refs_macros.refs_table(hits, direction) }} {% else %} <br><br><p><b>None found</b> {% endif %} |