Fix innaccurate headings on add/edit template page

The same `.html` file is shared between adding a template and editing a
template.

The page heading needs to be contextual to the URL, either ‘add’ or ‘edit’.
Somewhere along the way this got lost; this commit reinstates it.
This commit is contained in:
Chris Hill-Scott
2016-03-11 07:45:10 +00:00
parent b4e6f734c8
commit 370fd68a2c
3 changed files with 17 additions and 6 deletions

View File

@@ -13,6 +13,11 @@ form_objects = {
'sms': SMSTemplateForm 'sms': SMSTemplateForm
} }
page_headings = {
'email': 'email',
'sms': 'text message'
}
@main.route("/services/<service_id>/templates/add-<template_type>", methods=['GET', 'POST']) @main.route("/services/<service_id>/templates/add-<template_type>", methods=['GET', 'POST'])
@login_required @login_required
@@ -42,7 +47,8 @@ def add_service_template(service_id, template_type):
'views/edit-{}-template.html'.format(template_type), 'views/edit-{}-template.html'.format(template_type),
form=form, form=form,
template_type=template_type, template_type=template_type,
service_id=service_id service_id=service_id,
heading_action='Add'
) )
@@ -70,7 +76,8 @@ def edit_service_template(service_id, template_id):
form=form, form=form,
service_id=service_id, service_id=service_id,
template_id=template_id, template_id=template_id,
template_type=template['template_type'] template_type=template['template_type'],
heading_action='Edit'
) )

View File

@@ -3,12 +3,14 @@
{% from "components/page-footer.html" import page_footer %} {% from "components/page-footer.html" import page_footer %}
{% block page_title %} {% block page_title %}
{{ h1 }} GOV.UK Notify {{ heading_action }} email template GOV.UK Notify
{% endblock %} {% endblock %}
{% block maincolumn_content %} {% block maincolumn_content %}
<h1 class="heading-large">Edit email template</h1> <h1 class="heading-large">
{{ heading_action }} email template
</h1>
<form method="post"> <form method="post">
<div class="grid-row"> <div class="grid-row">

View File

@@ -3,12 +3,14 @@
{% from "components/page-footer.html" import page_footer %} {% from "components/page-footer.html" import page_footer %}
{% block page_title %} {% block page_title %}
{{ h1 }} GOV.UK Notify {{ heading_action }} text message template GOV.UK Notify
{% endblock %} {% endblock %}
{% block maincolumn_content %} {% block maincolumn_content %}
<h1 class="heading-large">Edit text message template</h1> <h1 class="heading-large">
{{ heading_action }} text message template
</h1>
<form method="post"> <form method="post">
<div class="grid-row"> <div class="grid-row">