mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-10 01:55:41 -04:00
Edit, don’t duplicate, existing templates
This commit is contained in:
@@ -287,6 +287,10 @@ def copy_template(service_id, template_id):
|
|||||||
request.args.get('from_service'),
|
request.args.get('from_service'),
|
||||||
str(template_id),
|
str(template_id),
|
||||||
)['data']
|
)['data']
|
||||||
|
|
||||||
|
if request.method == 'POST':
|
||||||
|
return add_service_template(service_id, template['template_type'])
|
||||||
|
|
||||||
template['template_content'] = template['content']
|
template['template_content'] = template['content']
|
||||||
template['name'] = 'Copy of ‘{}’'.format(template['name'])
|
template['name'] = 'Copy of ‘{}’'.format(template['name'])
|
||||||
form = form_objects[template['template_type']](**template)
|
form = form_objects[template['template_type']](**template)
|
||||||
@@ -458,7 +462,7 @@ def edit_service_template(service_id, template_id):
|
|||||||
form=form,
|
form=form,
|
||||||
template_id=template_id,
|
template_id=template_id,
|
||||||
template_type=template['template_type'],
|
template_type=template['template_type'],
|
||||||
heading_action='Edit'
|
heading_action='Edit',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,10 +13,7 @@
|
|||||||
{{ heading_action }} email template
|
{{ heading_action }} email template
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<form
|
<form method="post">
|
||||||
method="post"
|
|
||||||
action="{{ url_for('.add_service_template', service_id=current_service.id, template_type=template_type) }}"
|
|
||||||
>
|
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<div class="column-five-sixths">
|
<div class="column-five-sixths">
|
||||||
{{ textbox(form.name, width='1-1', hint='Your recipients won’t see this', rows=10) }}
|
{{ textbox(form.name, width='1-1', hint='Your recipients won’t see this', rows=10) }}
|
||||||
|
|||||||
@@ -12,10 +12,7 @@
|
|||||||
{{ heading_action }} letter template
|
{{ heading_action }} letter template
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<form
|
<form method="post">
|
||||||
method="post"
|
|
||||||
action="{{ url_for('.add_service_template', service_id=current_service.id, template_type=template_type) }}"
|
|
||||||
>
|
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<div class="column-five-sixths">
|
<div class="column-five-sixths">
|
||||||
{{ textbox(form.name, width='1-1', hint='Your recipients won’t see this', rows=10) }}
|
{{ textbox(form.name, width='1-1', hint='Your recipients won’t see this', rows=10) }}
|
||||||
|
|||||||
@@ -13,10 +13,7 @@
|
|||||||
{{ heading_action }} text message template
|
{{ heading_action }} text message template
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<form
|
<form method="post">
|
||||||
method="post"
|
|
||||||
action="{{ url_for('.add_service_template', service_id=current_service.id, template_type=template_type) }}"
|
|
||||||
>
|
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<div class="column-two-thirds">
|
<div class="column-two-thirds">
|
||||||
{{ textbox(form.name, width='1-1', hint='Your recipients won’t see this') }}
|
{{ textbox(form.name, width='1-1', hint='Your recipients won’t see this') }}
|
||||||
|
|||||||
@@ -477,11 +477,6 @@ def test_load_edit_template_with_copy_of_template(
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert page.select_one('form')['method'] == 'post'
|
assert page.select_one('form')['method'] == 'post'
|
||||||
assert page.select_one('form')['action'] == url_for(
|
|
||||||
'main.add_service_template',
|
|
||||||
service_id=SERVICE_ONE_ID,
|
|
||||||
template_type='email',
|
|
||||||
)
|
|
||||||
|
|
||||||
assert page.select_one('input')['value'] == (
|
assert page.select_one('input')['value'] == (
|
||||||
'Copy of ‘Two week reminder’'
|
'Copy of ‘Two week reminder’'
|
||||||
|
|||||||
Reference in New Issue
Block a user