aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2021-07-23 11:56:42 -0700
committerBryan Newbold <bnewbold@robocracy.org>2021-07-23 11:56:42 -0700
commit7489ef7a979574effa74f1f17cebb81eefb1b71a (patch)
tree252bc76358fb769aa52305d45e449c547a740f33 /python/fatcat_web
parent0d17bad63b2d92220b8ddaeb9b5733b2b09f57a0 (diff)
downloadfatcat-7489ef7a979574effa74f1f17cebb81eefb1b71a.tar.gz
fatcat-7489ef7a979574effa74f1f17cebb81eefb1b71a.zip
refs: refactor web paths; enrich refs as generic; remove old refs link
Diffstat (limited to 'python/fatcat_web')
-rw-r--r--python/fatcat_web/ref_routes.py16
-rw-r--r--python/fatcat_web/templates/entity_base.html5
-rw-r--r--python/fatcat_web/templates/release_view_fuzzy_refs.html12
3 files changed, 17 insertions, 16 deletions
diff --git a/python/fatcat_web/ref_routes.py b/python/fatcat_web/ref_routes.py
index e08aaf15..e24b4ac6 100644
--- a/python/fatcat_web/ref_routes.py
+++ b/python/fatcat_web/ref_routes.py
@@ -11,14 +11,14 @@ from fatcat_openapi_client.rest import ApiException
from fuzzycat.grobid_unstructured import grobid_api_process_citation, transform_grobid_ref_xml, grobid_ref_to_release
from fuzzycat.simple import close_fuzzy_biblio_matches, close_fuzzy_release_matches
-from fatcat_tools.references import enrich_inbound_refs_fatcat, enrich_outbound_refs_fatcat, get_inbound_refs, get_outbound_refs
+from fatcat_tools.references import enrich_inbound_refs, enrich_outbound_refs, get_inbound_refs, get_outbound_refs
from fatcat_tools.transforms.access import release_access_options
from fatcat_web import app, api, auth_api
from fatcat_web.forms import *
from fatcat_web.entity_helpers import *
-@app.route('/release/<string(length=26):ident>/inbound-refs', methods=['GET'])
+@app.route('/release/<string(length=26):ident>/refs/in', methods=['GET'])
def release_view_refs_inbound(ident):
release = generic_get_entity("release", ident)
@@ -27,11 +27,12 @@ def release_view_refs_inbound(ident):
offset = max(0, int(offset)) if offset.isnumeric() else 0
hits = get_inbound_refs(release_ident=ident, es_client=app.es_client, offset=offset, limit=30)
- enriched_refs = enrich_inbound_refs_fatcat(hits.result_refs, fatcat_api_client=api, expand="container,files,webcaptures")
+ enriched_refs = enrich_inbound_refs(hits.result_refs, fatcat_api_client=api, expand="container,files,webcaptures")
- return render_template('release_view_fuzzy_refs.html', direction="inbound", entity=release, hits=hits, enriched_refs=enriched_refs), 200
+ return render_template('release_view_fuzzy_refs.html', direction="in", entity=release, hits=hits, enriched_refs=enriched_refs), 200
-@app.route('/release/<string(length=26):ident>/outbound-refs', methods=['GET'])
+
+@app.route('/release/<string(length=26):ident>/refs/out', methods=['GET'])
def release_view_refs_outbound(ident):
release = generic_get_entity("release", ident)
@@ -40,9 +41,10 @@ def release_view_refs_outbound(ident):
offset = max(0, int(offset)) if offset.isnumeric() else 0
hits = get_outbound_refs(release_ident=ident, es_client=app.es_client, offset=offset, limit=30)
- enriched_refs = enrich_outbound_refs_fatcat(hits.result_refs, fatcat_api_client=api, expand="container,files,webcaptures")
+ enriched_refs = enrich_outbound_refs(hits.result_refs, fatcat_api_client=api, expand="container,files,webcaptures")
+
+ return render_template('release_view_fuzzy_refs.html', direction="out", entity=release, hits=hits, enriched_refs=enriched_refs), 200
- return render_template('release_view_fuzzy_refs.html', direction="outbound", entity=release, hits=hits, enriched_refs=enriched_refs), 200
@app.route('/reference/match', methods=['GET', 'POST'])
def reference_match():
diff --git a/python/fatcat_web/templates/entity_base.html b/python/fatcat_web/templates/entity_base.html
index c23dbef2..78a151a0 100644
--- a/python/fatcat_web/templates/entity_base.html
+++ b/python/fatcat_web/templates/entity_base.html
@@ -85,10 +85,9 @@
{{ entity_tab("coverage", "Coverage", "/coverage") }}
{% elif entity_type == "release" and entity.state != 'deleted' %}
{{ entity_tab("contribs", "Authors", "/contribs", entity._authors|count ) }}
- {{ entity_tab("references", "References", "/references", entity.refs|count) }}
{% if entity.state == 'active' %}
- {{ entity_tab("inbound-refs", "Inbound", "/inbound-refs") }}
- {{ entity_tab("outbound-refs", "Outbound", "/outbound-refs") }}
+ {{ entity_tab("refs-out", "References", "/refs/out") }}
+ {{ entity_tab("refs-in", "Cited By", "/refs/in") }}
{% endif %}
{% endif %}
{{ entity_tab("metadata", "Metadata", "/metadata") }}
diff --git a/python/fatcat_web/templates/release_view_fuzzy_refs.html b/python/fatcat_web/templates/release_view_fuzzy_refs.html
index 7b286fd3..43860a31 100644
--- a/python/fatcat_web/templates/release_view_fuzzy_refs.html
+++ b/python/fatcat_web/templates/release_view_fuzzy_refs.html
@@ -1,5 +1,5 @@
{% set release = entity %}
-{% set entity_view = "{{ direction }}-refs" %}
+{% set entity_view = "refs-" + direction %}
{% set entity_type = "release" %}
{% import "entity_macros.html" as entity_macros %}
{% extends "entity_base.html" %}
@@ -17,10 +17,10 @@
{% block entity_main %}
-{% if direction == "inbound" %}
- <h3>Referenced By</h3>
- <i>Citations to this release by other works.</i>
-{% elif direction == "outbound" %}
+{% if direction == "in" %}
+ <h3>Cited By</h3>
+ <i>References to this release by other works.</i>
+{% 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 %}
@@ -36,7 +36,7 @@
{% set release = row.release %}
<tr><td class="collapsing left aligned top aligned">
{# TODO: ref_locator? #}
- {% if direction == "outbound" %}
+ {% if direction == "out" %}
{% if row.ref.ref_key %}
<code>[{{ row.ref.ref_key }}]</code><br>
{% endif %}