From 7163f36a5e9f159def223a76953505ffff9a56c7 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 18 Nov 2021 12:37:29 -0800 Subject: polish editgroup diff view Still not as great as it could be, but useful in this state. --- python/fatcat_web/templates/editgroup_diff.html | 52 ++++++--------------- python/fatcat_web/templates/editgroup_view.html | 62 +++++++++++++------------ 2 files changed, 47 insertions(+), 67 deletions(-) (limited to 'python/fatcat_web/templates') diff --git a/python/fatcat_web/templates/editgroup_diff.html b/python/fatcat_web/templates/editgroup_diff.html index de6a800d..4b32fbf5 100644 --- a/python/fatcat_web/templates/editgroup_diff.html +++ b/python/fatcat_web/templates/editgroup_diff.html @@ -2,56 +2,31 @@ {% macro edit_diff_list(auth_to, editgroup, edits, diffs, entity_type, entity_name) -%} {% if edits %} -

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

+

{{ entity_name }} Edit Diffs ({{ 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 %} + {{ entity_edit_header(auth_to, editgroup, edit, entity_type, entity_name) }} {% 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'] %} + {% if edit.revision and not edit.redirect_ident and edit.ident in diffs and diffs[edit.ident] != None %} +
+ {% for line in diffs[edit.ident] %} {% set line_space = false %} {% if line.startswith('@@') or line.startswith('---') or line.startswith('+++') %} - {% set line_color = "lightblue" %} + {% set line_color = "lightblue" %}{# a light blue #} {% elif line.startswith('+') %} - {% set line_color = "lightgreen" %} + {% set line_color = "#a4efa4" %}{# a light green #} {% elif line.startswith('-') %} - {% set line_color = "#ffa3a3" %} + {% set line_color = "#ffa3a3" %}{# a light red #} {% else %} - {% set line_color = "#ddd" %} + {% set line_color = "#eee" %}{# almost white #} {% set line_space = true %} {% endif %} -
{% if line_space %} {% endif %}{{ line.strip() }}
+
{% if line_space %} {% endif %}{{ line.strip() }}
{% endfor %}
{% endif %} @@ -62,10 +37,11 @@ {% endif %} {%- endmacro %} -{% block title %}Editgroup diff{% endblock %} +{% block title %}Editgroup Diff{% endblock %} + +{% block pagetitle %}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") }} diff --git a/python/fatcat_web/templates/editgroup_view.html b/python/fatcat_web/templates/editgroup_view.html index de904c2a..0142a46b 100644 --- a/python/fatcat_web/templates/editgroup_view.html +++ b/python/fatcat_web/templates/editgroup_view.html @@ -1,40 +1,45 @@ {% extends "base.html" %} {% import "entity_macros.html" as entity_macros %} +{% macro entity_edit_header(auth_to, editgroup, edit, entity_type, entity_name) -%} +
+ [view] + [diff] + {% 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 %} +{%- endmacro %} + {% macro edit_list(auth_to, editgroup, edits, entity_type, entity_name) -%}

{{ 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 %} + {{ entity_edit_header(auth_to, editgroup, edit, entity_type, entity_name) }} {% if edit.extra %} {{ entity_macros.extra_metadata(edit.extra) }} {% endif %} @@ -51,11 +56,10 @@ {# extended by changelog_entry #} {% block editgroupheader %} -

Editgroup +

{% block pagetitle %}Editgroup{% endblock %} editgroup_{{ editgroup.editgroup_id }}

{% if not auth_to.submit %} -
What is an editgroup? -- cgit v1.2.3