Skip to content

Commit a0275a8

Browse files
committed
first slice of surfacing changelog
1 parent 2e8c10b commit a0275a8

File tree

3 files changed

+69
-1
lines changed

3 files changed

+69
-1
lines changed

application/blueprints/planning_consideration/views.py

+7
Original file line numberDiff line numberDiff line change
@@ -584,3 +584,10 @@ def delete_note(slug, note_id):
584584
db.session.add(note)
585585
db.session.commit()
586586
return redirect(url_for("planning_consideration.consideration", slug=slug))
587+
588+
589+
@planning_consideration.route("/<slug>/change-log")
590+
@login_required
591+
def change_log(slug):
592+
consideration = Consideration.query.filter(Consideration.slug == slug).one_or_404()
593+
return render_template("change-log.html", consideration=consideration)

application/templates/change-log.html

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{% extends 'layouts/base.html' %}
2+
3+
{% block app_breadcrumbs %}
4+
{{ govukBreadcrumbs({
5+
'items': [
6+
{
7+
'text': "Home",
8+
'href': url_for('main.index')
9+
},
10+
{
11+
'text': "Planning consideration",
12+
'href': url_for('planning_consideration.considerations')
13+
},
14+
{
15+
'text': consideration.name,
16+
'href': url_for('planning_consideration.consideration', slug=consideration.slug)
17+
},
18+
{
19+
'text': "Change log"
20+
}
21+
]
22+
}) }}
23+
24+
{% endblock %}
25+
26+
{% block content_header %}
27+
<span class="govuk-caption-xl">{{ consideration.name }}</span>
28+
<h1 class="govuk-heading-xl">Changes to consideration</h1>
29+
{% endblock %}
30+
31+
32+
{% block content_primary %}
33+
<table class="govuk-table">
34+
<caption class="govuk-table__caption govuk-table__caption--m">Change log</caption>
35+
<thead class="govuk-table__head">
36+
<tr class="govuk-table__row">
37+
<th scope="col" class="govuk-table__header">Field</th>
38+
<th scope="col" class="govuk-table__header">From</th>
39+
<th scope="col" class="govuk-table__header">To</th>
40+
<th scope="col" class="govuk-table__header">Change date</th>
41+
<th scope="col" class="govuk-table__header">Changed by</th>
42+
</tr>
43+
</thead>
44+
<tbody class="govuk-table__body">
45+
{% for change in consideration.changes %}
46+
{% for field in change.changes %}
47+
{% if change.changes[field]["deleted"] or change.changes[field]["added"] %}
48+
<tr class="govuk-table__row">
49+
<th scope="row" class="govuk-table__header">{{ field }}</th>
50+
<td class="govuk-table__cell">{{ change.changes[field]["deleted"] }}</td>
51+
<td class="govuk-table__cell">{{ change.changes[field]["added"] }}</td>
52+
<td class="govuk-table__cell">{{ change["date"] }}</td>
53+
<td class="govuk-table__cell">{{ change["user"] }}</td>
54+
55+
</tr>
56+
{% endif %}
57+
{% endfor %}
58+
{% endfor %}
59+
</tbody>
60+
</table>
61+
{% endblock content_primary %}

application/templates/consideration.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -358,5 +358,5 @@ <h3 class="govuk-heading-m">Actions</h3>
358358

359359
{% block content_footer %}
360360
<hr class="govuk-section-break govuk-section-break--m govuk-section-break--visible">
361-
<span class="govuk-hint">{% if latest_change %}Last updated: {{ latest_change }}{% else %}No recent updates{% endif %}</span>
361+
<span class="govuk-hint">{%- if latest_change %}<a href="{{url_for('planning_consideration.change_log', slug=consideration.slug) }}">Last updated: {{ latest_change }}</a>{% else %}No recent updates{% endif -%}</span>
362362
{% endblock %}

0 commit comments

Comments
 (0)