summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/fatcat_web/routes.py13
-rw-r--r--python/fatcat_web/templates/container_view.html44
-rw-r--r--python/fatcat_web/templates/release_view.html42
3 files changed, 56 insertions, 43 deletions
diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py
index 926d5340..21f81eae 100644
--- a/python/fatcat_web/routes.py
+++ b/python/fatcat_web/routes.py
@@ -8,6 +8,7 @@ from fatcat_web import app, api, auth_api, priv_api
from fatcat_web.auth import handle_token_login, handle_logout, load_user, handle_ia_xauth
from fatcat_client.rest import ApiException
from fatcat_web.search import do_search
+from fatcat_tools.transforms import *
### Views ###################################################################
@@ -86,6 +87,7 @@ def container_view(ident):
return redirect('/container/{}'.format(entity.redirect))
if entity.state == "deleted":
return render_template('deleted_entity.html', entity=entity)
+ entity.es = container_to_elasticsearch(entity, force_bool=False)
return render_template('container_view.html', container=entity)
@app.route('/creator/<ident>/history', methods=['GET'])
@@ -236,17 +238,18 @@ def release_edit_view(ident):
@app.route('/release/<ident>', methods=['GET'])
def release_view(ident):
try:
- entity = api.get_release(ident)
- files = api.get_release_files(ident)
- container = None
- if entity.container_id is not None:
- container = api.get_container(entity.container_id)
+ entity = api.get_release(ident, expand="container,files,filesets,webcaptures")
+ files = entity.files
+ container = entity.container
except ApiException as ae:
abort(ae.status)
if entity.state == "redirect":
return redirect('/release/{}'.format(entity.redirect))
if entity.state == "deleted":
return render_template('deleted_entity.html', entity=entity)
+ if entity.container:
+ entity.container.es = container_to_elasticsearch(entity.container, force_bool=False)
+ entity.es = release_to_elasticsearch(entity, force_bool=False)
authors = [c for c in entity.contribs if c.role in ('author', None)]
authors = sorted(authors, key=lambda c: c.index)
for fe in files:
diff --git a/python/fatcat_web/templates/container_view.html b/python/fatcat_web/templates/container_view.html
index 4a175a5d..ffe01185 100644
--- a/python/fatcat_web/templates/container_view.html
+++ b/python/fatcat_web/templates/container_view.html
@@ -15,14 +15,11 @@
<p><b>Publisher:</b>
{% if container.publisher != None %}{{ container.publisher }}{% else %}<i>Unknown</i>{% endif %}
-{% if (container.extra != None) and (container.extra['url'] != None) and (container.extra['url']|length > 0) %}
-<br><b>Homepage:</b> <a href="{{ container.extra['url'] }}">&nbsp;<code>{{ container.extra['url'] }}</code></a>
-{% endif %}
-{% if container.wikidata_qid != None %}
-<br><b>Wikidata Entity:</b> <a href="https://www.wikidata.org/wiki/{{ container.wikidata_qid }}">&nbsp;<code>{{ container.wikidata_qid }}</code></a>
+{% if (container.extra != None) and (container.extra['urls'] != None) and (container.extra['urls']|length > 0) %}
+<br><b>Homepage:</b> <a href="{{ container.extra['urls'][0] }}">&nbsp;<code>{{ container.extra['urls'][0] }}</code></a>
{% endif %}
-{% if container.extra != None %}
+{% if container.extra %}
<h3>Extra Metadata (raw JSON)</h3>
{% for (key, value) in container.extra.items() %}
<code><b>{{ key }}:</b> {{ value }}</code><br>
@@ -38,15 +35,16 @@ Raw Object:
<div class="five wide column">
<div class="ui segment top attached">
-{% if container.extra.is_oa == True %}
+{% if container.es and container.es.is_oa == True %}
<i class="icon unlock huge orange"></i><b>Open Access Publisher</b>
-{% elif container.extra.is_oa == False %}
+{% elif container.es and container.es.is_oa == False %}
<i class="icon lock huge black"></i><b>Not Open Access</b>
{% else %}
<i class="icon question huge grey"></i><b>Unknown OA Status</b>
{% endif %}
</div><div class="ui segment attached">
+{% if container.issnl != None or container.wikidata_qid != None %}
{% if container.issnl != None %}
<b>ISSN-L<sup><a href="https://en.wikipedia.org/wiki/International_Standard_Serial_Number#Linking_ISSN">?</a></sup></b>
&nbsp;<code>{{ container.issnl }}</code>
@@ -56,33 +54,45 @@ Raw Object:
{% if container.extra != None and container.extra.ISSNe != None and (container.extra.ISSNe|length > 0) %}
<br><i class="icon plug"></i>Electronic: &nbsp;<code>{{ container.extra.ISSNe }}</code>
{% endif %}
+{% endif %}
+{% if container.wikidata_qid != None %}
+ <br><b>Wikidata:</b> &nbsp;<a href="https://wikidata.org/wiki/{{ container.wikidata_qid }}"><code>{{ container.wikidata_qid }}</code></a>
+{% endif %}
</div><div class="ui segment attached">
{% endif %}
+{% if (container.es and container.es != None) %}
<b>Directory Listings</b><br>
-{% if (container.extra != None) %}
- {% if container.extra.in_doaj == True %}
+ {% if container.es.in_doaj == True %}
<i class="icon check green"></i> In <a href="https://doaj.org/toc/{{ container.issnl }}">DOAJ</a><br>
- {% elif container.extra.in_doaj == False %}
+ {% elif container.es.in_doaj == False %}
<i class="icon times grey"></i> Not in <a href="https://doaj.org">DOAJ</a><br>
{% endif %}
- {% if container.extra.in_road == True %}
+
+ {% if container.es.in_road == True %}
<i class="icon check green"></i> In <a href="http://road.issn.org/issn/{{ container.issnl }}">ISSN ROAD</a><br>
- {% elif container.extra.in_road == False %}
+ {% elif container.es.in_road == False %}
<i class="icon times grey"></i> Not in <a href="https://road.issn.org">ISSN ROAD</a><br>
{% endif %}
- {% if container.extra.is_kept == True %}
+
+ {% if container.es.in_kbart == True %}
<i class="icon check green"></i> In <a href="https://thekeepers.org/purl/issn/{{ container.issnl }}">Keepers Registery</a><br>
- {% elif container.extra.is_kept == False %}
+ {% elif container.es.in_kbart == False %}
<i class="icon times grey"></i> Not in <a href="https://thekeepers.org/journals?query={{ container.issnl }}">Keepers Registry</a><br>
{% endif %}
-{% endif %}
+
+ {% if container.extra and container.extra.sherpa_romeo and container.extra.sherpa_romeo.color %}
+ SHERPA/RoMEO color: <code>{{ container.extra.sherpa_romeo.color }}</code>
+ {% endif %}
</div><div class="ui segment attached">
+{% endif %}
<b>Lookup Links</b>
<br><a href="http://www.sherpa.ac.uk/romeo/issn/{{ container.issnl }}/">SHERPA/RoMEO</a> (access policies)
-<br><a href="https://www.wikidata.org/w/index.php?search={{ container.name }}">wikidata.org</a>
+{% if not container.wikidata_qid %}
+ <br><a href="https://www.wikidata.org/w/index.php?search={{ container.name }}">wikidata.org</a>
+{% endif %}
</div><div class="ui segment attached">
<b>Fatcat Bits</b>
diff --git a/python/fatcat_web/templates/release_view.html b/python/fatcat_web/templates/release_view.html
index c81bf478..3716f0cb 100644
--- a/python/fatcat_web/templates/release_view.html
+++ b/python/fatcat_web/templates/release_view.html
@@ -154,20 +154,20 @@ This release citing other releases.
{% if ref.container_name %}{{ ref.container_name }}.{% endif %}
{% if ref.year %}{{ ref.year }}{% endif %}
{% if ref.locator %}{{ ref.locator }}{% endif %}
- {% elif ref.extra %}
+ {% elif ref.extra != None %}
{% if ref.extra.get('author') %}{{ ref.extra['author'] }}.{% endif %}
{% if ref.extra.get('article-title') %}{{ ref.extra['article-title'] }}.{% endif %}
{% if ref.container_name %}{{ ref.container_name }}.{% endif %}
{% if ref.year %}{{ ref.year }}.{% endif %}
- {% elif ref.extra and ref.extra.unstructured %}
- {{ ref.extra.unstructured }}
+ {% if ref.extra.unstructured %}{{ ref.extra.unstructured }}{% endif %}
{% else %}
<i>unknown</i>
{% endif %}
{% if ref.target_release_id != None %}
- (<a href="/release/{{ ref.target_release_id }}">fatcat release</a>)
-{# {% elif ref.extra != None and ref.extra.doi != None %}
- (DOI: <a href="/release/lookup?doi={{ ref.exta.get('doi') }}">{{ ref.extra.get('doi') }}</a>) #}
+ (<a href="/release/{{ ref.target_release_id }}">fatcat entry</a>)
+ {% endif %}
+ {% if ref.extra != None and ref.extra.doi %}
+ (DOI: <a href="/release/lookup?doi={{ ref.extra.doi }}">{{ ref.extra.doi }}</a>)
{% endif %}
{% endfor %}
</ol>
@@ -186,13 +186,13 @@ This release citing other releases.
{% if release.release_type != None %}
<div class="ui segment attached">
-<b>Release Type</b> <code>{{ release.release_type }}</code>
+<b>Release Type</b> &nbsp;<code>{{ release.release_type }}</code>
</div>
{% endif %}
{% if release.doi %}
<div class="ui segment attached">
-<b>DOI </b> <a href="https://doi.org/{{ release.doi }}">{{ release.doi }}</a>
+<b>DOI </b> &nbsp;<a href="https://doi.org/{{ release.doi }}">{{ release.doi }}</a>
</div>
{% endif %}
{% if release.isbn13 != None %}
@@ -210,37 +210,37 @@ This release citing other releases.
</div>
{% endif %}
-{% if container != None %}
+{% if container != None and container.es != None %}
<div class="ui segment attached">
<b>Container Metadata</b><br>
-{% if container.extra.is_oa == True %}
+{% if container.es.is_oa == True %}
<i class="icon unlock orange"></i>Open Access Publication<br>
-{% elif container.extra.is_oa == False %}
+{% elif container.es.is_oa == False %}
<i class="icon lock black"></i>Not Open Access<br>
{% else %}
<i class="icon question grey"></i>Unknown OA Status<br>
{% endif %}
-{% if (container.extra != None) %}
- {% if container.extra.in_doaj == True %}
+{% if (container.es != None) %}
+ {% if container.es.in_doaj == True %}
<i class="icon check green"></i> In <a href="https://doaj.org/toc/{{ container.issnl }}">DOAJ</a><br>
- {% elif container.extra.in_doaj == False %}
+ {% elif container.es.in_doaj == False %}
<i class="icon times grey"></i> Not in <a href="https://doaj.org">DOAJ</a><br>
{% endif %}
- {% if container.extra.in_road == True %}
+ {% if container.es.in_road == True %}
<i class="icon check green"></i> In <a href="http://road.issn.org/issn/{{ container.issnl }}">ISSN ROAD</a><br>
- {% elif container.extra.in_road == False %}
+ {% elif container.es.in_road == False %}
<i class="icon times grey"></i> Not in <a href="https://road.issn.org">ISSN ROAD</a><br>
{% endif %}
- {% if container.extra.is_kept == True %}
+ {% if container.es.in_kbart == True %}
<i class="icon check green"></i> In <a href="https://thekeepers.org/purl/issn/{{ container.issnl }}">Keepers Registery</a><br>
- {% elif container.extra.is_kept == False %}
+ {% elif container.es.in_kbart == False %}
<i class="icon times grey"></i> Not in <a href="https://thekeepers.org/journals?query={{ container.issnl }}">Keepers Registry</a><br>
{% endif %}
{% endif %}
{% if container.issnl != None %}
- <i class="icon hashtag"></i>ISSN-L: &nbsp;<code>{{ container.issnl }}</code><br>
+ <i class="icon linkify"></i>ISSN-L: &nbsp;<code>{{ container.issnl }}</code><br>
{% endif %}
- <i class="icon linkify"></i>Fatcat: &nbsp;<small><code><a href="/container/{{ container.ident }}">{{ container.ident }}</a></code></small><br>
+ <a href="/container/{{ container.ident }}" title="container {{ container.ident }}"><i class="icon share"></i>Fatcat Entry</a>
</div>
{% endif %}
@@ -273,7 +273,7 @@ This release citing other releases.
<b>Fatcat Bits</b>
<p>State is "{{ release.state }}". Revision:
<br><small><code>{{ release.revision }}</code></small>
-<br><a href="https://api.{{ config.FATCAT_DOMAIN }}/v0/release/{{ release.ident }}?expand=container,files">As JSON object via API</a>
+<br><a href="https://api.{{ config.FATCAT_DOMAIN }}/v0/release/{{ release.ident }}?expand=container,files,filesets,webcaptures">As JSON object via API</a>
</div>
<div class="two ui buttons bottom attached">