aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-06-17 15:39:46 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-06-17 15:39:46 -0700
commita4f9a344bb7d80fdb830b764d26eec986a47e4c1 (patch)
treeb7a6c24e57459dfb660d871d0195c6468d307ce8 /python
parent2fed334b353a070b7c7d1ec1b38fd826fa866455 (diff)
downloadfatcat-a4f9a344bb7d80fdb830b764d26eec986a47e4c1.tar.gz
fatcat-a4f9a344bb7d80fdb830b764d26eec986a47e4c1.zip
fix broken basic/boring templates
Diffstat (limited to 'python')
-rw-r--r--python/fatcat/routes.py4
-rw-r--r--python/fatcat/templates/container_view.html26
-rw-r--r--python/fatcat/templates/creator_view.html21
-rw-r--r--python/fatcat/templates/file_view.html41
-rw-r--r--python/fatcat/templates/home.html15
-rw-r--r--python/fatcat/templates/release_view.html80
-rw-r--r--python/fatcat/templates/work_view.html36
7 files changed, 169 insertions, 54 deletions
diff --git a/python/fatcat/routes.py b/python/fatcat/routes.py
index a3d4d4ee..ad5c868c 100644
--- a/python/fatcat/routes.py
+++ b/python/fatcat/routes.py
@@ -68,7 +68,9 @@ def release_view(ident):
entity = api.get_release(str(ident))
except ApiException as ae:
abort(ae.status)
- return render_template('release_view.html', release=entity)
+ authors = [c for c in entity.contribs if c.role in ('author', None)]
+ authors = sorted(authors, key=lambda c: c.index)
+ return render_template('release_view.html', release=entity, authors=authors)
@app.route('/release/random', methods=['GET'])
def release_random():
diff --git a/python/fatcat/templates/container_view.html b/python/fatcat/templates/container_view.html
index 483886b5..6c5e5581 100644
--- a/python/fatcat/templates/container_view.html
+++ b/python/fatcat/templates/container_view.html
@@ -1,14 +1,26 @@
{% extends "base.html" %}
{% block body %}
-<h1>Container: {{ container.name }}</h1>
+<h1>{{ container.name }}</h1>
-<p>ID: {{ container.id }}
-<p>ISSN: {{ container.issn }}
-<p>Publisher: {{ container.publisher }}
+<p><b>Publisher:</b> {{ container.publisher }}
+<p><b>ISSN-L<sup><a href="https://en.wikipedia.org/wiki/International_Standard_Serial_Number#Linking_ISSN">?</a></sup></b>:
+ <code>{{ container.issnl }}</code>
+{% if container.coden != None %}
+<p><b>CODEN<sup><a href="https://en.wikipedia.org/wiki/CODEN">?</a></sup>:</b> <code>{{ container.coden }}</code>
+{% endif %}
+{% if container.abbrev != None %}
+<p><b>Abbreviation:</b> <code>{{ container.abbrev }}</code>
+{% endif %}
+<p><b>fatcat Container Identifier:</b> <code>{{ container.ident }}</code> (revision #{{ container.revision }}, {{ container.state }})
+{% if container.extra != None %}
+<p><b>Additional Metadata (raw JSON):</b>
+<pre>{{ container.extra }}</pre>
+{% endif %}
-<p>TODO:
-
-<pre>{{ container }}</pre>
+<!--
+Raw JSON Object:
+{{ container }}
+-->
{% endblock %}
diff --git a/python/fatcat/templates/creator_view.html b/python/fatcat/templates/creator_view.html
index f7be9f2c..210242aa 100644
--- a/python/fatcat/templates/creator_view.html
+++ b/python/fatcat/templates/creator_view.html
@@ -1,10 +1,25 @@
{% extends "base.html" %}
{% block body %}
-<h1>Creator: {{ creator.id }}</h1>
+<h1>{{ creator.display_name }}</h1>
-TODO:
+<p><b>Given ("first") name:</b> {{ creator.given_name}}
+<p><b>Sur ("family"/"last") name:</b> {{ creator.surname }}
+<p><b>ORCID<sup><a href="https://en.wikipedia.org/wiki/Orcid">?</a></sup></b>:
+{% if creator.orcid != None %}
+ <a href="https://orcid.org/{{creator.orcid}}"><code>{{ creator.orcid }}</code></a>
+{% else %}
+ unknown
+{% endif %}
+<p><b>fatcat Creator Identifier:</b> <code>{{ creator.ident }}</code> (revision #{{ creator.revision }}, {{ creator.state }})
+{% if creator.extra != None %}
+<p><b>Additional Metadata (raw JSON):</b>
+<pre>{{ creator.extra }}</pre>
+{% endif %}
-<pre>{{ creator }}</pre>
+<!--
+Raw JSON Object:
+{{ creator }}
+-->
{% endblock %}
diff --git a/python/fatcat/templates/file_view.html b/python/fatcat/templates/file_view.html
index ff55e21c..f45c9238 100644
--- a/python/fatcat/templates/file_view.html
+++ b/python/fatcat/templates/file_view.html
@@ -1,10 +1,45 @@
{% extends "base.html" %}
{% block body %}
-<h1>File: {{ file.id }}</h1>
+<h1>File {{ file.ident }}</h1>
-TODO:
+<p><b>Size:</b> {{ file.size }} (bytes)
+<p><b>SHA-1 checksum:</b> <code>{{ file.sha1 }}</code>
+{% if file.sha256 != None %}
+<p><b>SHA-256 checksum:</b> <code>{{ file.sha256 }}</code>
+{% endif %}
+{% if file.md5 != None %}
+<p><b>MD5 checksum:</b> <code>{{ file.md5 }}</code>
+{% endif %}
+<p><b>fatcat File Identifier:</b> <code>{{ file.ident }}</code> (revision #{{ file.revision }}, {{ file.state }})
+{% if file.extra != None %}
+<p><b>Additional Metadata (raw JSON):</b>
+<pre>{{ file.extra }}</pre>
+{% endif %}
-<pre>{{ file }}</pre>
+<!--
+Raw JSON Object:
+{{ file }}
+-->
+
+{% if file.releases != None %}
+<p>Releases associated with this file:
+<ul>
+{% for release_id in file.releases %}
+ <li><a href="/release/{{ release_id }}"><code>{{ release_id }}</code></a>
+{% endfor %}
+</ul>
+{% else %}
+This file is not associated with any fatcat release.
+{% endif %}
+
+{% if file.url != None %}
+<p>Known locations of this file:
+<ul>
+ <li><a href="{{ file.url }}"><code>{{ file.url }}</code></a>
+</ul>
+{% else %}
+No known public URL, mirror, or archive for this file.
+{% endif %}
{% endblock %}
diff --git a/python/fatcat/templates/home.html b/python/fatcat/templates/home.html
index 246c3a4d..47759126 100644
--- a/python/fatcat/templates/home.html
+++ b/python/fatcat/templates/home.html
@@ -16,19 +16,24 @@ indexing (aka, linking together of pre-prints and final copies).
<table>
<tr><td><b>Container</b>
<td><a href="/container/create">Create</a>
- <td><a href="/container/00000000-0000-0000-1111-000000000002">Example</a>
+ <td>Example <a href="/container/00000000-0000-0000-1111-000000000002">Fake</a>
+ <a href="/container/00000000-0000-0000-1111-000000000003">Real</a>
<tr><td><b>Creator</b>
<td><a href="/creator/create">Create</a>
- <td><a href="/creator/00000000-0000-0000-2222-000000000002">Example</a>
+ <td>Example <a href="/creator/00000000-0000-0000-2222-000000000002">Fake</a>
+ <a href="/creator/00000000-0000-0000-2222-000000000003">Real</a>
<tr><td><b>File</b>
<td><a href="/file/create">Create</a>
- <td><a href="/file/00000000-0000-0000-3333-000000000002">Example</a>
+ <td>Example <a href="/file/00000000-0000-0000-3333-000000000002">Fake</a>
+ <a href="/file/00000000-0000-0000-3333-000000000003">Real</a>
<tr><td><b>Release</b>
<td><a href="/release/create">Create</a>
- <td><a href="/release/00000000-0000-0000-4444-000000000002">Example</a>
+ <td>Example <a href="/release/00000000-0000-0000-4444-000000000002">Fake</a>
+ <a href="/release/00000000-0000-0000-4444-000000000003">Real</a>
<tr><td><b>Work</b>
<td><a href="/work/create">Create</a>
- <td><a href="/work/00000000-0000-0000-5555-000000000002">Example</a>
+ <td>Example <a href="/work/00000000-0000-0000-5555-000000000002">Fake</a>
+ <a href="/work/00000000-0000-0000-5555-000000000003">Real</a>
</table>
{% endblock %}
diff --git a/python/fatcat/templates/release_view.html b/python/fatcat/templates/release_view.html
index ee68161c..6572919e 100644
--- a/python/fatcat/templates/release_view.html
+++ b/python/fatcat/templates/release_view.html
@@ -2,30 +2,80 @@
{% block body %}
<h1>{{ release.title }}</h1>
+{% for contrib in authors %}
+ {% if contrib.creator_id %}
+ <a href="/creator/{{contrib.creator_id}}">{{ contrib.raw }}</a>
+ {% else %}
+ {{ contrib.raw }}
+ {% endif %}
+{% endfor %}
-<p>Release type: {{ release.type }}
-<p><a href="/release/{{ release.id }}/history">History</a>
-<p>Contributors:
-{% for c in release.contributors %} {{ c.name }}; {% endfor %}
-
-<p>Title: {{ release.title }}
-<p>Date: {{ release.date }}
+<br><br>
+<p><b>fatcat Work:</b> <a href="/work/{{ release.work_id }}"><code>{{ release.work_id }}</code></a>
+{% if release.doi != None %}
+<p><b>DOI:</b> <a href="https://doi.org/{{ release.doi }}"><code>{{ release.doi }}</code></a>
+{% endif %}
+{% if release.isbn13 != None %}
+<p><b>ISBN-13:</b> <code>{{ release.isbn13 }}</code> (<a href="https://openlibrary.org/search?isbn={{ release.isbn13 }}">openlibrary.org</a>)
+{% endif %}
+{% if release.language != None %}
+<p><b>Primary Language:</b> <code>{{ release.language }}</code> (<a href="https://www.loc.gov/standards/iso639-2/php/langcodes_name.php?iso_639_1={{ release.language }}">lookup ISO-639 code</a>)
+{% endif %}
+{% if release.volume != None %}<p><b>Volume:</b> {{ release.volume }}{% endif %}
+{% if release.issue != None %}<p><b>Issue:</b> {{ release.issue }}{% endif %}
+{% if release.pages != None %}<p><b>Pages:</b> {{ release.pages }}{% endif %}
+{% if release.publisher != None %}<p><b>Publisher:</b> {{ release.publisher }}{% endif %}
+{% if release.release_date != None %}<p><b>Date (published):</b> {{ release.release_date }}{% endif %}
+{% if release.release_status != None %}<p><b>Publication Status:</b> {{ release.release_status }}{% endif %}
+{% if release.release_type != None %}<p><b>Publication Type:</b> {{ release.release_type}}{% endif %}
-{% if release.container %}
-<p>Container: <a href="/container/{{ release.container.id }}">{{ release.container.title }}</a>
+<p><b>fatcat Release Identifier:</b> <code>{{ release.ident }}</code> (revision #{{ release.revision }}, {{ release.state }})
+{% if release.extra != None %}
+<p><b>Additional Metadata (raw JSON):</b>
+<pre>{{ release.extra }}</pre>
{% endif %}
-{% if release.doi %}
-<p>DOI: <a href="https://dx.doi.org/{{ release.doi }}">{{ release.doi }}</a>
+<!--
+Raw JSON Object:
+<pre>{{ release }}</pre>
+-->
+
+<br>
+{% if release.contribs.size != 0 %}
+<p>Full list of contributors (not just authors):
+<table>
+ <tr><th>Role
+ <th>Attribution Order
+ <th>Name
+ {% for contrib in release.contribs %}
+ <tr><td>{{ contrib.role or '' }}
+ <td>{{ contrib.index }}
+ {% if contrib.creator_id %}
+ <td><a href="/creator/{{contrib.creator_id}}">{{ contrib.raw }}</a>
+ {% else %}
+ <td>{{ contrib.raw }}
+ {% endif %}
+ {% endfor %}
+</table>
+{% else %}
+<p>Contributors (authors, etc) not known.
{% endif %}
-{% if releases %}
+<br>
+{% if release.refs.size != 0 %}
+<p>References (this work citing other works):
<ul>
-{% for r in releases %}
- <ul><a href="/release/{{ r.id }}">{{ r.title }}</a> ({{ y.date }} - {{ y.release_type }})
-{% endfor %}
+ {% for ref in release.refs %}
+ <li>{{ ref.raw }}
+ {% if ref.target_release_id != None %}
+ (<a href="/release/{{ ref.target_release_id }}">fatcat release</a>)
+ {% endif %}
+ {% endfor %}
</ul>
{% else %}
+<p>No reference list available.
{% endif %}
+
+
{% endblock %}
diff --git a/python/fatcat/templates/work_view.html b/python/fatcat/templates/work_view.html
index 8c5e955d..1a81d456 100644
--- a/python/fatcat/templates/work_view.html
+++ b/python/fatcat/templates/work_view.html
@@ -1,37 +1,33 @@
{% extends "base.html" %}
{% block body %}
-<h1>{{ work.title }}</h1>
+<h1>Work {{ work.ident }}</h1>
-<p>Work type: {{ work.type }}
-<p><a href="/work/{{ work.id }}/history">History</a>
-<p>Contributors:
-{% for c in work.contributors %} {{ c.name }}; {% endfor %}
-
-{% if primary %}
-<h2>Primary Release/Edition</h2>
-<p>Title: {{ primary.title }}
-<p>Date: {{ primary.date }}
-
-{% if primary.container %}
-<p>Container: <a href="/container/{{ primary.container.id }}">{{ primary.container.title }}</a>
+<p><b>fatcat Work Identifier:</b> <code>{{ work.ident }}</code> (revision #{{ work.revision }}, {{ work.state }})
+{% if work.extra != None %}
+<p><b>Additional Metadata (raw JSON):</b>
+<pre>{{ work.extra }}</pre>
{% endif %}
-{% if primary.doi %}
-<p>DOI: <a href="https://dx.doi.org/{{ primary.doi }}">{{ primary.doi }}</a>
-{% endif %}
+<!--
+Raw JSON Object:
+{{ work }}
+-->
-{% else %}
-<p>No primary release
-{% endif %}
+<p>A "work" is just a linking identifier between a set of releases. For
+example, a pre-print and a published article may contain small differences, but
+still reference the same underlying "work".
+
+<br>
{% if releases %}
<ul>
{% for r in releases %}
- <ul><a href="/release/{{ r.id }}">{{ r.title }}</a> ({{ y.date }} - {{ y.release_type }})
+ <ul><a href="/release/{{ r.ident }}">{{ r.title }}</a> ({{ y.release_type }} - {{ y.date }})
{% endfor %}
</ul>
{% else %}
+<p>There are no known releases associated with this work.
{% endif %}
{% endblock %}