From ec0d7f3b50390c2b9140ea954787d365b8d225ae Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Fri, 1 Mar 2019 15:48:10 -0800 Subject: make 'Fatcat Bits' a macro --- python/fatcat_web/templates/container_view.html | 16 ++----- python/fatcat_web/templates/creator_view.html | 16 ++----- python/fatcat_web/templates/entity_macros.html | 14 ++++++ python/fatcat_web/templates/file_view.html | 26 ++++------- python/fatcat_web/templates/release_view.html | 62 +++++++++++-------------- python/fatcat_web/templates/work_view.html | 16 ++----- 6 files changed, 65 insertions(+), 85 deletions(-) create mode 100644 python/fatcat_web/templates/entity_macros.html diff --git a/python/fatcat_web/templates/container_view.html b/python/fatcat_web/templates/container_view.html index c19d8c1c..3e69be34 100644 --- a/python/fatcat_web/templates/container_view.html +++ b/python/fatcat_web/templates/container_view.html @@ -1,4 +1,7 @@ +{% set entity = container %} +{% import "entity_macros.html" as entity_macros %} {% extends "base.html" %} + {% block fullbody %}
@@ -126,19 +129,10 @@ Raw Object: {% if not container.wikidata_qid %}
wikidata.org {% endif %} -
- -Fatcat Bits -

State is "{{ container.state }}". Revision: -
{{ container.revision }} -
As JSON object via API - -

-
- Edit Metadata - View History
+{{ entity_macros.fatcat_bits(entity, "container", "") }} + diff --git a/python/fatcat_web/templates/creator_view.html b/python/fatcat_web/templates/creator_view.html index e66fe927..03fcfc74 100644 --- a/python/fatcat_web/templates/creator_view.html +++ b/python/fatcat_web/templates/creator_view.html @@ -1,4 +1,7 @@ +{% set entity = creator %} +{% import "entity_macros.html" as entity_macros %} {% extends "base.html" %} + {% block fullbody %}
@@ -89,19 +92,10 @@ Raw Object:
VIAF
dblp (CS)
Google Scholar -
- -Fatcat Bits -

State is "{{ creator.state }}". Revision: -
{{ creator.revision }} -
As JSON object via API - -

-
- Edit Metadata - View History
+{{ entity_macros.fatcat_bits(entity, "creator", "") }} + diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html new file mode 100644 index 00000000..f714a63a --- /dev/null +++ b/python/fatcat_web/templates/entity_macros.html @@ -0,0 +1,14 @@ + +{% macro fatcat_bits(entity, entity_type, expand="") -%} +
+ Fatcat Bits +

State is "{{ entity.state }}". Revision: +
{{ entity.revision }} +
As JSON object via API +

+ +
+ Edit Metadata + View History +
+{%- endmacro %} diff --git a/python/fatcat_web/templates/file_view.html b/python/fatcat_web/templates/file_view.html index 77ecae4e..c2497040 100644 --- a/python/fatcat_web/templates/file_view.html +++ b/python/fatcat_web/templates/file_view.html @@ -1,4 +1,7 @@ +{% set entity = file %} +{% import "entity_macros.html" as entity_macros %} {% extends "base.html" %} + {% block fullbody %}
@@ -99,28 +102,19 @@ Raw Object: No Download Available {% endif %} -
- {% if file.size != None %} -

Size  {{ file.size|filesizeformat }} (bytes) -

+
+

Size  {{ file.size|filesizeformat }} (bytes) +

{% endif %} {% if file.mimetype != None %} -

File Type  {{ file.mimetype }} -

+
+

File Type  {{ file.mimetype }} +

{% endif %} -Fatcat Bits -

State is "{{ file.state }}". Revision: -
{{ file.revision }} -
As JSON object via API - -

- +{{ entity_macros.fatcat_bits(entity, "file", "") }}
diff --git a/python/fatcat_web/templates/release_view.html b/python/fatcat_web/templates/release_view.html index 6259f0e2..5b4236cf 100644 --- a/python/fatcat_web/templates/release_view.html +++ b/python/fatcat_web/templates/release_view.html @@ -1,4 +1,7 @@ +{% set entity = release %} +{% import "entity_macros.html" as entity_macros %} {% extends "base.html" %} + {% block fullbody %}
@@ -24,11 +27,10 @@
- {% if release.release_status == 'published' %} - Published in {{ container.name }} + Published in {{ container.name }} {% else %} - Released as a {{ release.release_type }} + Released as a {{ release.release_type }} {% if container %} in {{ container.name }} {% endif %} {% endif %} {% if release.publisher %} @@ -286,39 +288,29 @@ This release citing other releases.
Lookup Links
-{% if container != None and container.issnl != None %} - SHERPA/RoMEO (journal policies)
-{% endif %} -{% if container != None and container.doi != None %} - oaDOI/unpaywall
-{% endif %} -{% if release.isbn13 != None %} - Open Library
- Worldcat
-{% else %} - Worldcat
-{% endif %} -{% if release.doi %} -Crossref Metadata (via API)
-{% endif %} -wikidata.org
-CORE.ac.uk
-Semantic Scholar (CS, neuro)
-Google Scholar
+ {% if container != None and container.issnl != None %} + SHERPA/RoMEO (journal policies)
+ {% endif %} + {% if container != None and container.doi != None %} + oaDOI/unpaywall
+ {% endif %} + {% if release.isbn13 != None %} + Open Library
+ Worldcat
+ {% else %} + Worldcat
+ {% endif %} + {% if release.doi %} + Crossref Metadata (via API)
+ {% endif %} + wikidata.org
+ CORE.ac.uk
+ Semantic Scholar (CS, neuro)
+ Google Scholar
-
-Fatcat Bits -

State is "{{ release.state }}". Revision: -
{{ release.revision }} -
As JSON object via API - -

- +{{ entity_macros.fatcat_bits(entity, "release", "container,files,filesets,webcaptures") }}
@@ -326,8 +318,6 @@ This release citing other releases. {% block postscript %} {% endblock %} diff --git a/python/fatcat_web/templates/work_view.html b/python/fatcat_web/templates/work_view.html index 9a560ae4..b81293ce 100644 --- a/python/fatcat_web/templates/work_view.html +++ b/python/fatcat_web/templates/work_view.html @@ -1,4 +1,7 @@ +{% set entity = work %} +{% import "entity_macros.html" as entity_macros %} {% extends "base.html" %} + {% block fullbody %}
@@ -65,19 +68,10 @@ pre-print and a published article may contain small differences, but still reference the same underlying "work".
-
-
-Fatcat Bits -

State is "{{ work.state }}". Revision: -
{{ work.revision }} -
As JSON object via API +

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