From 404f6ff6d542dc6dc61395cdb25646e3a69eb061 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 13 Jun 2019 14:24:16 -0700 Subject: implement major refactor for other entity types --- python/fatcat_web/templates/changelog_view.html | 1 + python/fatcat_web/templates/container_edit.html | 3 +- python/fatcat_web/templates/container_view.html | 34 +++++----- python/fatcat_web/templates/creator_view.html | 8 +-- python/fatcat_web/templates/editgroup_view.html | 2 +- python/fatcat_web/templates/file_edit.html | 8 +-- python/fatcat_web/templates/file_view.html | 4 +- python/fatcat_web/templates/fileset_view.html | 8 +-- python/fatcat_web/templates/release_edit.html | 8 +-- python/fatcat_web/templates/release_view.html | 80 +++++++++++++----------- python/fatcat_web/templates/webcapture_view.html | 6 +- python/fatcat_web/templates/work_view.html | 8 +-- 12 files changed, 87 insertions(+), 83 deletions(-) (limited to 'python/fatcat_web/templates') diff --git a/python/fatcat_web/templates/changelog_view.html b/python/fatcat_web/templates/changelog_view.html index 8c4684d5..5b403b09 100644 --- a/python/fatcat_web/templates/changelog_view.html +++ b/python/fatcat_web/templates/changelog_view.html @@ -1,3 +1,4 @@ +{% set auth_to = {} %} {% extends "editgroup_view.html" %} {% block editgroupheader %} diff --git a/python/fatcat_web/templates/container_edit.html b/python/fatcat_web/templates/container_edit.html index 91432d5e..238335b4 100644 --- a/python/fatcat_web/templates/container_edit.html +++ b/python/fatcat_web/templates/container_edit.html @@ -10,7 +10,7 @@ {% endblock %} {{ form.hidden_tag() }} -

Editgroup

+

Editgroup Metadata

{{ edit_macros.editgroup_dropdown(form, editgroup, potential_editgroups) }}

The Basics

@@ -70,7 +70,6 @@ $(document).ready(function() { - $('.ui.accordion').accordion(); $('.ui.dropdown') .dropdown(); var fixup_url_numbering = function(group_item) { diff --git a/python/fatcat_web/templates/container_view.html b/python/fatcat_web/templates/container_view.html index ef4335fb..b86b1aa7 100644 --- a/python/fatcat_web/templates/container_view.html +++ b/python/fatcat_web/templates/container_view.html @@ -1,4 +1,4 @@ -{% set entity = container %} +{% set container = entity %} {% import "entity_macros.html" as entity_macros %} {% extends "base.html" %} @@ -50,9 +50,9 @@
-{% if container.es and container.es.is_oa == True %} +{% if container._es and container._es.is_oa == True %} Open Access Publisher -{% elif container.es and container.es.is_oa == False %} +{% elif container._es and container._es.is_oa == False %} Not Open Access {% else %} Unknown OA Status @@ -77,37 +77,37 @@
{% endif %} -{% if container_stats %} +{% if container._stats %} Release Counts
- {{ "{:,}".format(container_stats.total) }} total - {% if container_stats.total >= 1 %} -
{{ "{:,}".format(container_stats.is_preserved) }} - ({{ "{:.1f}".format(container_stats.is_preserved/container_stats.total*100) }}%) + {{ "{:,}".format(container._stats.total) }} total + {% if container._stats.total >= 1 %} +
{{ "{:,}".format(container._stats.is_preserved) }} + ({{ "{:.1f}".format(container._stats.is_preserved/container._stats.total*100) }}%) preserved or archived -
{{ "{:,}".format(container_stats.in_web) }} - ({{ "{:.1f}".format(container_stats.in_web/container_stats.total*100) }}%) +
{{ "{:,}".format(container._stats.in_web) }} + ({{ "{:.1f}".format(container._stats.in_web/container._stats.total*100) }}%) fulltext available to read {% endif %}
{% endif %} -{% if (container.es and container.es != None) %} +{% if (container._es and container._es != None) %} Directory Listings
- {% if container.es.in_doaj == True %} + {% if container._es.in_doaj == True %} In DOAJ
- {% elif container.es.in_doaj == False %} + {% elif container._es.in_doaj == False %} Not in DOAJ
{% endif %} - {% if container.es.in_road == True %} + {% if container._es.in_road == True %} In ISSN ROAD
- {% elif container.es.in_road == False %} + {% elif container._es.in_road == False %} Not in ISSN ROAD
{% endif %} - {% if container.es.in_kbart == True %} + {% if container._es.in_kbart == True %} In Keepers Registery
- {% elif container.es.in_kbart == False %} + {% elif container._es.in_kbart == False %} Not in Keepers Registry
{% endif %} diff --git a/python/fatcat_web/templates/creator_view.html b/python/fatcat_web/templates/creator_view.html index 63308a51..63f83917 100644 --- a/python/fatcat_web/templates/creator_view.html +++ b/python/fatcat_web/templates/creator_view.html @@ -1,4 +1,4 @@ -{% set entity = creator %} +{% set creator = entity %} {% import "entity_macros.html" as entity_macros %} {% extends "base.html" %} @@ -38,9 +38,9 @@

Releases

-{% if releases != [] %} +{% if creator._releases != [] %}

This creator has contributed to: - {{ entity_macros.release_list(releases) }} + {{ entity_macros.release_list(creator._releases) }} {% else %} This creator has not contributed to any releases. {% endif %} @@ -68,7 +68,7 @@ This creator has not contributed to any releases.
Google Scholar

-{{ entity_macros.fatcat_bits(entity, "creator", "") }} +{{ entity_macros.fatcat_bits(entity, "creator", "", editgroup) }}
diff --git a/python/fatcat_web/templates/editgroup_view.html b/python/fatcat_web/templates/editgroup_view.html index 41434a42..2b56d838 100644 --- a/python/fatcat_web/templates/editgroup_view.html +++ b/python/fatcat_web/templates/editgroup_view.html @@ -23,7 +23,7 @@ updated {% endif %} [view edit] - {% if auth_to.edit and not editgroup.changelog_index and not editgroup.submitted %} + {% if auth_to.edit and not editgroup.changelog_index and not editgroup.submitted and entity_type in ('release', 'file', 'container') %} [re-edit]
diff --git a/python/fatcat_web/templates/file_edit.html b/python/fatcat_web/templates/file_edit.html index bef80ee3..74a5682a 100644 --- a/python/fatcat_web/templates/file_edit.html +++ b/python/fatcat_web/templates/file_edit.html @@ -6,12 +6,12 @@

Edit File Entity

- + {% endblock %} {{ form.hidden_tag() }} -
- {{ edit_macros.editgroup_dropdown(form) }} +

Editgroup Metadata

+ {{ edit_macros.editgroup_dropdown(form, editgroup, potential_editgroups) }}

File Metadata

@@ -103,7 +103,7 @@ $(document).ready(function() { - $('.ui.accordion').accordion(); + $('.ui.dropdown') .dropdown(); var fixup_url_numbering = function(group_item) { items = Array.from(group_item.querySelectorAll(".list-group-item")) diff --git a/python/fatcat_web/templates/file_view.html b/python/fatcat_web/templates/file_view.html index 097ee5f6..39ffaaa0 100644 --- a/python/fatcat_web/templates/file_view.html +++ b/python/fatcat_web/templates/file_view.html @@ -1,4 +1,4 @@ -{% set entity = file %} +{% set file = entity %} {% import "entity_macros.html" as entity_macros %} {% extends "base.html" %} @@ -75,7 +75,7 @@ No known public URL, mirror, or archive for this file.
{% endif %} -{{ entity_macros.fatcat_bits(entity, "file", "") }} +{{ entity_macros.fatcat_bits(entity, "file", "", editgroup) }} diff --git a/python/fatcat_web/templates/fileset_view.html b/python/fatcat_web/templates/fileset_view.html index 7f41e617..7bc46d45 100644 --- a/python/fatcat_web/templates/fileset_view.html +++ b/python/fatcat_web/templates/fileset_view.html @@ -1,4 +1,4 @@ -{% set entity = fileset %} +{% set fileset = entity %} {% import "entity_macros.html" as entity_macros %} {% extends "base.html" %} @@ -64,13 +64,13 @@ No known public URL, mirror, or archive for this File Set.
-{% if fileset.total_size != None %} +{% if fileset._total_size != None %}
-

Total Size  {{ fileset.total_size|filesizeformat }} +

Total Size  {{ fileset._total_size|filesizeformat }}

{% endif %} -{{ entity_macros.fatcat_bits(entity, "fileset", "") }} +{{ entity_macros.fatcat_bits(entity, "fileset", "", editgroup) }}
diff --git a/python/fatcat_web/templates/release_edit.html b/python/fatcat_web/templates/release_edit.html index b3beec2b..9a4cf80d 100644 --- a/python/fatcat_web/templates/release_edit.html +++ b/python/fatcat_web/templates/release_edit.html @@ -6,12 +6,12 @@

Edit Release Entity

- + {% endblock %} {{ form.hidden_tag() }} -
- {{ edit_macros.editgroup_dropdown(form) }} +

Editgroup Metadata

+ {{ edit_macros.editgroup_dropdown(form, editgroup, potential_editgroups) }}

The Basics

@@ -134,7 +134,7 @@ $(document).ready(function() { // form focusing (eg, for required fields) :( //$('#release_type').dropdown(); //$('#release_stage').dropdown(); - $('.ui.accordion').accordion(); + $('.ui.dropdown') .dropdown(); var fixup_contrib_numbering = function(group_item) { items = Array.from(group_item.querySelectorAll(".list-group-item")) diff --git a/python/fatcat_web/templates/release_view.html b/python/fatcat_web/templates/release_view.html index a5977166..5fdc2244 100644 --- a/python/fatcat_web/templates/release_view.html +++ b/python/fatcat_web/templates/release_view.html @@ -1,4 +1,4 @@ -{% set entity = release %} +{% set release = entity %} {% import "entity_macros.html" as entity_macros %} {% extends "base.html" %} @@ -19,7 +19,7 @@ {% endif %} - {% for author in authors %} + {% for author in release._authors %} {% endfor %} @@ -89,15 +89,16 @@

- {% if authors != [] %} by {% endif %} - {% for contrib in authors[:12] %} + {% if release._authors != [] %} by {% endif %} + {% for contrib in release._authors[:12] %} {% if contrib.creator_id %} {{ contrib.raw_name }}{% if not loop.last %}, {% endif %} {% else %} {% if contrib.raw_name != None %}{{ contrib.raw_name }}{% else %}Unknown{% endif %}{% if not loop.last %}, {% endif %} {% endif %} {% endfor %} - {% if authors|count > 12 %} (+{{ authors|length - 12 }} others) + {% if release._authors|count > 12 %} + (+{{ release._authors|length - 12 }} others) {% endif %}

@@ -109,10 +110,10 @@
{% if release.release_stage == 'published' %} - Published in {{ container.name }} + Published in {{ release.container.name }} {% else %} Released as a {{ release.release_type }} - {% if container %} in {{ container.name }} {% endif %} + {% if release.container %} in {{ release.container.name }} {% endif %} {% endif %} {% if release.publisher %} by {{ release.publisher }} @@ -128,9 +129,9 @@ Version {{ release.version }} {% endif %} - {% if container != None and container.issnl != None %} + {% if release.container != None and release.container.issnl != None %} ISSN-L - {{ container.issnl }} + {{ release.container.issnl }} {% endif %} {% if release.volume != None %} @@ -154,9 +155,9 @@ Release Year {{ release.release_year }} {% endif %} - {% if container != None and container.container_type != None %} + {% if release.container != None and release.container.container_type != None %} Container Type - {{ container.container_type }} + {{ release.container.container_type }} {% endif %} {% if release.publisher != None %} Publisher @@ -215,7 +216,7 @@ {{ entity_macros.extra_metadata(entity.extra) }} {% endif %} - +{% if entity.status == 'active' %}

Known Files and URLs

{% if entity.files != [] %} @@ -251,14 +252,15 @@

There are no known files associated with this release (you could try other releases for this work?). {% endif %} +{% endif %} - +{% if entity.status == 'active' %} {% if entity.filesets != [] %}

File Sets

{% for fileset in entity.filesets %} -
{{ fileset.manifest|count }} files  {{ fileset.total_size|filesizeformat }} +
{{ fileset.manifest|count }} files  {{ fileset._total_size|filesizeformat }}
fileset:{{ fileset.ident }}
{% for url in fileset.urls[:5] %} @@ -275,8 +277,9 @@
{% endif %} +{% endif %} - +{% if entity.status == 'active' %} {% if entity.webcaptures != [] %}

Web Captures

@@ -287,7 +290,7 @@
webcapture:{{ webcapture.ident }}
{% for url in webcapture.archive_urls[:5] %} - {{ url.url.split('/')[2] }} ({{ url.rel }})
+ {{ url.url.split('/')[2] }} ({{ url.rel }})
{% endfor %} {% if webcapture.urls|length > 5 %} + {{ file.urls|length - 5 }} more URLs @@ -296,6 +299,7 @@
{% endif %} +{% endif %} {% if release.refs != None and release.refs.size != 0 %} @@ -335,10 +339,10 @@
-{% if entity.files != [] and entity.files[0].urls != [] %} +{% if entity.status == 'active' and entity.files != [] and entity.files[0].urls != [] %} Download Full Text -{% elif entity.webcaptures != [] and entity.webcaptures[0].archive_urls != [] and entity.webcaptures[0].archive_urls[0].rel == "wayback" %} -View Web Archive +{% elif entity.status == 'active' and entity.webcaptures != [] and entity.webcaptures[0].archive_urls != [] and entity.webcaptures[0].archive_urls[0].rel == "wayback" %} +View Web Archive {% else %} No Full Text Available {% endif %} @@ -401,36 +405,36 @@
{% endif %} -{% if container != None and container.es %} +{% if release.container != None and release.container._es %}
Container Metadata
-{% if container.es.is_oa == True %} +{% if release.container._es.is_oa == True %} Open Access Publication
-{% elif container.es.is_oa == False %} +{% elif release.container._es.is_oa == False %} Not Open Access
{% else %} Unknown OA Status
{% endif %} -{% if (container.es != None) %} - {% if container.es.in_doaj == True %} - In DOAJ
- {% elif container.es.in_doaj == False %} +{% if (release.container._es != None) %} + {% if release.container._es.in_doaj == True %} + In DOAJ
+ {% elif release.container._es.in_doaj == False %} Not in DOAJ
{% endif %} - {% if container.es.in_road == True %} - In ISSN ROAD
- {% elif container.es.in_road == False %} + {% if release.container._es.in_road == True %} + In ISSN ROAD
+ {% elif release.container._es.in_road == False %} Not in ISSN ROAD
{% endif %} - {% if container.es.in_kbart == True %} - In Keepers Registery
- {% elif container.es.in_kbart == False %} Not in Keepers Registry
+ {% if release.container._es.in_kbart == True %} + In Keepers Registery
+ {% elif release.container._es.in_kbart == False %} Not in Keepers Registry
{% endif %} {% endif %} -{% if container.issnl != None %} - ISSN-L:  {{ container.issnl }}
+{% if release.container.issnl != None %} + ISSN-L:  {{ release.container.issnl }}
{% endif %} - Fatcat Entry + Fatcat Entry
{% endif %} @@ -457,8 +461,8 @@
Lookup Links
- {% if container != None and container.issnl != None %} - SHERPA/RoMEO (journal policies)
+ {% if release.container != None and release.container.issnl != None %} + SHERPA/RoMEO (journal policies)
{% endif %} {% if release != None and release.ext_ids.doi != None %} oaDOI/unpaywall
@@ -479,7 +483,7 @@
-{{ entity_macros.fatcat_bits(entity, "release", "container,files,filesets,webcaptures") }} +{{ entity_macros.fatcat_bits(entity, "release", "container,files,filesets,webcaptures", editgroup) }}
diff --git a/python/fatcat_web/templates/webcapture_view.html b/python/fatcat_web/templates/webcapture_view.html index 9020bf63..b5495cee 100644 --- a/python/fatcat_web/templates/webcapture_view.html +++ b/python/fatcat_web/templates/webcapture_view.html @@ -1,4 +1,4 @@ -{% set entity = webcapture %} +{% set webcapture = entity %} {% import "entity_macros.html" as entity_macros %} {% extends "base.html" %} @@ -36,7 +36,7 @@

Archive URLs

{% if webcapture.archive_urls != None %} - {{ entity_macros.url_list(webcapture.archive_urls, webcapture.wayback_suffix) }} + {{ entity_macros.url_list(webcapture.archive_urls, webcapture._wayback_suffix) }} {% else %} No known public archive for this webcapture. {% endif %} @@ -78,7 +78,7 @@ This web capture is empty (contains no resources). {% endif %} -{{ entity_macros.fatcat_bits(entity, "webcapture", "") }} +{{ entity_macros.fatcat_bits(entity, "webcapture", "", editgroup) }} diff --git a/python/fatcat_web/templates/work_view.html b/python/fatcat_web/templates/work_view.html index 507498c8..aa32ba39 100644 --- a/python/fatcat_web/templates/work_view.html +++ b/python/fatcat_web/templates/work_view.html @@ -1,4 +1,4 @@ -{% set entity = work %} +{% set work = entity %} {% import "entity_macros.html" as entity_macros %} {% extends "base.html" %} @@ -22,8 +22,8 @@ {% endif %}

Releases

-{% if releases != [] %} - {{ entity_macros.release_list(releases) }} +{% if work._releases != [] and work._releases != None %} + {{ entity_macros.release_list(work._releases) }} {% else %}

There are no known releases associated with this work. {% endif %} @@ -42,7 +42,7 @@ reference the same underlying "work".

-{{ entity_macros.fatcat_bits(entity, "work", "") }} +{{ entity_macros.fatcat_bits(entity, "work", "", editgroup) }}
-- cgit v1.2.3