aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-03-01 15:23:28 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-03-01 15:23:28 -0800
commit80274227d8b292727ede37184deca5772e19fe43 (patch)
treefd1fa8c21504804d0734cf27bfd0b190645be2b5
parentaefa1a76d7e9d4f914e3e9cc4f2ce7520fa70f1b (diff)
downloadfatcat-80274227d8b292727ede37184deca5772e19fe43.tar.gz
fatcat-80274227d8b292727ede37184deca5772e19fe43.zip
improve editgroup (and derived) views
-rw-r--r--python/fatcat_web/templates/editgroup_view.html92
1 files changed, 47 insertions, 45 deletions
diff --git a/python/fatcat_web/templates/editgroup_view.html b/python/fatcat_web/templates/editgroup_view.html
index 2557b060..2341f06a 100644
--- a/python/fatcat_web/templates/editgroup_view.html
+++ b/python/fatcat_web/templates/editgroup_view.html
@@ -1,6 +1,38 @@
{% extends "base.html" %}
{% block body %}
+{% macro edit_list(edits, entity_type, entity_name) -%}
+<div class="{% if edits %}active{% endif %} title">
+ <h3><i class="dropdown icon"></i>{{ entity_name }} Edits ({{ edits|count }})</h3>
+</div><div class="{% if edits %}active{% endif %} content" style="padding-bottom: 0.5em;">
+ <div class="ui divided list">
+ {% for edit in edits %}
+ <div class="item">
+ <div class="content">
+ <div class="header">
+ <a href="/{{ entity_type }}/{{ edit.ident }}">{{ entity_type }}/{{ edit.ident }}</a>
+ {% if edit.redirect_ident %}
+ =&gt; redirect to <a href="/{{ entity_type }}/{{ edit.redirect_ident }}">{{ entity_type }}/{{ edit.redirect_ident }}</a>
+ {% elif not edit.revision %}
+ deleted
+ {% elif not edit.prev_revision %}
+ created
+ {% else %}
+ updated
+ {% endif %}
+ </div>
+ {% if edit.revision %}
+ Revision: <small><code>{{ edit.revision }}</code></small>
+ {% endif %}
+ {% if edit.extra %}
+ {% endif %}
+ </div>
+ </div>
+ {% endfor %}
+ </div>
+</div>
+{%- endmacro %}
+
{# extended by changelog_entry #}
{% block editgroupheader %}
<h1 class="ui header">Edit Group
@@ -11,53 +43,16 @@
<br><b>Description:</b> {{ editgroup.description }}
<br><br>
-<div class="ui accordion">
-<div class="title">
- <i class="dropdown icon"></i>Work Edits ({{ editgroup.edits.works|count }})
-</div><div class="content">
- Some content
-</div>
+<div class="ui styled fluid accordion">
+ {{ edit_list(editgroup.edits.works, "work", "Work") }}
+ {{ edit_list(editgroup.edits.releases, "release", "Release") }}
+ {{ edit_list(editgroup.edits.containers, "container", "Container") }}
+ {{ edit_list(editgroup.edits.creators, "creator", "Creator") }}
+ {{ edit_list(editgroup.edits.files, "file", "File") }}
+ {{ edit_list(editgroup.edits.filesets, "fileset", "File Set") }}
+ {{ edit_list(editgroup.edits.webcaptures, "webcapture", "Web Capture") }}
</div>
-<h3>Work Edits ({{ editgroup.edits.works|count }})</h3>
-<ul>
-{% for edit in editgroup.edits.works %}
- <li>Work edit #<a href="/work/edit/{{ edit.edit_id }}">{{ edit.edit_id }}</a>:
- <a href="/work/{{ edit.ident }}">{{ edit.ident }}</a> to rev {{ edit.revision }}
-{% endfor %}
-</ul>
-
-<h3>Release Edits ({{ editgroup.edits.releases|count }})</h3>
-<ul>
-{% for edit in editgroup.edits.releases %}
- <li>Release edit #<a href="/release/edit/{{ edit.edit_id }}">{{ edit.edit_id }}</a>:
- <a href="/release/{{ edit.ident }}">{{ edit.ident }}</a> to rev {{ edit.revision }}
-{% endfor %}
-</ul>
-
-<h3>Container Edits ({{ editgroup.edits.containers|count }})</h3>
-<ul>
-{% for edit in editgroup.edits.containers %}
- <li>Container edit #<a href="/container/edit/{{ edit.edit_id }}">{{ edit.edit_id }}</a>:
- <a href="/container/{{ edit.ident }}">{{ edit.ident }}</a> to rev {{ edit.revision }}
-{% endfor %}
-</ul>
-
-<h3>Creator Edits ({{ editgroup.edits.creators|count }})</h3>
-<ul>
-{% for edit in editgroup.edits.creators %}
- <li>Creator edit #<a href="/creator/edit/{{ edit.edit_id }}">{{ edit.edit_id }}</a>:
- <a href="/creator/{{ edit.ident }}">{{ edit.ident }}</a> to rev {{ edit.revision }}
-{% endfor %}
-</ul>
-
-<h3>File Edits ({{ editgroup.edits.files|count }})</h3>
-<ul>
-{% for edit in editgroup.edits.files %}
- <li>File edit #<a href="/file/edit/{{ edit.edit_id }}">{{ edit.edit_id }}</a>:
- <a href="/file/{{ edit.ident }}">{{ edit.ident }}</a> to rev {{ edit.revision }}
-{% endfor %}
-</ul>
<br>
<p><b>What is an editgroup?</b>
@@ -65,3 +60,10 @@ An editgroup is a set of entity edits, bundled together into a coherent,
reviewable bundle.
{% endblock %}
+
+{% block postscript %}
+<script>
+$('.ui.accordion')
+ .accordion({ exclusive: false });
+</script>
+{% endblock %}