aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/templates/editgroup_diff.html
blob: 4b32fbf5fc625067a91938394872920489f40bb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{% extends "editgroup_view.html" %}

{% macro edit_diff_list(auth_to, editgroup, edits, diffs, entity_type, entity_name) -%}
{% if edits %}
  <h3>{{ entity_name }} Edit Diffs ({{ edits|count }})</h3>
  <hr>
  <div class="ui divided list">
    {% for edit in edits %}
    <div class="item" id="{{ entity_type }}_{{ edit.ident }}">
      <div class="content" style="padding-bottom: 0.5em;">
        {{ 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 and diffs[edit.ident] != None %}
          <div style="border: 1px solid black; font-size: smaller; font-color: #222; word-break: break-all; margin-top: 0.5em; margin-bottom: 0.5em;">
          {% for line in diffs[edit.ident] %}
            {% set line_space = false %}
            {% if line.startswith('@@') or line.startswith('---') or line.startswith('+++') %}
              {% set line_color = "lightblue" %}{# a light blue #}
            {% elif line.startswith('+') %}
              {% set line_color = "#a4efa4" %}{# a light green #}
            {% elif line.startswith('-') %}
              {% set line_color = "#ffa3a3" %}{# a light red #}
            {% else %}
              {% set line_color = "#eee" %}{# almost white #}
              {% set line_space = true %}
            {% endif %}
            <pre style="background-color: {{ line_color }}; white-space: pre-wrap; margin: 0px;">{% if line_space %}&nbsp;{% endif %}{{ line.strip() }}</pre>
          {% endfor %}
          </div>
        {% endif %}
      </div>
    </div>
    {% endfor %}
  </div>
{% endif %}
{%- endmacro %}

{% block title %}Editgroup Diff{% endblock %}

{% block pagetitle %}Editgroup Diff{% endblock %}

{% block editgroupedits %}
{{ 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 %}