aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/templates/editgroup_diff.html
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2021-11-17 20:23:30 -0800
committerBryan Newbold <bnewbold@robocracy.org>2021-11-17 20:23:45 -0800
commite7ad9a390584ac9df0f7c03dc687e38ca4e073e3 (patch)
treefd76555d10028d03c153cbd761bc217fa524d123 /python/fatcat_web/templates/editgroup_diff.html
parent3497282bbb6db33aac9fd43d2a22177c6ac24978 (diff)
downloadfatcat-e7ad9a390584ac9df0f7c03dc687e38ca4e073e3.tar.gz
fatcat-e7ad9a390584ac9df0f7c03dc687e38ca4e073e3.zip
initial implementation of editgroup 'diff' for review
Diffstat (limited to 'python/fatcat_web/templates/editgroup_diff.html')
-rw-r--r--python/fatcat_web/templates/editgroup_diff.html77
1 files changed, 77 insertions, 0 deletions
diff --git a/python/fatcat_web/templates/editgroup_diff.html b/python/fatcat_web/templates/editgroup_diff.html
new file mode 100644
index 00000000..de6a800d
--- /dev/null
+++ b/python/fatcat_web/templates/editgroup_diff.html
@@ -0,0 +1,77 @@
+{% extends "editgroup_view.html" %}
+
+{% macro edit_diff_list(auth_to, editgroup, edits, diffs, entity_type, entity_name) -%}
+{% if edits %}
+ <h3>{{ entity_name }} Edits ({{ edits|count }})</h3>
+ <hr>
+ <div class="ui divided list">
+ {% for edit in edits %}
+ <div class="item">
+ <div class="content" style="padding-bottom: 0.5em;">
+ <div style="float: right; font-weight: bold;">
+ <a href="/editgroup/{{ editgroup.editgroup_id }}/{{ entity_type }}/{{ edit.ident }}">[view]</a>
+ {% if auth_to.edit and not editgroup.changelog_index and not editgroup.submitted %}
+ <br><a href="/editgroup/{{ editgroup.editgroup_id }}/{{ entity_type }}/{{ edit.ident }}/edit" style="color: green;">[re-edit]</a>
+ <br>
+ <form id="submit_edit_delete" method="POST" action="/editgroup/{{ editgroup.editgroup_id }}/{{ entity_type }}/edit/{{ edit.edit_id }}/delete" style="display:inline;">
+ <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
+ <input type="submit" value="[delete]" style="background:none; color: red; border: none; font-weight:bold; cursor:pointer; padding: 0;"></input>
+ </form>
+ {% endif %}
+ </div>
+ <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><a href="/{{ entity_type }}/rev/{{ edit.revision }}">{{ edit.revision }}</a></code></small>
+ {% endif %}
+ {% if edit.extra %}
+ {{ entity_macros.extra_metadata(edit.extra) }}
+ {% endif %}
+ {% if edit.revision and not edit.redirect_ident and edit.ident in diffs %}
+ <div style="border: 2px solid black; overflow-x:scroll; margin: 0.5em;">
+ {% for line in diffs[edit.ident]['diff_lines'] %}
+ {% set line_space = false %}
+ {% if line.startswith('@@') or line.startswith('---') or line.startswith('+++') %}
+ {% set line_color = "lightblue" %}
+ {% elif line.startswith('+') %}
+ {% set line_color = "lightgreen" %}
+ {% elif line.startswith('-') %}
+ {% set line_color = "#ffa3a3" %}
+ {% else %}
+ {% set line_color = "#ddd" %}
+ {% set line_space = true %}
+ {% endif %}
+ <pre style="background-color: {{ line_color }}; margin: 0px;">{% if line_space %} {% endif %}{{ line.strip() }}</pre>
+ {% endfor %}
+ </div>
+ {% endif %}
+ </div>
+ </div>
+ {% endfor %}
+ </div>
+{% endif %}
+{%- endmacro %}
+
+{% block title %}Editgroup diff{% endblock %}
+
+{% block editgroupedits %}
+<h3 class="ui header">All Entity Change Diffs</h3>
+{{ edit_diff_list(auth_to, editgroup, editgroup.edits.releases, editgroup_diffs.release, "release", "Release") }}
+{{ edit_diff_list(auth_to, editgroup, editgroup.edits.works, editgroup_diffs.work, "work", "Work") }}
+{{ edit_diff_list(auth_to, editgroup, editgroup.edits.containers, editgroup_diffs.container, "container", "Container") }}
+{{ edit_diff_list(auth_to, editgroup, editgroup.edits.creators, editgroup_diffs.creator, "creator", "Creator") }}
+{{ edit_diff_list(auth_to, editgroup, editgroup.edits.files, editgroup_diffs.file, "file", "File") }}
+{{ edit_diff_list(auth_to, editgroup, editgroup.edits.filesets, editgroup_diffs.fileset, "fileset", "File Set") }}
+{{ edit_diff_list(auth_to, editgroup, editgroup.edits.webcaptures, editgroup_diffs.webcapture, "webcapture", "Web Capture") }}
+{% endblock %}
+