mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-11 10:28:41 -04:00
Rename content to template content
WTForms sets the `id` of a `textarea` element to the variable name to which the form control is assigned. This conflicts with the page container, which is styled by targeting `#content`.
This commit is contained in:
+1
-1
@@ -194,7 +194,7 @@ class TemplateForm(Form):
|
|||||||
u'Template name',
|
u'Template name',
|
||||||
validators=[DataRequired(message="Template name cannot be empty")])
|
validators=[DataRequired(message="Template name cannot be empty")])
|
||||||
template_type = SelectField(u'Template type', choices=[('sms', 'SMS')])
|
template_type = SelectField(u'Template type', choices=[('sms', 'SMS')])
|
||||||
content = TextAreaField(
|
template_content = TextAreaField(
|
||||||
u'Message',
|
u'Message',
|
||||||
validators=[DataRequired(message="Template content cannot be empty")])
|
validators=[DataRequired(message="Template content cannot be empty")])
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ def add_service_template(service_id):
|
|||||||
|
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
tdao.insert_service_template(
|
tdao.insert_service_template(
|
||||||
form.name.data, form.template_type.data, form.content.data, service_id)
|
form.name.data, form.template_type.data, form.template_content.data, service_id)
|
||||||
return redirect(url_for(
|
return redirect(url_for(
|
||||||
'.manage_service_templates', service_id=service_id))
|
'.manage_service_templates', service_id=service_id))
|
||||||
return render_template(
|
return render_template(
|
||||||
@@ -60,12 +60,14 @@ def edit_service_template(service_id, template_id):
|
|||||||
abort(404)
|
abort(404)
|
||||||
else:
|
else:
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
template['template_content'] = template['content']
|
||||||
form = TemplateForm(**template)
|
form = TemplateForm(**template)
|
||||||
|
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
tdao.update_service_template(
|
tdao.update_service_template(
|
||||||
template_id, form.name.data, form.template_type.data,
|
template_id, form.name.data, form.template_type.data,
|
||||||
form.content.data, service_id)
|
form.template_content.data, service_id)
|
||||||
return redirect(url_for('.manage_service_templates', service_id=service_id))
|
return redirect(url_for('.manage_service_templates', service_id=service_id))
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ GOV.UK Notify | Edit template
|
|||||||
<form method="post">
|
<form method="post">
|
||||||
{{ textbox(form.name) }}
|
{{ textbox(form.name) }}
|
||||||
{{ textbox(form.template_type) }}
|
{{ textbox(form.template_type) }}
|
||||||
{{ textbox(form.content, highlight_tags=True) }}
|
{{ textbox(form.template_content, highlight_tags=True) }}
|
||||||
{{ page_footer(
|
{{ page_footer(
|
||||||
'Save',
|
'Save',
|
||||||
delete_link=url_for('.delete_service_template', service_id=service_id, template_id=template_id) if template_id or None,
|
delete_link=url_for('.delete_service_template', service_id=service_id, template_id=template_id) if template_id or None,
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ def test_should_redirect_when_saving_a_template(app_,
|
|||||||
'id': template_id,
|
'id': template_id,
|
||||||
'name': name,
|
'name': name,
|
||||||
'template_type': type_,
|
'template_type': type_,
|
||||||
"content": content,
|
"template_content": content,
|
||||||
"service": service_id
|
"service": service_id
|
||||||
}
|
}
|
||||||
response = client.post(url_for(
|
response = client.post(url_for(
|
||||||
|
|||||||
Reference in New Issue
Block a user