From 16126c5901c435ea6610eff8b7211226c6f125d5 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 13 Jun 2019 17:17:22 -0700 Subject: refactor all entities to new UI style --- python/fatcat_web/entity_helpers.py | 2 +- python/fatcat_web/routes.py | 146 ++++++++++++++++++--- python/fatcat_web/templates/container_view.html | 25 +--- python/fatcat_web/templates/creator_view.html | 23 +--- python/fatcat_web/templates/entity_base.html | 41 +++++- python/fatcat_web/templates/entity_history.html | 1 - python/fatcat_web/templates/entity_macros.html | 29 ++-- python/fatcat_web/templates/entity_metadata.html | 16 --- .../fatcat_web/templates/entity_view_metadata.html | 16 +++ python/fatcat_web/templates/file_view.html | 24 +--- python/fatcat_web/templates/fileset_view.html | 24 +--- python/fatcat_web/templates/release_contribs.html | 34 ----- .../fatcat_web/templates/release_references.html | 44 ------- python/fatcat_web/templates/release_view.html | 3 +- .../templates/release_view_contribs.html | 34 +++++ .../templates/release_view_references.html | 44 +++++++ python/fatcat_web/templates/webcapture_view.html | 28 +--- python/fatcat_web/templates/work_view.html | 24 +--- 18 files changed, 309 insertions(+), 249 deletions(-) delete mode 100644 python/fatcat_web/templates/entity_metadata.html create mode 100644 python/fatcat_web/templates/entity_view_metadata.html delete mode 100644 python/fatcat_web/templates/release_contribs.html delete mode 100644 python/fatcat_web/templates/release_references.html create mode 100644 python/fatcat_web/templates/release_view_contribs.html create mode 100644 python/fatcat_web/templates/release_view_references.html diff --git a/python/fatcat_web/entity_helpers.py b/python/fatcat_web/entity_helpers.py index b3cda67f..ab5eaea8 100644 --- a/python/fatcat_web/entity_helpers.py +++ b/python/fatcat_web/entity_helpers.py @@ -100,7 +100,7 @@ def generic_get_entity(entity_type, ident): elif entity_type == 'release': return enrich_release_entity(api.get_release(ident, expand="container,files,filesets,webcaptures")) elif entity_type == 'work': - return api.get_work(ident) + return enrich_work_entity(api.get_work(ident)) else: raise NotImplementedError except ApiException as ae: diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py index 326d5807..fd948262 100644 --- a/python/fatcat_web/routes.py +++ b/python/fatcat_web/routes.py @@ -28,7 +28,6 @@ def container_history(ident): app.log.info(ae) abort(ae.status) return render_template('entity_history.html', - page_title=entity.name, entity_type="container", entity=entity, history=history) @@ -41,7 +40,6 @@ def creator_history(ident): except ApiException as ae: abort(ae.status) return render_template('entity_history.html', - page_title=entity.display_name, entity_type="creator", entity=entity, history=history) @@ -54,7 +52,6 @@ def file_history(ident): except ApiException as ae: abort(ae.status) return render_template('entity_history.html', - page_title=None, entity_type="file", entity=entity, history=history) @@ -67,7 +64,6 @@ def fileset_history(ident): except ApiException as ae: abort(ae.status) return render_template('entity_history.html', - page_title=None, entity_type="fileset", entity=entity, history=history) @@ -80,7 +76,6 @@ def webcapture_history(ident): except ApiException as ae: abort(ae.status) return render_template('entity_history.html', - page_title=None, entity_type="webcapture", entity=entity, history=history) @@ -93,7 +88,6 @@ def release_history(ident): except ApiException as ae: abort(ae.status) return render_template('entity_history.html', - page_title=entity.title, entity_type="release", entity=entity, history=history) @@ -106,7 +100,6 @@ def work_history(ident): except ApiException as ae: abort(ae.status) return render_template('entity_history.html', - page_title=None, entity_type="work", entity=entity, history=history) @@ -205,6 +198,15 @@ def generic_entity_view(entity_type, ident, view_template): return render_template(view_template, entity_type=entity_type, entity=entity, editgroup_id=None) +def generic_entity_revision_view(entity_type, revision_id, view_template): + entity = generic_get_entity_revision(entity_type, revision_id) + + metadata = entity.to_dict() + metadata.pop('extra') + entity._metadata = metadata + + return render_template(view_template, entity_type=entity_type, entity=entity, editgroup_id=None) + def generic_editgroup_entity_view(editgroup_id, entity_type, ident, view_template): try: editgroup = api.get_editgroup(editgroup_id) @@ -224,106 +226,214 @@ def generic_editgroup_entity_view(editgroup_id, entity_type, ident, view_templat def container_view(ident): return generic_entity_view('container', ident, 'container_view.html') +@app.route('/container//metadata', methods=['GET']) +def container_view_metadata(ident): + return generic_entity_view('container', ident, 'entity_view_metadata.html') + @app.route('/container/rev/', methods=['GET']) def container_revision_view(revision_id): - entity = generic_get_entity_revision('container', revision_id) - return render_template('container_view.html', entity=entity, editgroup=None) + return generic_entity_revision_view('container', revision_id, 'container_view.html') + +@app.route('/container/rev//metadata', methods=['GET']) +def container_revision_view_metadata(revision_id): + return generic_entity_revision_view('container', revision_id, 'entity_view_metadata.html') @app.route('/editgroup//container/', methods=['GET']) def container_editgroup_view(editgroup_id, ident): return generic_editgroup_entity_view(editgroup_id, 'container', ident, 'container_view.html') +@app.route('/editgroup//container//metadata', methods=['GET']) +def container_editgroup_view_metadata(editgroup_id, ident): + return generic_editgroup_entity_view(editgroup_id, 'container', ident, 'entity_view_metadata.html') + @app.route('/creator/', methods=['GET']) def creator_view(ident): return generic_entity_view('creator', ident, 'creator_view.html') +@app.route('/creator//metadata', methods=['GET']) +def creator_view_metadata(ident): + return generic_entity_view('creator', ident, 'entity_view_metadata.html') + @app.route('/creator/rev/', methods=['GET']) def creator_revision_view(revision_id): entity = generic_get_entity_revision('creator', revision_id) - return render_template('creator_view.html', creator=entity, editgroup=None) + return render_template('creator_view.html', entity_type='creator', entity=entity, editgroup=None) + +@app.route('/creator/rev//metadata', methods=['GET']) +def creator_revision_view_metadata(revision_id): + entity = generic_get_entity_revision('creator', revision_id) + return render_template('entity_view_metadata.html', entity_type='creator', entity=entity, editgroup=None) @app.route('/editgroup//creator/', methods=['GET']) def creator_editgroup_view(editgroup_id, ident): return generic_editgroup_entity_view(editgroup_id, 'creator', ident, 'creator_view.html') +@app.route('/editgroup//creator//metadata', methods=['GET']) +def creator_editgroup_view_metadata(editgroup_id, ident): + return generic_editgroup_entity_view(editgroup_id, 'creator', ident, 'entity_view_metadata.html') + + @app.route('/file/', methods=['GET']) def file_view(ident): return generic_entity_view('file', ident, 'file_view.html') +@app.route('/file//metadata', methods=['GET']) +def file_view_metadata(ident): + return generic_entity_view('file', ident, 'entity_view_metadata.html') + @app.route('/file/rev/', methods=['GET']) def file_revision_view(revision_id): entity = generic_get_entity_revision('file', revision_id) - return render_template('file_view.html', entity=entity, editgroup=None) + return render_template('file_view.html', entity_type='file', entity=entity, editgroup=None) + +@app.route('/file/rev//metadata', methods=['GET']) +def file_revision_view_metadata(revision_id): + entity = generic_get_entity_revision('file', revision_id) + return render_template('entity_view_metadata.html', entity_type='file', entity=entity, editgroup=None) @app.route('/editgroup//file/', methods=['GET']) def file_editgroup_view(editgroup_id, ident): return generic_editgroup_entity_view(editgroup_id, 'file', ident, 'file_view.html') +@app.route('/editgroup//file//metadata', methods=['GET']) +def file_editgroup_view_metadata(editgroup_id, ident): + return generic_editgroup_entity_view(editgroup_id, 'file', ident, 'entity_view_metadata.html') + + @app.route('/fileset/', methods=['GET']) def fileset_view(ident): return generic_entity_view('fileset', ident, 'fileset_view.html') +@app.route('/fileset//metadata', methods=['GET']) +def fileset_view_metadata(ident): + return generic_entity_view('fileset', ident, 'entity_view_metadata.html') + @app.route('/fileset/rev/', methods=['GET']) def fileset_revision_view(revision_id): entity = generic_get_entity_revision('fileset', revision_id) - return render_template('fileset_view.html', entity=entity, editgroup=None) + return render_template('fileset_view.html', entity_type='fileset', entity=entity, editgroup=None) + +@app.route('/fileset/rev//metadata', methods=['GET']) +def fileset_revision_view_metadata(revision_id): + entity = generic_get_entity_revision('fileset', revision_id) + return render_template('entity_view_metadata.html', entity_type='fileset', entity=entity, editgroup=None) @app.route('/editgroup//fileset/', methods=['GET']) def fileset_editgroup_view(editgroup_id, ident): return generic_editgroup_entity_view(editgroup_id, 'fileset', ident, 'fileset_view.html') +@app.route('/editgroup//fileset//metadata', methods=['GET']) +def fileset_editgroup_view_metadata(editgroup_id, ident): + return generic_editgroup_entity_view(editgroup_id, 'fileset', ident, 'entity_view_metadata.html') + + @app.route('/webcapture/', methods=['GET']) def webcapture_view(ident): return generic_entity_view('webcapture', ident, 'webcapture_view.html') +@app.route('/webcapture//metadata', methods=['GET']) +def webcapture_view_metadata(ident): + return generic_entity_view('webcapture', ident, 'entity_view_metadata.html') + @app.route('/webcapture/rev/', methods=['GET']) def webcapture_revision_view(revision_id): entity = generic_get_entity_revision('webcapture', revision_id) - return render_template('webcapture_view.html', entity=entity, editgroup=None) + return render_template('webcapture_view.html', entity_type='webcapture', entity=entity, editgroup=None) + +@app.route('/webcapture/rev//metadata', methods=['GET']) +def webcapture_revision_view_metadata(revision_id): + entity = generic_get_entity_revision('webcapture', revision_id) + return render_template('entity_view_metadata.html', entity_type='webcapture', entity=entity, editgroup=None) @app.route('/editgroup//webcapture/', methods=['GET']) def webcapture_editgroup_view(editgroup_id, ident): return generic_editgroup_entity_view(editgroup_id, 'webcapture', ident, 'webcapture_view.html') +@app.route('/editgroup//webcapture//metadata', methods=['GET']) +def webcapture_editgroup_view_metadata(editgroup_id, ident): + return generic_editgroup_entity_view(editgroup_id, 'webcapture', ident, 'entity_view_metadata.html') + + @app.route('/release/', methods=['GET']) def release_view(ident): return generic_entity_view('release', ident, 'release_view.html') @app.route('/release//contribs', methods=['GET']) def release_view_contribs(ident): - return generic_entity_view('release', ident, 'release_contribs.html') + return generic_entity_view('release', ident, 'release_view_contribs.html') @app.route('/release//references', methods=['GET']) def release_view_references(ident): - return generic_entity_view('release', ident, 'release_references.html') + return generic_entity_view('release', ident, 'release_view_references.html') @app.route('/release//metadata', methods=['GET']) def release_view_metadata(ident): - return generic_entity_view('release', ident, 'entity_metadata.html') + return generic_entity_view('release', ident, 'entity_view_metadata.html') @app.route('/release/rev/', methods=['GET']) def release_revision_view(revision_id): entity = generic_get_entity_revision('release', revision_id) - return render_template('release_view.html', entity=entity, editgroup=None) + return render_template('release_view.html', entity_type='release', entity=entity, editgroup=None) + +@app.route('/release/rev//contribs', methods=['GET']) +def release_revision_view_contribs(revision_id): + entity = generic_get_entity_revision('release', revision_id) + return render_template('release_view_contribs.html', entity_type='release', entity=entity, editgroup=None) + +@app.route('/release/rev//references', methods=['GET']) +def release_revision_view_references(revision_id): + entity = generic_get_entity_revision('release', revision_id) + return render_template('release_view_references.html', entity_type='release', entity=entity, editgroup=None) + +@app.route('/release/rev//metadata', methods=['GET']) +def release_revision_view_metadata(revision_id): + entity = generic_get_entity_revision('release', revision_id) + return render_template('entity_view_metadata.html', entity_type='release', entity=entity, editgroup=None) @app.route('/editgroup//release/', methods=['GET']) def release_editgroup_view(editgroup_id, ident): return generic_editgroup_entity_view(editgroup_id, 'release', ident, 'release_view.html') +@app.route('/editgroup//release//contribs', methods=['GET']) +def release_editgroup_view_contribs(editgroup_id, ident): + return generic_editgroup_entity_view(editgroup_id, 'release', ident, 'release_view_contribs.html') + +@app.route('/editgroup//release//references', methods=['GET']) +def release_editgroup_view_references(editgroup_id, ident): + return generic_editgroup_entity_view(editgroup_id, 'release', ident, 'release_view_references.html') + +@app.route('/editgroup//release//metadata', methods=['GET']) +def release_editgroup_view_metadata(editgroup_id, ident): + return generic_editgroup_entity_view(editgroup_id, 'release', ident, 'entity_view_metadata.html') + + @app.route('/work/', methods=['GET']) def work_view(ident): return generic_entity_view('work', ident, 'work_view.html') +@app.route('/work//metadata', methods=['GET']) +def work_view_metadata(ident): + return generic_entity_view('work', ident, 'entity_view_metadata.html') + @app.route('/work/rev/', methods=['GET']) def work_revision_view(revision_id): entity = generic_get_entity_revision('work', revision_id) - return render_template('work_view.html', entity=entity, editgroup=None) + return render_template('work_view.html', entity_type='release', entity=entity, editgroup=None) + +@app.route('/work/rev//metadata', methods=['GET']) +def work_revision_view_metadata(revision_id): + entity = generic_get_entity_revision('work', revision_id) + return render_template('entity_view_metadata.html', entity_type='work', entity=entity, editgroup=None) @app.route('/editgroup//work/', methods=['GET']) def work_editgroup_view(editgroup_id, ident): return generic_editgroup_entity_view(editgroup_id, 'work', ident, 'work_view.html') +@app.route('/editgroup//work//metadata', methods=['GET']) +def work_editgroup_view_metadata(editgroup_id, ident): + return generic_editgroup_entity_view(editgroup_id, 'work', ident, 'entity_view_metadata.html') + ### Views ################################################################### diff --git a/python/fatcat_web/templates/container_view.html b/python/fatcat_web/templates/container_view.html index b86b1aa7..f945a91a 100644 --- a/python/fatcat_web/templates/container_view.html +++ b/python/fatcat_web/templates/container_view.html @@ -1,20 +1,12 @@ {% set container = entity %} +{% set entity_view = "overview" %} {% import "entity_macros.html" as entity_macros %} -{% extends "base.html" %} +{% extends "entity_base.html" %} -{% block fullbody %} +{% block entity_main %}
-
-
-

{{ container.name }} - container {{ container.ident }}

-
-
- -
-
-
+
{% if (container.extra != None) and (container.extra['urls'] != None) and (container.extra['urls']|length > 0) %}
@@ -39,15 +31,8 @@ {% endif %} - -{% if entity.extra %} -

Extra Metadata (raw JSON)

- {{ entity_macros.extra_metadata(entity.extra) }} -{% endif %} - -
-
+
{% if container._es and container._es.is_oa == True %} diff --git a/python/fatcat_web/templates/creator_view.html b/python/fatcat_web/templates/creator_view.html index 63f83917..1b550316 100644 --- a/python/fatcat_web/templates/creator_view.html +++ b/python/fatcat_web/templates/creator_view.html @@ -1,20 +1,12 @@ {% set creator = entity %} +{% set entity_view = "overview" %} {% import "entity_macros.html" as entity_macros %} -{% extends "base.html" %} +{% extends "entity_base.html" %} -{% block fullbody %} +{% block entity_main %}
-
-
-

{{ creator.display_name }} - creator {{ creator.ident }}

-
-
- -
-
-
+
{% if creator.given_name or creator.surname %} @@ -31,11 +23,6 @@
{% endif %} -{% if entity.extra != None %} -

Extra Metadata (raw JSON)

- {{ entity_macros.extra_metadata(entity.extra) }} -{% endif %} -

Releases

{% if creator._releases != [] %} @@ -46,7 +33,7 @@ This creator has not contributed to any releases. {% endif %}
-
+
{% if creator.orcid or creator.wikidata_qid %} diff --git a/python/fatcat_web/templates/entity_base.html b/python/fatcat_web/templates/entity_base.html index 0768f5a9..ba25e3f9 100644 --- a/python/fatcat_web/templates/entity_base.html +++ b/python/fatcat_web/templates/entity_base.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% macro entity_tab(name, text, url_suffix, count=None) %} -{{ text }}{% if count != None %} ({{ count }}){% endif %} +{{ text }}{% if count != None %} ({{ count }}){% endif %} {% endmacro %} {% block fullmain %} @@ -10,14 +10,35 @@

- {% if entity_type == "release" %} + {% if entity_type == "container" %} + {{ entity.name }} + {% elif entity_type == "creator" %} + {{ entity.display_name }} + {% elif entity_type == "file" %} + {% elif entity_type == "fileset" %} + {% elif entity_type == "webcapture" %} + {% if entity.original_url %} + {{ entity.original_url }} + {% endif %} + {% elif entity_type == "release" %} {{ entity.title }} {% if entity.subtitle %}
{{ entity.subtitle }} {% endif %} {% endif %} - {{ entity_type }}_{{ entity.ident }} + + {% if entity.ident %} + {{ entity_type }}_{{ entity.ident }} + {% elif entity.revision %} + {{ entity_type }}_rev_{{ entity.revision }} + {% endif %} + {% if editgroup %} + + [as of editgroup_{{ editgroup.editgroup_id }}] + + {% endif %} +

{% if entity_type == "release" %} @@ -44,10 +65,16 @@ {% endif %} {{ entity_tab("metadata", "Metadata", "/metadata") }}
- + {% if entity.ident %} + + {% endif %}
diff --git a/python/fatcat_web/templates/entity_history.html b/python/fatcat_web/templates/entity_history.html index 73a3df92..2079b464 100644 --- a/python/fatcat_web/templates/entity_history.html +++ b/python/fatcat_web/templates/entity_history.html @@ -1,5 +1,4 @@ {% set entity_view = "history" %} -{% set entity_type = "release" %} {% extends "entity_base.html" %} {% block entity_main %} diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html index 1d798dfb..4b70651f 100644 --- a/python/fatcat_web/templates/entity_macros.html +++ b/python/fatcat_web/templates/entity_macros.html @@ -1,16 +1,24 @@ {% macro fatcat_bits(entity, entity_type, expand="", editgroup=None) -%} -{% if entity.state == None and editgroup.editgroup_id %} -
- Edit In Progress -

You are viewing this entity as of a specific editgroup (which may or may not have been merged yet): - {{ editgroup.editgroup_id }} -

+{% if entity.state == None and editgroup %} +
+ {% if editgroup.changelog_index %} + Accepted Edit Version +

This is the version of the entity as of a specific merged editgroup: + {% elif editgroup.submitted %} + Submitted Edit Version +

This is a version of the entity that has been submitted for approval as part of an editgroup: + {% else %} + Edit In Progress +

This is a version of the entity that has not yet been submitted for approval, part of an editgroup: + {% endif %} + {{ editgroup.editgroup_id }} +

{% elif entity.state == None and entity.ident == None %}
Revision -

You are viewing a specific revision of an entity. +

This is a specific, static metadata record, not necessarily linked to any current entity in the catalog.

{% elif entity.state == "wip" %}
@@ -21,10 +29,13 @@
Fatcat Bits -

State is "{{ entity.state }}". +

+ {% if entity.state %} + State is "{{ entity.state }}". + {% endif %} {% if entity.state != "deleted" %} Revision: -
{{ entity.revision }} +
{{ entity.revision }} {% endif %}
As JSON object via API

diff --git a/python/fatcat_web/templates/entity_metadata.html b/python/fatcat_web/templates/entity_metadata.html deleted file mode 100644 index 5ce97d10..00000000 --- a/python/fatcat_web/templates/entity_metadata.html +++ /dev/null @@ -1,16 +0,0 @@ -{% set entity_view = "metadata" %} -{% import "entity_macros.html" as entity_macros %} -{% extends "entity_base.html" %} - -{% block entity_main %} - -{% if entity.extra %} -

Extra Metadata (raw JSON)

- {{ entity_macros.extra_metadata(entity.extra) }} -{% endif %} - -

Entity Metadata (schema)

-{{ entity_macros.extra_metadata(entity._metadata) }} - -{% endblock %} - diff --git a/python/fatcat_web/templates/entity_view_metadata.html b/python/fatcat_web/templates/entity_view_metadata.html new file mode 100644 index 00000000..5ce97d10 --- /dev/null +++ b/python/fatcat_web/templates/entity_view_metadata.html @@ -0,0 +1,16 @@ +{% set entity_view = "metadata" %} +{% import "entity_macros.html" as entity_macros %} +{% extends "entity_base.html" %} + +{% block entity_main %} + +{% if entity.extra %} +

Extra Metadata (raw JSON)

+ {{ entity_macros.extra_metadata(entity.extra) }} +{% endif %} + +

Entity Metadata (schema)

+{{ entity_macros.extra_metadata(entity._metadata) }} + +{% endblock %} + diff --git a/python/fatcat_web/templates/file_view.html b/python/fatcat_web/templates/file_view.html index 39ffaaa0..d60ea49d 100644 --- a/python/fatcat_web/templates/file_view.html +++ b/python/fatcat_web/templates/file_view.html @@ -1,25 +1,12 @@ {% set file = entity %} +{% set entity_view = "overview" %} {% import "entity_macros.html" as entity_macros %} -{% extends "base.html" %} +{% extends "entity_base.html" %} -{% block fullbody %} +{% block entity_main %}
-
-
-

- file {{ file.ident }}

-
-
- -
-
-
- -{% if entity.extra %} -

Extra Metadata (raw JSON)

- {{ entity_macros.extra_metadata(entity.extra) }} -{% endif %} +

Releases

{% if entity.releases != [] %} @@ -55,7 +42,7 @@ No known public URL, mirror, or archive for this file.
-
+
{% if file.urls != None and file.urls != [] %} Download File @@ -80,5 +67,4 @@ No known public URL, mirror, or archive for this file.
- {% endblock %} diff --git a/python/fatcat_web/templates/fileset_view.html b/python/fatcat_web/templates/fileset_view.html index 7bc46d45..27d5b6da 100644 --- a/python/fatcat_web/templates/fileset_view.html +++ b/python/fatcat_web/templates/fileset_view.html @@ -1,25 +1,12 @@ {% set fileset = entity %} +{% set entity_view = "overview" %} {% import "entity_macros.html" as entity_macros %} -{% extends "base.html" %} +{% extends "entity_base.html" %} -{% block fullbody %} +{% block entity_main %}
-
-
-

- fileset {{ entity.ident }}

-
-
- -
-
-
- -{% if entity.extra %} -

Extra Metadata (raw JSON)

- {{ entity_macros.extra_metadata(entity.extra) }} -{% endif %} +

Releases

{% if entity.releases != [] %} @@ -62,7 +49,7 @@ No known public URL, mirror, or archive for this File Set. {% endif %}
-
+
{% if fileset._total_size != None %}
@@ -75,5 +62,4 @@ No known public URL, mirror, or archive for this File Set.
- {% endblock %} diff --git a/python/fatcat_web/templates/release_contribs.html b/python/fatcat_web/templates/release_contribs.html deleted file mode 100644 index 55cdf133..00000000 --- a/python/fatcat_web/templates/release_contribs.html +++ /dev/null @@ -1,34 +0,0 @@ -{% set release = entity %} -{% set entity_view = "contribs" %} -{% set entity_type = "release" %} -{% import "entity_macros.html" as entity_macros %} -{% extends "entity_base.html" %} - -{% block entity_main %} - -{% if release.contribs|length > 0 %} - - -{% for contrib in release.contribs %} - -
{% if contrib.index or contrib.index == 0 %} {{ contrib.index + 1 }}{% endif %} -
{{ contrib.role or 'unknown' }} -{% endfor %} -
-{% else %} -

No known contributors (authors, translators, etc). -{% endif %} - -{% endblock %} - diff --git a/python/fatcat_web/templates/release_references.html b/python/fatcat_web/templates/release_references.html deleted file mode 100644 index 22ebaddf..00000000 --- a/python/fatcat_web/templates/release_references.html +++ /dev/null @@ -1,44 +0,0 @@ -{% set release = entity %} -{% set entity_view = "references" %} -{% set entity_type = "release" %} -{% import "entity_macros.html" as entity_macros %} -{% extends "entity_base.html" %} - -{% block entity_main %} - -{% if release.refs != None and release.refs.size != 0 %} -

References

-This release citing other releases -{# see https://github.com/Semantic-Org/Semantic-UI/issues/2639 #} -
    - {% for ref in release.refs %} -
  1. - {% if ref.title %} - {{ ref.title }} - {% if ref.container_name %}{{ ref.container_name }}.{% endif %} - {% if ref.year %}{{ ref.year }}{% endif %} - {% if ref.locator %}{{ ref.locator }}{% endif %} - {% 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 %} - {% if ref.extra.unstructured %}{{ ref.extra.unstructured }}{% endif %} - {% else %} - unknown - {% endif %} - {% if ref.target_release_id != None %} - (fatcat entry) - {% endif %} - {% if ref.extra != None and ref.extra.doi %} - (DOI: {{ ref.extra.doi }}) - {% endif %} -
  2. - {% endfor %} -
-{% else %} -

No reference list available. -{% endif %} - -{% endblock %} - diff --git a/python/fatcat_web/templates/release_view.html b/python/fatcat_web/templates/release_view.html index 2212741a..5b019b3c 100644 --- a/python/fatcat_web/templates/release_view.html +++ b/python/fatcat_web/templates/release_view.html @@ -246,7 +246,7 @@ Download Full Text {% elif entity.state == 'active' and entity.webcaptures != [] and entity.webcaptures[0].archive_urls != [] and entity.webcaptures[0].archive_urls[0].rel == "wayback" %} View Web Archive -{% else %} +{% elif entity.state == 'active' %} No Full Text Available {% endif %} @@ -390,6 +390,7 @@

+ {% endblock %} {% block postscript %} diff --git a/python/fatcat_web/templates/release_view_contribs.html b/python/fatcat_web/templates/release_view_contribs.html new file mode 100644 index 00000000..55cdf133 --- /dev/null +++ b/python/fatcat_web/templates/release_view_contribs.html @@ -0,0 +1,34 @@ +{% set release = entity %} +{% set entity_view = "contribs" %} +{% set entity_type = "release" %} +{% import "entity_macros.html" as entity_macros %} +{% extends "entity_base.html" %} + +{% block entity_main %} + +{% if release.contribs|length > 0 %} + + +{% for contrib in release.contribs %} + +
{% if contrib.index or contrib.index == 0 %} {{ contrib.index + 1 }}{% endif %} +
{{ contrib.role or 'unknown' }} +{% endfor %} +
+{% else %} +

No known contributors (authors, translators, etc). +{% endif %} + +{% endblock %} + diff --git a/python/fatcat_web/templates/release_view_references.html b/python/fatcat_web/templates/release_view_references.html new file mode 100644 index 00000000..22ebaddf --- /dev/null +++ b/python/fatcat_web/templates/release_view_references.html @@ -0,0 +1,44 @@ +{% set release = entity %} +{% set entity_view = "references" %} +{% set entity_type = "release" %} +{% import "entity_macros.html" as entity_macros %} +{% extends "entity_base.html" %} + +{% block entity_main %} + +{% if release.refs != None and release.refs.size != 0 %} +

References

+This release citing other releases +{# see https://github.com/Semantic-Org/Semantic-UI/issues/2639 #} +
    + {% for ref in release.refs %} +
  1. + {% if ref.title %} + {{ ref.title }} + {% if ref.container_name %}{{ ref.container_name }}.{% endif %} + {% if ref.year %}{{ ref.year }}{% endif %} + {% if ref.locator %}{{ ref.locator }}{% endif %} + {% 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 %} + {% if ref.extra.unstructured %}{{ ref.extra.unstructured }}{% endif %} + {% else %} + unknown + {% endif %} + {% if ref.target_release_id != None %} + (fatcat entry) + {% endif %} + {% if ref.extra != None and ref.extra.doi %} + (DOI: {{ ref.extra.doi }}) + {% endif %} +
  2. + {% endfor %} +
+{% else %} +

No reference list available. +{% endif %} + +{% endblock %} + diff --git a/python/fatcat_web/templates/webcapture_view.html b/python/fatcat_web/templates/webcapture_view.html index b5495cee..16e5c03e 100644 --- a/python/fatcat_web/templates/webcapture_view.html +++ b/python/fatcat_web/templates/webcapture_view.html @@ -1,29 +1,12 @@ {% set webcapture = entity %} +{% set entity_view = "overview" %} {% import "entity_macros.html" as entity_macros %} -{% extends "base.html" %} +{% extends "entity_base.html" %} -{% block fullbody %} +{% block entity_main %}

-
-
-

- {% if webcapture.original_url %} - {{ webcapture.original_url }} - {% endif %} - webcapture {{ webcapture.ident }}

-
-
- -
-
-
- - -{% if entity.extra %} -

Extra Metadata (raw JSON)

- {{ entity_macros.extra_metadata(entity.extra) }} -{% endif %} +

Releases

{% if entity.releases != [] %} @@ -70,7 +53,7 @@ This web capture is empty (contains no resources). {% endif %}
-
+
{% if webcapture.timestamp != None %}
@@ -83,5 +66,4 @@ This web capture is empty (contains no resources).
- {% endblock %} diff --git a/python/fatcat_web/templates/work_view.html b/python/fatcat_web/templates/work_view.html index aa32ba39..3e976597 100644 --- a/python/fatcat_web/templates/work_view.html +++ b/python/fatcat_web/templates/work_view.html @@ -1,25 +1,12 @@ {% set work = entity %} +{% set entity_view = "overview" %} {% import "entity_macros.html" as entity_macros %} -{% extends "base.html" %} +{% extends "entity_base.html" %} -{% block fullbody %} +{% block entity_main %}
-
-
-

- work {{ work.ident }}

-
-
- -
-
-
- -{% if entity.extra != None %} -

Extra Metadata (raw JSON)

- {{ entity_macros.extra_metadata(entity.extra) }} -{% endif %} +

Releases

{% if work._releases != [] and work._releases != None %} @@ -39,8 +26,7 @@ pre-print and a published article may contain small differences, but still reference the same underlying "work".
- -
+
{{ entity_macros.fatcat_bits(entity, "work", "", editgroup) }} -- cgit v1.2.3