diff options
Diffstat (limited to 'python/fatcat_web')
-rw-r--r-- | python/fatcat_web/templates/creator_view.html | 28 | ||||
-rw-r--r-- | python/fatcat_web/templates/entity_macros.html | 51 | ||||
-rw-r--r-- | python/fatcat_web/templates/file_view.html | 49 | ||||
-rw-r--r-- | python/fatcat_web/templates/release_view.html | 3 | ||||
-rw-r--r-- | python/fatcat_web/templates/work_view.html | 35 |
5 files changed, 67 insertions, 99 deletions
diff --git a/python/fatcat_web/templates/creator_view.html b/python/fatcat_web/templates/creator_view.html index 16f74f0a..0ddb6899 100644 --- a/python/fatcat_web/templates/creator_view.html +++ b/python/fatcat_web/templates/creator_view.html @@ -31,37 +31,15 @@ </table> {% endif %} -{% if creator.extra != None %} -<h3>Extra Metadata (raw JSON)</h3> - <table class="ui definition single line fixed compact small unstackable table"> - <tbody> - {% for (key, value) in release.extra.items() %} - <tr><td class="three wide right aligned"><code>{{ key }}</code></td> - <td class="seven wide"><code>{{ value }}</code> - {% endfor %} - </tbody> - </table> +{% if entity.extra != None %} + {{ entity_macros.extra_metadata(entity.extra) }} {% endif %} <br> <h3>Releases</h3> {% if releases != [] %} <p>This creator has contributed to: - <table class="ui very basic celled table"> - <tbody> - {% for release in releases %} - <tr><td class="two wide center aligned"> - {% if release.release_date %}{{ release.release_date }}{% elif release.release_year %}{{ release.release_year }}{% endif %} - <td class="five wide single line"> - <b><a href="/release/{{ release.ident }}">{{ release.title }}</a></b> - <br>{{ release.release_type or "unknown" }} - {{ release.release_status or "unknown" }} - {% if release.license_slug %} - {{ release.license_slug }}{% endif %} - {% if release.doi %} - <br><a href="https://doi.org/{{ release.doi }}" style="color:green;">doi:{{ release.doi }}</a> - {% endif %} - {% endfor %} - </tbody> - </table> + {{ entity_macros.release_list(releases) }} {% else %} This creator has not contributed to any releases. {% endif %} diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html index f714a63a..2a4752f2 100644 --- a/python/fatcat_web/templates/entity_macros.html +++ b/python/fatcat_web/templates/entity_macros.html @@ -12,3 +12,54 @@ <a href="/{{ entity_type }}/{{ entity.ident }}/history" class="ui button">View History</a> </div> {%- endmacro %} + + +{% macro extra_metadata(extra) -%} +<h3>Extra Metadata (raw JSON)</h3> +<table class="ui definition single line fixed compact small unstackable table"> +<tbody> +{% for (key, value) in extra.items() %} + <tr><td class="three wide right aligned"><code>{{ key }}</code></td> + <td class="seven wide"><code>{{ value }}</code> +{% endfor %} +</tbody> +</table> +{%- endmacro %} + + +{% macro release_list(releases) -%} +<table class="ui very basic celled table"> +<tbody> +{% for release in releases %} + <tr><td class="collapsing center aligned"> + {% if release.release_date %}{{ release.release_date }}{% elif release.release_year %}{{ release.release_year }}{% endif %} + <td class=""> + <b><a href="/release/{{ release.ident }}">{{ release.title }}</a></b> + <br>{{ release.release_status or "unknown status" }} + | {{ release.release_type or "unknown type" }} + {% if release.license_slug %} | {{ release.license_slug }}{% endif %} + {% if release.doi %} + <br><a href="https://doi.org/{{ release.doi }}" style="color:green;">doi:{{ release.doi }}</a> + {% endif %} +{% endfor %} +</tbody> +</table> +{%- endmacro %} + + +{% macro url_list(urls) -%} +<table class="ui very basic compact single line fixed table"> +<tbody> + {% for url in urls %} + <tr><td class="two wide right aligned">{{ url.rel }} + <td class="eight wide"><small><code><a href="{{ url.url }}"> + {% if url.url.count('/') >= 3 %} + {{ '/'.join(url.url.split('/')[0:2]) }}/<b>{{ ''.join(url.url.split('/')[2]) }}</b>/{{ '/'.join(url.url.split('/')[3:]) }} + {% else %} + {{ url.url }} + {% endif %} + </a></code></small> + {% endfor %} +</tbody> +</table> +{%- endmacro %} diff --git a/python/fatcat_web/templates/file_view.html b/python/fatcat_web/templates/file_view.html index 4bb6d75a..7f516e01 100644 --- a/python/fatcat_web/templates/file_view.html +++ b/python/fatcat_web/templates/file_view.html @@ -16,57 +16,22 @@ <div class="one wide column"></div> <div class="ten wide column" style="font-size: 16px;"> -{% if file.extra %} -<h3>Extra Metadata (raw JSON)</h3> -<table class="ui definition single line fixed compact small unstackable table"> -<tbody> -{% for (key, value) in file.extra.items() %} - <tr><td class="three wide right aligned"><code>{{ key }}</code></td> - <td class="seven wide"><code>{{ value }}</code> -{% endfor %} -</tbody> -</table> +{% if entity.extra %} + {{ entity_macros.extra_metadata(entity.extra) }} {% endif %} <h3>Releases</h3> -{% if file.releases != [] %} -<table class="ui very basic celled table"> -<tbody> -{% for release in file.releases %} - <tr><td class="two wide center aligned"> - {% if release.release_date %}{{ release.release_date }}{% elif release.release_year %}{{ release.release_year }}{% endif %} - <td class="five wide single line"> - <b><a href="/release/{{ release.ident }}">{{ release.title }}</a></b> - <br>{{ release.release_type or "unknown" }} - {{ release.release_status or "unknown" }} - {% if release.license_slug %} - {{ release.license_slug }}{% endif %} - {% if release.doi %} - <br><a href="https://doi.org/{{ release.doi }}" style="color:green;">doi:{{ release.doi }}</a> - {% endif %} -{% endfor %} -</tbody> -</table> +{% if entity.releases != [] %} + {{ entity_macros.release_list(entity.releases) }} {% else %} -<p> -This file is not associated with any fatcat release. + <p> + This file is not associated with any fatcat release. {% endif %} <h3>URLs</h3> {% if file.urls != None %} -<table class="ui very basic compact single line fixed table"> -<tbody> - {% for url in file.urls %} - <tr><td class="two wide right aligned">{{ url.rel }} - <td class="eight wide"><small><code><a href="{{ url.url }}"> - {% if url.url.count('/') >= 3 %} - {{ '/'.join(url.url.split('/')[0:2]) }}/<b>{{ ''.join(url.url.split('/')[2]) }}</b>/{{ '/'.join(url.url.split('/')[3:]) }} - {% else %} - {{ url.url }} - {% endif %} - </a></code></small> - {% endfor %} -</tbody> -</table> + {{ entity_macros.url_list(file.urls) }} {% else %} No known public URL, mirror, or archive for this file. {% endif %} diff --git a/python/fatcat_web/templates/release_view.html b/python/fatcat_web/templates/release_view.html index 5b4236cf..ca09f1b9 100644 --- a/python/fatcat_web/templates/release_view.html +++ b/python/fatcat_web/templates/release_view.html @@ -269,8 +269,7 @@ This release citing other releases. {% endif %} {% if container.es.in_kbart == True %} <i class="icon check green"></i> In <a href="https://thekeepers.org/purl/issn/{{ container.issnl }}">Keepers Registery</a><br> - {% elif container.es.in_kbart == False %} - <i class="icon times grey"></i> Not in <a href="https://thekeepers.org/journals?query={{ container.issnl }}">Keepers Registry</a><br> + {% elif container.es.in_kbart == False %} <i class="icon times grey"></i> Not in <a href="https://thekeepers.org/journals?query={{ container.issnl }}">Keepers Registry</a><br> {% endif %} {% endif %} {% if container.issnl != None %} diff --git a/python/fatcat_web/templates/work_view.html b/python/fatcat_web/templates/work_view.html index 6a409542..7fd2bbb2 100644 --- a/python/fatcat_web/templates/work_view.html +++ b/python/fatcat_web/templates/work_view.html @@ -16,44 +16,19 @@ <div class="one wide column"></div> <div class="ten wide column" style="font-size: 16px;"> -{% if work.extra != None %} -<h3>Extra Metadata (raw JSON)</h3> -{% for (key, value) in work.extra.items() %} -<code><b>{{ key }}:</b> {{ value }}</code><br> -{% endfor %} +{% if entity.extra != None %} + {{ entity_macros.extra_metadata(entity.extra) }} {% endif %} <h3>Releases</h3> {% if releases != [] %} -<table class="ui very basic celled table"> -<tbody> -{% for release in releases %} - <tr><td class="two wide center aligned"> - {% if release.release_date %}{{ release.release_date }}{% elif release.release_year %}{{ release.release_year }}{% endif %} - <td class="five wide single line"> - <b><a href="/release/{{ release.ident }}">{{ release.title }}</a></b> - <br>{{ release.release_type or "unknown" }} - {{ release.release_status or "unknown" }} - {% if release.license_slug %} - {{ release.license_slug }}{% endif %} - {% if release.doi %} - <br><a href="https://doi.org/{{ release.doi }}" style="color:green;">doi:{{ release.doi }}</a> - {% endif %} -{% endfor %} -</tbody> -</table> + {{ entity_macros.release_list(releases) }} {% else %} <p>There are no known releases associated with this work. {% endif %} -{% if work.extra %} -<h3>Extra Metadata (raw JSON)</h3> -<table class="ui definition single line fixed compact small unstackable table"> -<tbody> -{% for (key, value) in work.extra.items() %} - <tr><td class="three wide right aligned"><code>{{ key }}</code></td> - <td class="seven wide"><code>{{ value }}</code> -{% endfor %} -</tbody> -</table> +{% if entity.extra %} + {{ entity_macros.extra_metadata(entity.extra) }} {% endif %} <h3>What is a "Work"?</h3> |