Merge pull request #1540 from alphagov/reply-inbound

Let users reply to an inbound message with an existing template
This commit is contained in:
Chris Hill-Scott
2017-10-18 12:33:42 +01:00
committed by GitHub
9 changed files with 234 additions and 10 deletions

View File

@@ -22,6 +22,12 @@
'messages',
) }}
{% if current_user.has_permissions(['send_texts'], admin_override=True) %}
<p>
<a href="{{ url_for('.conversation_reply', service_id=current_service.id, notification_id=notification_id) }}">Send a text message to this phone number</a>
</p>
{% endif %}
</div>
{% endblock %}

View File

@@ -42,4 +42,10 @@
{{ ajax_block(partials, updates_url, 'status', finished=finished) }}
{% endif %}
{% if current_user.has_permissions(['send_texts'], admin_override=True) and template.template_type == 'sms' and can_receive_inbound %}
<p>
<a href="{{ url_for('.conversation', service_id=current_service.id, notification_id=notification_id, _anchor='n{}'.format(notification_id)) }}">See all text messages sent to this phone number</a>
</p>
{% endif %}
{% endblock %}

View File

@@ -0,0 +1,10 @@
{% if show_search_box %}
<div data-module="autofocus">
<div class="live-search" data-module="live-search" data-targets="#template-list .column-whole">
{{ textbox(
search_form.search,
width='1-1'
) }}
</div>
</div>
{% endif %}

View File

@@ -0,0 +1,47 @@
{% from "components/pill.html" import pill %}
{% from "components/message-count-label.html" import message_count_label %}
{% from "components/textbox.html" import textbox %}
{% extends "withnav_template.html" %}
{% block service_page_title %}
Choose a template
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-large">Choose a template</h1>
{% if not templates %}
{% if current_user.has_permissions(permissions=['manage_templates'], any_=True) %}
<p class="bottom-gutter">
You need a template before you can send text messages.
</p>
<a href="{{ url_for('.add_template_by_type', service_id=current_service.id) }}" class="button">Add a new template</a>
{% else %}
<p>
You need to ask your service manager to add templates before you
can send text messages.
</p>
{% endif %}
{% else %}
{% include "views/templates/_search-box.html" %}
<nav class="grid-row" id=template-list>
{% for template in templates %}
<div class="column-whole">
<h2 class="message-name">
<a href="{{ url_for('.conversation_reply_with_template', service_id=current_service.id, template_id=template.id, notification_id=notification_id) }}">{{ template.name }}</a>
</h2>
<p class="message-type">
{{ message_count_label(1, template.template_type, suffix='')|capitalize }} template
</p>
</div>
{% endfor %}
</nav>
{% endif %}
{% endblock %}

View File

@@ -54,16 +54,7 @@
</div>
{% endif %}
{% if show_search_box %}
<div data-module="autofocus">
<div class="live-search" data-module="live-search" data-targets="#template-list .column-whole">
{{ textbox(
search_form.search,
width='1-1'
) }}
</div>
</div>
{% endif %}
{% include "views/templates/_search-box.html" %}
<nav class="grid-row" id=template-list>
{% for template in templates %}