From 7ac552af63a14ed2ca36a767e762399904652d44 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 25 Jun 2018 10:46:42 -0700 Subject: WIP on UI update --- python/fatcat/routes.py | 6 +- python/fatcat/templates/base.html | 17 ++-- python/fatcat/templates/home.html | 31 +++++--- python/fatcat/templates/release_view.html | 124 +++++++++++++++++++++++------- 4 files changed, 131 insertions(+), 47 deletions(-) diff --git a/python/fatcat/routes.py b/python/fatcat/routes.py index 77aecff3..5bd68ba1 100644 --- a/python/fatcat/routes.py +++ b/python/fatcat/routes.py @@ -86,11 +86,15 @@ def release_view(ident): try: entity = api.get_release(str(ident)) files = api.get_release_files(str(ident)) + container = None + if entity.container_id is not None: + container = api.get_container(entity.container_id) except ApiException as ae: abort(ae.status) 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, files=files) + return render_template('release_view.html', release=entity, + authors=authors, files=files, container=container) @app.route('/release/lookup', methods=['GET']) def release_lookup(): diff --git a/python/fatcat/templates/base.html b/python/fatcat/templates/base.html index ac6fef43..ab6c13ad 100644 --- a/python/fatcat/templates/base.html +++ b/python/fatcat/templates/base.html @@ -36,11 +36,11 @@ @@ -48,8 +48,13 @@ -
-{% block body %}Nothing to see here.{% endblock %} + +
+{% block fullbody %} +
+ {% block body %}Nothing to see here.{% endblock %} +
+{% endblock %}
diff --git a/python/fatcat/templates/home.html b/python/fatcat/templates/home.html index 47759126..0ec0bd18 100644 --- a/python/fatcat/templates/home.html +++ b/python/fatcat/templates/home.html @@ -1,5 +1,6 @@ {% extends "base.html" %} {% block body %} +

Welcome to fatcat!

@@ -13,27 +14,35 @@ URLs), a documented API, and work/release indexing (aka, linking together of pre-prints and final copies). Read more... - +

+ +
+ +
Entity + Actions + Examples +
Container Create - Example Fake - Real + Fake +
Real
Creator Create - Example Fake - Real + Fake +
Real
File Create - Example Fake - Real + Fake +
Real
Release Create - Example Fake - Real + Fake +
Real
Work Create - Example Fake - Real + Fake +
Real
+
{% endblock %} diff --git a/python/fatcat/templates/release_view.html b/python/fatcat/templates/release_view.html index 09a0b97b..4d67644d 100644 --- a/python/fatcat/templates/release_view.html +++ b/python/fatcat/templates/release_view.html @@ -1,35 +1,52 @@ {% extends "base.html" %} -{% block body %} +{% block fullbody %} -

{{ release.title }}

+
+
+
+ +

{{ release.title }} +
release {{ release.ident }}

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

-

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

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

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

+{% if container and release.release_status == 'published' %} +
+Published as a {{ release.release_type }} in {{ container.name }} +{% if container.extra.is_oa %} (open access!){% endif %} +
{% endif %} +{% if container.issnl != None %}
ISSN-L: {{ container.issnl }}{% endif %} +{% if release.volume != None %}
Volume: {{ release.volume }}{% endif %} +{% if release.issue != None %}
Issue: {{ release.issue }}{% endif %} +{% if release.pages != None %}
Page(s): {{ release.pages }}{% endif %} +{% if release.publisher != None %}
Publisher: {{ release.publisher }}{% endif %} +{% if release.release_status != None %}
Release Status: {{ release.release_status }}{% endif %} +{% if release.release_type != None %}
Release Type: {{ release.release_type}}{% endif %} +
+There may be other versions or releases (pre-prints, publications, etc) linked +to the same work: +{{ release.work_id }} + {% 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 %} -

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

Additional Metadata (raw JSON):

{{ release.extra }}
@@ -41,34 +58,52 @@ Raw JSON Object: -->
+

Files

{% if files != [] %} -

Files believed to represent this release: -

{% else %} -

There are no known files associated with this release (you could try other -releases for this work?). +

There are no known files associated with this release (you could try +other releases for this work?). {% endif %}
+

All Contributors

{% if release.contribs.size != 0 %} -

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

Contributors (authors, etc) not known. @@ -76,7 +111,8 @@ releases for this work?).
{% if release.refs.size != 0 %} -

References (this work citing other works): +

References

+This release citing other releases.