From a4f9a344bb7d80fdb830b764d26eec986a47e4c1 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Sun, 17 Jun 2018 15:39:46 -0700 Subject: fix broken basic/boring templates --- python/fatcat/routes.py | 4 +- python/fatcat/templates/container_view.html | 26 +++++++--- python/fatcat/templates/creator_view.html | 21 ++++++-- python/fatcat/templates/file_view.html | 41 +++++++++++++-- python/fatcat/templates/home.html | 15 ++++-- python/fatcat/templates/release_view.html | 80 +++++++++++++++++++++++------ python/fatcat/templates/work_view.html | 36 ++++++------- 7 files changed, 169 insertions(+), 54 deletions(-) (limited to 'python') 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 %} -

Container: {{ container.name }}

+

{{ container.name }}

-

ID: {{ container.id }} -

ISSN: {{ container.issn }} -

Publisher: {{ container.publisher }} +

Publisher: {{ container.publisher }} +

ISSN-L?: + {{ container.issnl }} +{% if container.coden != None %} +

CODEN?: {{ container.coden }} +{% endif %} +{% if container.abbrev != None %} +

Abbreviation: {{ container.abbrev }} +{% endif %} +

fatcat Container Identifier: {{ container.ident }} (revision #{{ container.revision }}, {{ container.state }}) +{% if container.extra != None %} +

Additional Metadata (raw JSON): +

{{ container.extra }}
+{% endif %} -

TODO: - -

{{ 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 %} -

Creator: {{ creator.id }}

+

{{ creator.display_name }}

-TODO: +

Given ("first") name: {{ creator.given_name}} +

Sur ("family"/"last") name: {{ creator.surname }} +

ORCID?: +{% if creator.orcid != None %} + {{ creator.orcid }} +{% else %} + unknown +{% endif %} +

fatcat Creator Identifier: {{ creator.ident }} (revision #{{ creator.revision }}, {{ creator.state }}) +{% if creator.extra != None %} +

Additional Metadata (raw JSON): +

{{ creator.extra }}
+{% endif %} -
{{ 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 %} -

File: {{ file.id }}

+

File {{ file.ident }}

-TODO: +

Size: {{ file.size }} (bytes) +

SHA-1 checksum: {{ file.sha1 }} +{% if file.sha256 != None %} +

SHA-256 checksum: {{ file.sha256 }} +{% endif %} +{% if file.md5 != None %} +

MD5 checksum: {{ file.md5 }} +{% endif %} +

fatcat File Identifier: {{ file.ident }} (revision #{{ file.revision }}, {{ file.state }}) +{% if file.extra != None %} +

Additional Metadata (raw JSON): +

{{ file.extra }}
+{% endif %} -
{{ file }}
+ + +{% if file.releases != None %} +

Releases associated with this file: +

+{% else %} +This file is not associated with any fatcat release. +{% endif %} + +{% if file.url != None %} +

Known locations of this file: +

+{% 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).
Container Create - Example + Example Fake + Real
Creator Create - Example + Example Fake + Real
File Create - Example + Example Fake + Real
Release Create - Example + Example Fake + Real
Work Create - Example + Example Fake + Real
{% 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 %}

{{ release.title }}

+{% for contrib in authors %} + {% if contrib.creator_id %} + {{ contrib.raw }} + {% else %} + {{ contrib.raw }} + {% endif %} +{% endfor %} -

Release type: {{ release.type }} -

History -

Contributors: -{% for c in release.contributors %} {{ c.name }}; {% endfor %} - -

Title: {{ release.title }} -

Date: {{ release.date }} +

+

fatcat Work: {{ release.work_id }} +{% if release.doi != None %} +

DOI: {{ release.doi }} +{% endif %} +{% if release.isbn13 != None %} +

ISBN-13: {{ release.isbn13 }} (openlibrary.org) +{% endif %} +{% if release.language != None %} +

Primary Language: {{ release.language }} (lookup ISO-639 code) +{% endif %} +{% if release.volume != None %}

Volume: {{ release.volume }}{% endif %} +{% if release.issue != None %}

Issue: {{ release.issue }}{% endif %} +{% if release.pages != None %}

Pages: {{ release.pages }}{% endif %} +{% if release.publisher != None %}

Publisher: {{ release.publisher }}{% endif %} +{% if release.release_date != None %}

Date (published): {{ release.release_date }}{% endif %} +{% if release.release_status != None %}

Publication Status: {{ release.release_status }}{% endif %} +{% if release.release_type != None %}

Publication Type: {{ release.release_type}}{% endif %} -{% if release.container %} -

Container: {{ release.container.title }} +

fatcat Release Identifier: {{ release.ident }} (revision #{{ release.revision }}, {{ release.state }}) +{% if release.extra != None %} +

Additional Metadata (raw JSON): +

{{ release.extra }}
{% endif %} -{% if release.doi %} -

DOI: {{ release.doi }} + + +
+{% if release.contribs.size != 0 %} +

Full list of contributors (not just authors): + +
Role + Attribution Order + Name + {% for contrib in release.contribs %} +
{{ contrib.role or '' }} + {{ contrib.index }} + {% if contrib.creator_id %} + {{ contrib.raw }} + {% else %} + {{ contrib.raw }} + {% endif %} + {% endfor %} +
+{% else %} +

Contributors (authors, etc) not known. {% endif %} -{% if releases %} +
+{% if release.refs.size != 0 %} +

References (this work citing other works):