diff options
author | bnewbold <bnewbold@robocracy.org> | 2019-06-06 00:17:16 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-06-13 14:33:20 -0700 |
commit | 743940ce6075c1a1b547915a33ad8874094ae762 (patch) | |
tree | 0b1fb6f9b0105869a0d3effc37777f6f0db77122 /python/fatcat_web/templates | |
parent | ff843b1fcb73d8446c16f0aadd7a044e66e70a80 (diff) | |
download | fatcat-743940ce6075c1a1b547915a33ad8874094ae762.tar.gz fatcat-743940ce6075c1a1b547915a33ad8874094ae762.zip |
experiment with entity view tabs
Diffstat (limited to 'python/fatcat_web/templates')
-rw-r--r-- | python/fatcat_web/templates/entity_base.html | 70 | ||||
-rw-r--r-- | python/fatcat_web/templates/entity_history.html | 13 | ||||
-rw-r--r-- | python/fatcat_web/templates/entity_metadata.html | 13 | ||||
-rw-r--r-- | python/fatcat_web/templates/release_files.html | 91 | ||||
-rw-r--r-- | python/fatcat_web/templates/release_references.html | 44 | ||||
-rw-r--r-- | python/fatcat_web/templates/release_view.html | 134 |
6 files changed, 267 insertions, 98 deletions
diff --git a/python/fatcat_web/templates/entity_base.html b/python/fatcat_web/templates/entity_base.html new file mode 100644 index 00000000..aa32ac3b --- /dev/null +++ b/python/fatcat_web/templates/entity_base.html @@ -0,0 +1,70 @@ +{% extends "base.html" %} + +{% macro entity_tab(name, text, url_suffix) %} +<a href ="/{{ entity_type }}/{{ entity.ident }}{{ url_suffix }}" class="{% if entity_view == name %}active{% endif %} item">{{ text }}</a> +{% endmacro %} + +{% block fullmain %} +<div class="ui vertical stripe segment" style="background-color: #EEE; padding-top: 5em; padding-bottom: 0px; border-bottom: 0px;"> + <div class="ui container"> + <div class="ui centered grid"> + <div class="fourteen wide column" style="padding-bottom: 0px;"> + <h1 class="ui header"> + {% if entity_type == "release" %} + <span itemprop="headline"><span itemprop="name">{{ entity.title }}</span></span> + {% if entity.subtitle %} + <br><span style="font-size: smaller; font-weight: normal;">{{ entity.subtitle }}</span> + {% endif %} + {% endif %} + <span class="sub header"> + <code>{{ entity_type }}_{{ entity.ident }}</code> + </span> + </h1> + {% if entity_type == "release" %} + <p style="font-size: larger;"> + {% if authors and authors != [] %} by + {% for contrib in authors[:12] %} + {% if contrib.creator_id %} + <b><a href="/creator/{{contrib.creator_id}}">{{ contrib.raw_name }}</a></b>{% if not loop.last %}, {% endif %} + {% else %} + {% if contrib.raw_name != None %}{{ contrib.raw_name }}{% else %}<i>Unknown</i>{% endif %}{% if not loop.last %}, {% endif %} + {% endif %} + {% endfor %} + {% if authors|count > 12 %} <b>(+{{ authors|length - 12 }} others)</b> + {% endif %} + <br> + {% endif %} + {% endif %} + <div class="ui container"> + <div class="ui small tabular compact menu"> + {{ entity_tab("overview", "Overview", "") }} + {% if entity_type == "release" %} + {{ entity_tab("files", "Files", "/files") }} + {{ entity_tab("references", "References", "/references") }} + {% endif %} + {{ entity_tab("metadata", "Metadata", "/metadata") }} + </div> + <div class="ui small tabular compact menu floated right"> + {{ entity_tab("edit", "Edit", "/edit") }} + {{ entity_tab("history", "History", "/history") }} + </div> + </div> + </div> + </div> + </div> +</div> + +<div class="ui container" style="padding-top: 3em;"> + <div class="ui centered grid"> + <div class="fourteen wide column" style="padding-bottom: 0px;"> + {% block entity_main %}{% endblock %} + </div> + </div> +</div> +{% endblock %} + +{% block postscript %} +<script> + $('.ui.accordion').accordion(); +</script> +{% endblock %} diff --git a/python/fatcat_web/templates/entity_history.html b/python/fatcat_web/templates/entity_history.html index eee87487..73a3df92 100644 --- a/python/fatcat_web/templates/entity_history.html +++ b/python/fatcat_web/templates/entity_history.html @@ -1,13 +1,8 @@ -{% extends "base.html" %} -{% block body %} +{% set entity_view = "history" %} +{% set entity_type = "release" %} +{% extends "entity_base.html" %} -<h1 class="ui header">{% if page_title != None %}{{ page_title }}{% endif %} -<div class="sub header"> - <a href="/{{entity_type}}/{{entity.ident}}"> - <code>{{ entity_type }} {{ entity.ident }}</code> - </a> -</div> -</h1> +{% block entity_main %} <h3 class="ui header">Edit History</h3> diff --git a/python/fatcat_web/templates/entity_metadata.html b/python/fatcat_web/templates/entity_metadata.html new file mode 100644 index 00000000..7812a6e3 --- /dev/null +++ b/python/fatcat_web/templates/entity_metadata.html @@ -0,0 +1,13 @@ +{% set entity_view = "metadata" %} +{% import "entity_macros.html" as entity_macros %} +{% extends "entity_base.html" %} + +{% block entity_main %} + +{% if entity.extra %} + <h3>Extra Metadata (raw JSON)</h3> + {{ entity_macros.extra_metadata(entity.extra) }} +{% endif %} + +{% endblock %} + diff --git a/python/fatcat_web/templates/release_files.html b/python/fatcat_web/templates/release_files.html new file mode 100644 index 00000000..c8432cb5 --- /dev/null +++ b/python/fatcat_web/templates/release_files.html @@ -0,0 +1,91 @@ +{% set entity = release %} +{% set entity_view = "files" %} +{% set entity_type = "release" %} +{% import "entity_macros.html" as entity_macros %} +{% extends "entity_base.html" %} + +{% block entity_main %} + +<h3>Known Files and URLs</h3> +{% if entity.files != [] %} +<table class="ui compact fixed table"> +<!-- + <thead> + <tr><th>SHA-1 + <th>Size (bytes) + <th>File Type + <th>Links + </thead> +--> + <tbody> + {% for file in entity.files %} + <tr><td>{% if file.mimetype != None %}{{ file.mimetype }} {% endif %} + {% if file.size != None %}{{ file.size|filesizeformat }}{% endif %} + <br><small><code><a href="/file/{{ file.ident }}"> + {% if file.sha1 != None %}sha1:{{ file.sha1[:20] + "..." }} + {% elif file.sha256!= None %}sha256:{{ file.md5[:20] + "..." }} + {% elif file.md5 != None %}md5:{{ file.md5[:20] + "..." }} + {% endif %} + </a></code></small> + <td class="single line"> + {% for url in file.urls[:5] %} + <a href="{{ url.url }}">{{ url.url.split('/')[2] }}</a> ({{ url.rel }})<br> + {% endfor %} + {% if file.urls|length > 5 %} + <a href="/file/{{ file.ident }}">+ {{ file.urls|length - 5 }} more URLs</a> + {% endif %} + {% endfor %} + </tbody> +</table> +{% else %} +<p>There are no known files associated with this release (you could try +<a href="/work/{{ release.work_id }}">other releases for this work?</a>). +{% endif %} + + +{% if entity.filesets != [] %} +<h3>File Sets</h3> +<table class="ui compact fixed table"> + <tbody> + {% for fileset in entity.filesets %} + <tr><td>{{ fileset.manifest|count }} files {{ fileset.total_size|filesizeformat }} + <br><small><code><a href="/fileset/{{ fileset.ident }}">fileset:{{ fileset.ident }}</a></code></small> + <td class="single line"> + {% for url in fileset.urls[:5] %} + {% if url.rel == "dweb" %} + <a href="{{ url.url }}">{{ url.url }}</a> ({{ url.rel }})<br> + {% else %} + <a href="{{ url.url }}">{{ url.url.split('/')[2] }}</a> ({{ url.rel }})<br> + {% endif %} + {% endfor %} + {% if fileset.urls|length > 5 %} + + {{ file.urls|length - 5 }} more URLs + {% endif %} + {% endfor %} + </tbody> +</table> +{% endif %} + + +{% if entity.webcaptures != [] %} +<h3>Web Captures</h3> +<table class="ui single line compact fixed table"> + <tbody> + {% for webcapture in entity.webcaptures %} + <tr><td><b><a href="{{ webcapture.original_url }}">{{ webcapture.original_url }}</a></b> + <br>{{ webcapture.timestamp.strftime("%Y-%m-%d %H:%M:%S") }} | {{ webcapture.cdx|count }} resources + <br><small><code><a href="/webcapture/{{ webcapture.ident }}">webcapture:{{ webcapture.ident }}</a></code></small> + <td class="single line"> + {% for url in webcapture.archive_urls[:5] %} + <a href="{{ url.url }}{% if url.rel == "wayback" %}{{ webcapture.wayback_suffix }}{% endif %}">{{ url.url.split('/')[2] }}</a> ({{ url.rel }})<br> + {% endfor %} + {% if webcapture.urls|length > 5 %} + + {{ file.urls|length - 5 }} more URLs + {% endif %} + {% endfor %} + </tbody> +</table> +{% endif %} + +{% endblock %} + diff --git a/python/fatcat_web/templates/release_references.html b/python/fatcat_web/templates/release_references.html new file mode 100644 index 00000000..0bf58482 --- /dev/null +++ b/python/fatcat_web/templates/release_references.html @@ -0,0 +1,44 @@ +{% set entity = release %} +{% 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 %} +<h3>References</h3> +<i>This release citing other releases</i> +{# see https://github.com/Semantic-Org/Semantic-UI/issues/2639 #} +<ol> + {% for ref in release.refs %} + <li> + {% 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 %} + <i>unknown</i> + {% endif %} + {% if ref.target_release_id != None %} + (<a href="/release/{{ ref.target_release_id }}">fatcat entry</a>) + {% endif %} + {% if ref.extra != None and ref.extra.doi %} + (DOI: <a href="/release/lookup?doi={{ ref.extra.doi }}">{{ ref.extra.doi }}</a>) + {% endif %} + </li> + {% endfor %} +</ol> +{% else %} +<p>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 5fdc2244..a5fb0962 100644 --- a/python/fatcat_web/templates/release_view.html +++ b/python/fatcat_web/templates/release_view.html @@ -1,6 +1,7 @@ -{% set release = entity %} +{% set entity = release %} +{% set entity_view = "overview" %} {% import "entity_macros.html" as entity_macros %} -{% extends "base.html" %} +{% extends "entity_base.html" %} {# HTML metadata embeddings #} {% if release and release.status == "active" %} @@ -19,7 +20,7 @@ <meta name="DC.description" content="{{ release.abstracts[0].content }}"> <meta name="twitter:description" content="{{ release.abstracts[0].content }}"> {% endif %} - {% for author in release._authors %} + {% for author in authors %} <meta name="DC.creator" content="{{ author.raw_name }}"> <meta name="citation_author" content="{{ author.raw_name }}"> {% endfor %} @@ -89,16 +90,15 @@ </span> </h1> <p style="font-size: larger;"> - {% if release._authors != [] %} by {% endif %} - {% for contrib in release._authors[:12] %} + {% if authors != [] %} by {% endif %} + {% for contrib in authors[:12] %} {% if contrib.creator_id %} <b><a href="/creator/{{contrib.creator_id}}">{{ contrib.raw_name }}</a></b>{% if not loop.last %}, {% endif %} {% else %} {% if contrib.raw_name != None %}{{ contrib.raw_name }}{% else %}<i>Unknown</i>{% endif %}{% if not loop.last %}, {% endif %} {% endif %} {% endfor %} - {% if release._authors|count > 12 %} <b> - (+{{ release._authors|length - 12 }} others)</b> + {% if authors|count > 12 %} <b>(+{{ authors|length - 12 }} others)</b> {% endif %} </div> </div> @@ -107,13 +107,19 @@ <div class="one wide column"></div> <div class="ten wide column" style="font-size: 16px;"> +{% if release.abstracts != [] %} +<h3>Abstract</h3> +<p><span itemprop="description">{{ release.abstracts[0].content }}</span> +<br><small><i>In <code>{{ release.abstracts[0].mimetype }}</code> format</i></small> +{% endif %} + <div class="ui accordion"> <div class="title" itemprop="isPartOf" itemscope itemtype="http://schema.org/Periodical" itemid="#container"> {% if release.release_stage == 'published' %} - <i class="dropdown icon"></i>Published in <a href="/container/{{ release.container.ident }}"><span itemprop="name">{{ release.container.name }}</span></a> + <i class="dropdown icon"></i>Published in <a href="/container/{{ container.ident }}"><span itemprop="name">{{ container.name }}</span></a> {% else %} <i class="dropdown icon"></i>Released as a <i>{{ release.release_type }}</i> - {% if release.container %} in <a href="/container/{{ release.container.ident }}"><span itemprop="name">{{ release.container.name }}</span></a> {% endif %} + {% if container %} in <a href="/container/{{ container.ident }}"><span itemprop="name">{{ container.name }}</span></a> {% endif %} {% endif %} {% if release.publisher %} by <span itemprop="publisher">{{ release.publisher }}</span> @@ -129,9 +135,9 @@ <tr><td class="right aligned">Version</td> <td class="">{{ release.version }} {% endif %} - {% if release.container != None and release.container.issnl != None %} + {% if container != None and container.issnl != None %} <tr><td class="right aligned">ISSN-L</td> - <td class="" itemprop="issn">{{ release.container.issnl }} + <td class="" itemprop="issn">{{ container.issnl }} {% endif %} {% if release.volume != None %} <tr itemprop="isPartOf" itemscope itemtype="http://schema.org/PublicationVolume"> @@ -155,9 +161,9 @@ <tr><td class="right aligned">Release Year</td> <td class="">{{ release.release_year }} {% endif %} - {% if release.container != None and release.container.container_type != None %} + {% if container != None and container.container_type != None %} <tr><td class="right aligned">Container Type</td> - <td class="">{{ release.container.container_type }} + <td class="">{{ container.container_type }} {% endif %} {% if release.publisher != None %} <tr><td class="right aligned">Publisher</td> @@ -204,19 +210,6 @@ <p>No known contributors (authors, translators, etc). {% endif %} -{% if release.abstracts != [] %} -<h3>Abstract</h3> -<p><span itemprop="description">{{ release.abstracts[0].content }}</span> -<br><small><i>In <code>{{ release.abstracts[0].mimetype }}</code> format</i></small> -{% endif %} - - -{% if entity.extra %} - <h3>Extra Metadata (raw JSON)</h3> - {{ entity_macros.extra_metadata(entity.extra) }} -{% endif %} - -{% if entity.status == 'active' %} <h3>Known Files and URLs</h3> {% if entity.files != [] %} <table class="ui compact fixed table"> @@ -252,15 +245,14 @@ <p>There are no known files associated with this release (you could try <a href="/work/{{ release.work_id }}">other releases for this work?</a>). {% endif %} -{% endif %} -{% if entity.status == 'active' %} + {% if entity.filesets != [] %} <h3>File Sets</h3> <table class="ui compact fixed table"> <tbody> {% for fileset in entity.filesets %} - <tr><td>{{ fileset.manifest|count }} files {{ fileset._total_size|filesizeformat }} + <tr><td>{{ fileset.manifest|count }} files {{ fileset.total_size|filesizeformat }} <br><small><code><a href="/fileset/{{ fileset.ident }}">fileset:{{ fileset.ident }}</a></code></small> <td class="single line"> {% for url in fileset.urls[:5] %} @@ -277,9 +269,8 @@ </tbody> </table> {% endif %} -{% endif %} -{% if entity.status == 'active' %} + {% if entity.webcaptures != [] %} <h3>Web Captures</h3> <table class="ui single line compact fixed table"> @@ -290,7 +281,7 @@ <br><small><code><a href="/webcapture/{{ webcapture.ident }}">webcapture:{{ webcapture.ident }}</a></code></small> <td class="single line"> {% for url in webcapture.archive_urls[:5] %} - <a href="{{ url.url }}{% if url.rel == "wayback" %}{{ webcapture._wayback_suffix }}{% endif %}">{{ url.url.split('/')[2] }}</a> ({{ url.rel }})<br> + <a href="{{ url.url }}{% if url.rel == "wayback" %}{{ webcapture.wayback_suffix }}{% endif %}">{{ url.url.split('/')[2] }}</a> ({{ url.rel }})<br> {% endfor %} {% if webcapture.urls|length > 5 %} + {{ file.urls|length - 5 }} more URLs @@ -299,50 +290,15 @@ </tbody> </table> {% endif %} -{% endif %} - -{% if release.refs != None and release.refs.size != 0 %} -<h3>References</h3> -<i>This release citing other releases</i> -{# see https://github.com/Semantic-Org/Semantic-UI/issues/2639 #} -<ol> - {% for ref in release.refs %} - <li> - {% 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 %} - <i>unknown</i> - {% endif %} - {% if ref.target_release_id != None %} - (<a href="/release/{{ ref.target_release_id }}">fatcat entry</a>) - {% endif %} - {% if ref.extra != None and ref.extra.doi %} - (DOI: <a href="/release/lookup?doi={{ ref.extra.doi }}">{{ ref.extra.doi }}</a>) - {% endif %} - </li> - {% endfor %} -</ol> -{% else %} -<p>No reference list available. -{% endif %} </div> <div class="five wide column"> -{% if entity.status == 'active' and entity.files != [] and entity.files[0].urls != [] %} +{% if entity.files != [] and entity.files[0].urls != [] %} <a href="{{ entity.files[0].urls[0].url }}" class="ui top attached fluid huge green button"><i class="file pdf outline icon"></i>Download Full Text</a> -{% elif entity.status == 'active' and entity.webcaptures != [] and entity.webcaptures[0].archive_urls != [] and entity.webcaptures[0].archive_urls[0].rel == "wayback" %} -<a href="{{ entity.webcaptures[0].archive_urls[0].url }}{{ entity.webcaptures[0]._wayback_suffix }}" class="ui top attached fluid huge green button"><i class="file archive outline icon"></i>View Web Archive</a> +{% elif entity.webcaptures != [] and entity.webcaptures[0].archive_urls != [] and entity.webcaptures[0].archive_urls[0].rel == "wayback" %} +<a href="{{ entity.webcaptures[0].archive_urls[0].url }}{{ entity.webcaptures[0].wayback_suffix }}" class="ui top attached fluid huge green button"><i class="file archive outline icon"></i>View Web Archive</a> {% else %} <span class="ui top attached fluid huge grey button"><i class="file cross icon"></i>No Full Text Available</span> {% endif %} @@ -405,36 +361,36 @@ </div> {% endif %} -{% if release.container != None and release.container._es %} +{% if container != None and container.es %} <div class="ui segment attached"> <b>Container Metadata</b><br> -{% if release.container._es.is_oa == True %} +{% if container.es.is_oa == True %} <i class="icon unlock orange"></i>Open Access Publication<br> -{% elif release.container._es.is_oa == False %} +{% elif container.es.is_oa == False %} <i class="icon lock black"></i>Not Open Access<br> {% else %} <i class="icon question grey"></i>Unknown OA Status<br> {% endif %} -{% if (release.container._es != None) %} - {% if release.container._es.in_doaj == True %} - <i class="icon check green"></i> In <a href="https://doaj.org/toc/{{ release.container.issnl }}">DOAJ</a><br> - {% elif release.container._es.in_doaj == False %} +{% if (container.es != None) %} + {% if container.es.in_doaj == True %} + <i class="icon check green"></i> In <a href="https://doaj.org/toc/{{ container.issnl }}">DOAJ</a><br> + {% elif container.es.in_doaj == False %} <i class="icon times grey"></i> Not in <a href="https://doaj.org">DOAJ</a><br> {% endif %} - {% if release.container._es.in_road == True %} - <i class="icon check green"></i> In <a href="http://road.issn.org/issn/{{ release.container.issnl }}">ISSN ROAD</a><br> - {% elif release.container._es.in_road == False %} + {% if container.es.in_road == True %} + <i class="icon check green"></i> In <a href="http://road.issn.org/issn/{{ container.issnl }}">ISSN ROAD</a><br> + {% elif container.es.in_road == False %} <i class="icon times grey"></i> Not in <a href="https://road.issn.org">ISSN ROAD</a><br> {% endif %} - {% if release.container._es.in_kbart == True %} - <i class="icon check green"></i> In <a href="https://thekeepers.org/purl/issn/{{ release.container.issnl }}">Keepers Registery</a><br> - {% elif release.container._es.in_kbart == False %} <i class="icon times grey"></i> Not in <a href="https://thekeepers.org/journals?query={{ release.container.issnl }}">Keepers Registry</a><br> + {% 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> {% endif %} {% endif %} -{% if release.container.issnl != None %} - <i class="icon linkify"></i>ISSN-L: <code>{{ release.container.issnl }}</code><br> +{% if container.issnl != None %} + <i class="icon linkify"></i>ISSN-L: <code>{{ container.issnl }}</code><br> {% endif %} - <a href="/container/{{ release.container.ident }}" title="container {{ release.container.ident }}"><i class="icon share"></i>Fatcat Entry</a> + <a href="/container/{{ container.ident }}" title="container {{ container.ident }}"><i class="icon share"></i>Fatcat Entry</a> </div> {% endif %} @@ -461,8 +417,8 @@ <div class="ui segment attached accordion"> <div class="title" style="padding: 0px;"><i class="dropdown icon"></i><b>Lookup Links</b></div> <div class="content"> - {% if release.container != None and release.container.issnl != None %} - <a href="http://www.sherpa.ac.uk/romeo/issn/{{ release.container.issnl }}/">SHERPA/RoMEO</a> (journal policies)<br/> + {% if container != None and container.issnl != None %} + <a href="http://www.sherpa.ac.uk/romeo/issn/{{ container.issnl }}/">SHERPA/RoMEO</a> (journal policies)<br/> {% endif %} {% if release != None and release.ext_ids.doi != None %} <a href="https://oadoi.org/{{ release.ext_ids.doi }}">oaDOI/unpaywall</a><br/> @@ -483,7 +439,7 @@ </div> </div> -{{ entity_macros.fatcat_bits(entity, "release", "container,files,filesets,webcaptures", editgroup) }} +{{ entity_macros.fatcat_bits(entity, "release", "container,files,filesets,webcaptures") }} </div> </div> |