aboutsummaryrefslogtreecommitdiff
path: root/gn2/wqflask/templates/view_case_attribute_diff.html
blob: 3ba9b3148dd415ebe0b3eafd5211c484b1690969 (about) (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
{%extends "base.html"%}
{%block title%}View Case Attribute Diff{%endblock%}

{%block css%}
<link rel="stylesheet" type="text/css"
      href="/css/DataTables/css/jquery.dataTables.css" />
<link rel="stylesheet" type="text/css"
      href="{{ url_for('css', filename='jquery-ui/jquery-ui.theme.css') }}" />
<link rel="stylesheet" type="text/css" href="/static/new/css/show_trait.css" />

<style>
  .table-fixed-head {overflow-y: auto; height: 32em;}
  .table-fixed-head thead th {position: sticky; top: 0;}
  .diff-row {
      display: grid;
      grid-template-columns: 1rem 9rem;
      column-gap: 0.5em;
      padding: 0.5em;
      background:#CCCCCC;
      border-color:#FFFFFF;
      border-style:solid;
      border-radius: 10px;
  }
  .diff-indicator {
      grid-column-start: 1;
      grid-column-end: 2;
  }
  .diff-original {
      grid-column-start: 2;
      grid-column-end: 3;
  }
  .diff-current {
      grid-column-start: 2;
      grid-column-end: 3;
  }
  .diff-addition {color: green; font-weight: bold;}
  .diff-deletion {color: red; font-weight: bold;}
  form input[type="submit"] {
      text-transform: capitalize;
  }
</style>
{%endblock%}

{%block content%}
<div class="container">
  <h1>View Diff</h1>

  {{flash_me()}}

  <div id="diff-display" class="panel panel-primary">
    <div class="panel-heading">
      <h3 class="panel-title">Changes</h3>
    </div>
    <div class="panel-body">
      {%set the_diff = diff.json_diff_data.diff%}
      {%if the_diff.Additions | length %}
      <h4>Additions</h4>
      <div class="diff-row">
	<span class="diff-indicator"></span>
	<span class="diff-original"></span>
	<span class="diff-indicator diff-addition">+</span>
	<span class="diff-current diff-addition">{{item.Current}}</span>
      </div>
      {%endif%}
      {%if the_diff.Modifications | length %}
      <h4>Modifications</h4>
      {%for item in the_diff.Modifications%}
      <div class="diff-row">
	<span class="diff-indicator diff-deletion">-</span>
	<span class="diff-original diff-deletion">{{item.Original}}</span>
	<span class="diff-indicator diff-addition">+</span>
	<span class="diff-current diff-addition">{{item.Current}}</span>
      </div>
      {%endfor%}
      {%endif%}
      {%if the_diff.Deletions | length %}
      <h4>Deletions</h4>
      <div class="diff-row">
	<span class="diff-indicator diff-addition">+</span>
	<span class="diff-original diff-addition">{{item.Original}}</span>
	<span class="diff-indicator diff-deletion">-</span>
	<span class="diff-current diff-deletion">{{item.Current}}</span>
      </div>
      {%endif%}
    </div>
    <div class="panel-footer">
      <p>Edited by: {{diff.json_diff_data.user_id}}</p>
    </div>
  </div>

  

  <form method="POST" action="{{url_for('approve_reject_diff')}}">
    <input type="hidden"
	   name="diff_id"
	   value="{{diff.id}}" />
    <input type="hidden"
	   name="diff_data"
	   value='{{diff.json_diff_data | tojson}}' />
    <input type="submit"
	   name="action"
	   title="Approve the changes"
	   class="btn btn-warning"
	   value="approve" />
    <input type="submit"
	   name="action"
	   title="Reject the changes"
	   class="btn btn-danger"
	   value="reject" />
  </form>
{%endblock%}

{%block js%}
<script language="javascript"
	type="text/javascript"
	src="{{url_for('js', filename='DataTables/js/jquery.js')}}"></script>
{%endblock%}