Add option to copy existing template when adding

Sometimes when setting up a service you might have a few very similar
templates, in which only a small amount of content. Or you might even
have a few of services, which are used by different teams but have
similar templates.

Copy and pasting, especially from one service to another, is a pain.
This commit makes it easier by allowing users to copy an existing
template when choosing to add a new one, instead of starting from
scratch.
This commit is contained in:
Chris Hill-Scott
2018-07-19 12:30:04 +01:00
parent 078096eecc
commit 19632ea4ab
12 changed files with 293 additions and 10 deletions

View File

@@ -13,7 +13,10 @@
{{ heading_action }} email template
</h1>
<form method="post">
<form
method="post"
action="{{ url_for('.add_service_template', service_id=current_service.id, template_type=template_type) }}"
>
<div class="grid-row">
<div class="column-five-sixths">
{{ textbox(form.name, width='1-1', hint='Your recipients wont see this', rows=10) }}

View File

@@ -12,7 +12,10 @@
{{ heading_action }} letter template
</h1>
<form method="post">
<form
method="post"
action="{{ url_for('.add_service_template', service_id=current_service.id, template_type=template_type) }}"
>
<div class="grid-row">
<div class="column-five-sixths">
{{ textbox(form.name, width='1-1', hint='Your recipients wont see this', rows=10) }}

View File

@@ -13,7 +13,10 @@
{{ heading_action }} text message template
</h1>
<form method="post">
<form
method="post"
action="{{ url_for('.add_service_template', service_id=current_service.id, template_type=template_type) }}"
>
<div class="grid-row">
<div class="column-two-thirds">
{{ textbox(form.name, width='1-1', hint='Your recipients wont see this') }}

View File

@@ -0,0 +1,36 @@
{% from "components/message-count-label.html" import message_count_label %}
{% extends "withnav_template.html" %}
{% block service_page_title %}
Copy an existing template
{% endblock %}
{% block maincolumn_content %}
<div class="bottom-gutter-3-2">
<h1 class="heading-large">Copy an existing template</h1>
</div>
<nav>
{% for service in services %}
{% if service.templates and services|length > 1 %}
<h2 class="">
{{ service.name }}
</h2>
<div class="left-gutter-4-3 bottom-gutter-3-2">
{% endif %}
{% for template in service.templates %}
<h2 class="message-name">
<a href="{{ url_for('.copy_template', service_id=current_service.id, template_id=template.id, from_service=service.id) }}">{{ template.name }}</a>
</h2>
<p class="message-type">
{{ message_count_label(1, template.template_type, suffix='')|capitalize }} template
</p>
{% endfor %}
{% if service.templates %}
</div>
{% endif %}
{% endfor %}
</nav>
{% endblock %}