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/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 +++--------- 16 files changed, 180 insertions(+), 230 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 (limited to 'python/fatcat_web/templates') 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