aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/templates
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-06-10 17:46:47 -0700
committerBryan Newbold <bnewbold@robocracy.org>2019-06-13 14:36:59 -0700
commit210f39a845e676e162eaa73d7ca401a8d3d89bcf (patch)
treeddeea7c9f1785a5f9553d942ede30645bf133a77 /python/fatcat_web/templates
parent682f263e8053aab9ecce427eee9f3c589816941b (diff)
downloadfatcat-210f39a845e676e162eaa73d7ca401a8d3d89bcf.tar.gz
fatcat-210f39a845e676e162eaa73d7ca401a8d3d89bcf.zip
entity view tweaks
Diffstat (limited to 'python/fatcat_web/templates')
-rw-r--r--python/fatcat_web/templates/entity_base.html12
-rw-r--r--python/fatcat_web/templates/entity_macros.html2
-rw-r--r--python/fatcat_web/templates/entity_metadata.html3
-rw-r--r--python/fatcat_web/templates/release_contribs.html34
-rw-r--r--python/fatcat_web/templates/release_files.html91
-rw-r--r--python/fatcat_web/templates/release_view.html106
6 files changed, 122 insertions, 126 deletions
diff --git a/python/fatcat_web/templates/entity_base.html b/python/fatcat_web/templates/entity_base.html
index aa32ac3b..6b64dfdf 100644
--- a/python/fatcat_web/templates/entity_base.html
+++ b/python/fatcat_web/templates/entity_base.html
@@ -1,14 +1,14 @@
{% 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>
+{% macro entity_tab(name, text, url_suffix, count=None) %}
+<a href ="/{{ entity_type }}/{{ entity.ident }}{{ url_suffix }}" class="{% if entity_view == name %}active{% endif %} item" style="padding: 0em 1.2em;">{{ text }}{% if count != None %} ({{ count }}){% endif %}</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;">
+ <div class="fifteen wide large screen sixteen wide column" style="padding-bottom: 0px;">
<h1 class="ui header">
{% if entity_type == "release" %}
<span itemprop="headline"><span itemprop="name">{{ entity.title }}</span></span>
@@ -39,8 +39,8 @@
<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") }}
+ {{ entity_tab("contribs", "Authors", "/contribs", authors|count ) }}
+ {{ entity_tab("references", "References", "/references", entity.refs|count) }}
{% endif %}
{{ entity_tab("metadata", "Metadata", "/metadata") }}
</div>
@@ -56,7 +56,7 @@
<div class="ui container" style="padding-top: 3em;">
<div class="ui centered grid">
- <div class="fourteen wide column" style="padding-bottom: 0px;">
+ <div class="fifteen wide large screen sixteen wide column" style="padding-bottom: 0px;">
{% block entity_main %}{% endblock %}
</div>
</div>
diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html
index 77d4ff81..1d798dfb 100644
--- a/python/fatcat_web/templates/entity_macros.html
+++ b/python/fatcat_web/templates/entity_macros.html
@@ -55,7 +55,7 @@
</code>
{% else %}
<tr><td class="three wide right aligned"><code>{{ key }}</code></td>
- <td class="seven wide"><code>{{ value }}</code>
+ <td class="seven wide"><code>{% if value != None %}{{ value }}{% endif %}</code>
{% endif %}
{% endfor %}
</tbody>
diff --git a/python/fatcat_web/templates/entity_metadata.html b/python/fatcat_web/templates/entity_metadata.html
index 7812a6e3..5ce97d10 100644
--- a/python/fatcat_web/templates/entity_metadata.html
+++ b/python/fatcat_web/templates/entity_metadata.html
@@ -9,5 +9,8 @@
{{ entity_macros.extra_metadata(entity.extra) }}
{% endif %}
+<h3>Entity Metadata (schema)</h3>
+{{ entity_macros.extra_metadata(entity._metadata) }}
+
{% endblock %}
diff --git a/python/fatcat_web/templates/release_contribs.html b/python/fatcat_web/templates/release_contribs.html
new file mode 100644
index 00000000..21df2339
--- /dev/null
+++ b/python/fatcat_web/templates/release_contribs.html
@@ -0,0 +1,34 @@
+{% set entity = release %}
+{% 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 %}
+<table class="ui basic compact table">
+<tbody>
+{% for contrib in release.contribs %}
+ <tr><td class="collapsing">{% if contrib.index or contrib.index == 0 %} {{ contrib.index + 1 }}{% endif %}
+ <td><span itemprop="author">
+ {% if contrib.creator_id %}
+ <a href="/creator/{{contrib.creator_id}}">{{ contrib.raw_name or 'unknown' }}</a>
+ {% else %}
+ {{ contrib.raw_name or '' }}
+ {% endif %}
+ {% if contrib.surname %}
+ <code>&nbsp;
+ ({{ contrib.surname }}{% if contrib.given_name %}, {{ contrib.given_name }}{% endif %})
+ </code>
+ {% endif %}
+ </span><br><i>{{ contrib.role or 'unknown' }}</i>
+{% endfor %}
+</tbody>
+</table>
+{% else %}
+<p>No known contributors (authors, translators, etc).
+{% endif %}
+
+{% endblock %}
+
diff --git a/python/fatcat_web/templates/release_files.html b/python/fatcat_web/templates/release_files.html
deleted file mode 100644
index c8432cb5..00000000
--- a/python/fatcat_web/templates/release_files.html
+++ /dev/null
@@ -1,91 +0,0 @@
-{% 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 }}&nbsp;&nbsp;{% 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 &nbsp;{{ 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_view.html b/python/fatcat_web/templates/release_view.html
index a5fb0962..ad863a64 100644
--- a/python/fatcat_web/templates/release_view.html
+++ b/python/fatcat_web/templates/release_view.html
@@ -104,7 +104,6 @@
</div>
<div class="ui stackable mobile reversed grid centered">
-<div class="one wide column"></div>
<div class="ten wide column" style="font-size: 16px;">
{% if release.abstracts != [] %}
@@ -180,34 +179,85 @@
</div>
</div>
-{% if release.contribs|length > 0 %}
-<div class="ui accordion">
-<div class="title">
- <i class="dropdown icon"></i>All Contributors ({{ release.contribs|length }})
-</div><div class="content">
-<table class="ui basic compact table">
-<tbody>
-{% for contrib in release.contribs %}
- <tr><td class="collapsing">{% if contrib.index or contrib.index == 0 %} {{ contrib.index + 1 }}{% endif %}
- <td><span itemprop="author">
- {% if contrib.creator_id %}
- <a href="/creator/{{contrib.creator_id}}">{{ contrib.raw_name or 'unknown' }}</a>
- {% else %}
- {{ contrib.raw_name or '' }}
- {% endif %}
- {% if contrib.surname %}
- <code>&nbsp;
- ({{ contrib.surname }}{% if contrib.given_name %}, {{ contrib.given_name }}{% endif %})
- </code>
- {% endif %}
- </span><br><i>{{ contrib.role or 'unknown' }}</i>
-{% endfor %}
-</tbody>
+<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 }}&nbsp;&nbsp;{% 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>
-</div>
-</div>
{% else %}
-<p>No known contributors (authors, translators, etc).
+<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 &nbsp;{{ 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 %}
<h3>Known Files and URLs</h3>
@@ -293,7 +343,7 @@
</div>
-<div class="five wide column">
+<div class="six wide column">
{% 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>