From e7ad9a390584ac9df0f7c03dc687e38ca4e073e3 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 17 Nov 2021 20:23:30 -0800 Subject: initial implementation of editgroup 'diff' for review --- python/fatcat_web/templates/editgroup_diff.html | 77 +++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 python/fatcat_web/templates/editgroup_diff.html (limited to 'python/fatcat_web/templates/editgroup_diff.html') 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 %} +

{{ entity_name }} Edits ({{ edits|count }})

+
+
+ {% for edit in edits %} +
+
+
+ [view] + {% if auth_to.edit and not editgroup.changelog_index and not editgroup.submitted %} +
[re-edit] +
+
+ + +
+ {% endif %} +
+
+ {{ entity_type }}_{{ edit.ident }} + {% if edit.redirect_ident %} + => redirect to {{ entity_type }}/{{ edit.redirect_ident }} + {% elif not edit.revision %} + deleted + {% elif not edit.prev_revision %} + created + {% else %} + updated + {% endif %} +
+ {% if edit.revision %} + Revision: {{ edit.revision }} + {% endif %} + {% if edit.extra %} + {{ entity_macros.extra_metadata(edit.extra) }} + {% endif %} + {% if edit.revision and not edit.redirect_ident and edit.ident in diffs %} +
+ {% 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 %} +
{% if line_space %} {% endif %}{{ line.strip() }}
+ {% endfor %} +
+ {% endif %} +
+
+ {% endfor %} +
+{% endif %} +{%- endmacro %} + +{% block title %}Editgroup diff{% endblock %} + +{% block editgroupedits %} +

All Entity Change Diffs

+{{ 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 %} + -- cgit v1.2.3