Allow user to add multiple reply-to addresses

This commit is contained in:
chrisw
2017-09-25 15:14:13 +01:00
parent fe541b849b
commit f012ec57c0
12 changed files with 533 additions and 75 deletions

View File

@@ -25,7 +25,6 @@
{%- endmacro %}
{% macro list_table(items, caption='', empty_message='', field_headings=[], field_headings_visible=True, caption_visible=True) -%}
{% set parent_caller = caller %}
{% call mapping_table(caption, field_headings, field_headings_visible, caption_visible) %}

View File

@@ -45,11 +45,15 @@
{% call row() %}
{{ text_field('Email reply to address') }}
{{ text_field(
current_service.reply_to_email_address,
status='' if current_service.reply_to_email_address else 'default'
) }}
{{ edit_field('Change', url_for('.service_set_reply_to_email', service_id=current_service.id)) }}
{% call field() %}
{{ default_reply_to_email_address }}
{% if reply_to_email_address_count > 1 %}
<div class="hint">
{{ '…and %d more' | format(reply_to_email_address_count - 1) }}
</div>
{% endif %}
{% endcall %}
{{ edit_field('Change', url_for('.service_email_reply_to', service_id=current_service.id)) }}
{% endcall %}
{% endif %}

View File

@@ -0,0 +1,33 @@
{% extends "withnav_template.html" %}
{% from "components/textbox.html" import textbox %}
{% from "components/checkbox.html" import checkbox %}
{% from "components/page-footer.html" import page_footer %}
{% block service_page_title %}
Add email reply to address
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-large">
Add email reply to address
</h1>
<form method="post" novalidate>
{{ textbox(
form.email_address,
width='2-3',
safe_error_message=True
) }}
{% if not first_email_address %}
<div class="form-group">
{{ checkbox(form.is_default) }}
</div>
{% endif %}
{{ page_footer(
'Add',
back_link=url_for('.service_email_reply_to', service_id=current_service.id),
back_link_text='Back'
) }}
</form>
{% endblock %}

View File

@@ -0,0 +1,35 @@
{% extends "withnav_template.html" %}
{% from "components/textbox.html" import textbox %}
{% from "components/checkbox.html" import checkbox %}
{% from "components/page-footer.html" import page_footer %}
{% block service_page_title %}
Edit email reply to address
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-large">
Edit email reply to address
</h1>
<form method="post">
{{ textbox(
form.email_address,
width='2-3',
safe_error_message=True
) }}
{% if form.is_default.data %}
<p> This email address is the default </p>
{% else %}
<div class="form-group">
{{ checkbox(form.is_default) }}
</div>
{% endif %}
{{ page_footer(
'Save',
back_link=url_for('.service_email_reply_to', service_id=current_service.id),
back_link_text='Back'
) }}
</form>
{% endblock %}

View File

@@ -0,0 +1,45 @@
{% extends "withnav_template.html" %}
{% from "components/textbox.html" import textbox %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/table.html" import row_group, row, text_field, edit_field, field, boolean_field, list_table %}
{% block service_page_title %}
Email reply to addresses
{% endblock %}
{% block maincolumn_content %}
<div class="grid-row bottom-gutter">
<div class="column-two-thirds">
<h1 class="heading-large">
Email reply to addresses
</h1>
</div>
<div class="column-one-third">
<a href="{{ url_for('.service_add_email_reply_to', service_id=current_service.id) }}" class="button align-with-heading">Add email address</a>
</div>
</div>
<div class="bottom-gutter-3-2 body-copy-table">
{% call(item, row_number) list_table(
reply_to_email_addresses,
empty_message="You havent added any email addresses yet.",
caption="Reply to email addresses",
caption_visible=false,
field_headings=[
'Email addresses',
'Action'
],
field_headings_visible=False
) %}
{% call field() %}
{{ item.email_address }}
{% if item.is_default %}
<span class="hint">
{{ "(default)" }}
</span>
{% endif %}
{% endcall %}
{{ edit_field('Change', url_for('.service_edit_email_reply_to', service_id =current_service.id, reply_to_email_id = item.id)) }}
{% endcall %}
</div>
{% endblock %}