Merge pull request #1308 from alphagov/inbound-sms-setting

Add settings page for inbound SMS
This commit is contained in:
Chris Hill-Scott
2017-06-12 10:35:19 +01:00
committed by GitHub
7 changed files with 74 additions and 13 deletions

View File

@@ -303,6 +303,15 @@ def service_set_international_sms(service_id):
)
@main.route("/services/<service_id>/service-settings/set-inbound-sms", methods=['GET'])
@login_required
@user_has_permissions('manage_settings', admin_override=True)
def service_set_inbound_sms(service_id):
return render_template(
'views/service-settings/set-inbound-sms.html',
)
@main.route("/services/<service_id>/service-settings/set-letters", methods=['GET'])
@login_required
@user_has_permissions('manage_settings', admin_override=True)

View File

@@ -105,10 +105,8 @@
{% endcall %}
{%- endmacro %}
{% macro boolean_field(yes) -%}
{% call field(status='yes' if yes else 'no') %}
{{ "Yes" if yes else "No" }}
{% endcall %}
{% macro boolean_field(value) -%}
{{ text_field('On' if value else 'Off') }}
{%- endmacro %}
{% macro right_aligned_field_heading(text) %}

View File

@@ -1,5 +1,5 @@
{% extends "withnav_template.html" %}
{% from "components/table.html" import list_table, row, field, boolean_field, hidden_field_heading %}
{% from "components/table.html" import list_table, row, field, hidden_field_heading %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/tick-cross.html" import tick_cross %}

View File

@@ -1,7 +1,7 @@
{% extends "withnav_template.html" %}
{% from "components/banner.html" import banner_wrapper %}
{% from "components/browse-list.html" import browse_list %}
{% from "components/table.html" import mapping_table, row, text_field, edit_field, field %}
{% from "components/table.html" import mapping_table, row, text_field, edit_field, field, boolean_field %}
{% block service_page_title %}
Settings
@@ -47,13 +47,19 @@
{% call row() %}
{{ text_field('International text messages') }}
{{ text_field('On' if current_service.can_send_international_sms else 'Off') }}
{{ boolean_field(current_service.can_send_international_sms) }}
{{ edit_field('Change', url_for('.service_set_international_sms', service_id=current_service.id)) }}
{% endcall %}
{% call row() %}
{{ text_field('Receive text messages') }}
{{ boolean_field('inbound_sms' in current_service.permissions) }}
{{ edit_field('Change', url_for('.service_set_inbound_sms', service_id=current_service.id)) }}
{% endcall %}
{% call row() %}
{{ text_field('Letters') }}
{{ text_field('On' if current_service.can_send_letters else 'Off') }}
{{ boolean_field(current_service.can_send_letters) }}
{{ edit_field('Change', url_for('.service_set_letters', service_id=current_service.id)) }}
{% endcall %}

View File

@@ -0,0 +1,43 @@
{% extends "withnav_template.html" %}
{% from "components/textbox.html" import textbox %}
{% from "components/page-footer.html" import page_footer %}
{% block service_page_title %}
Receive text messages
{% endblock %}
{% block maincolumn_content %}
<div class="grid-row">
<div class="column-five-sixths">
<h1 class="heading-large">Receive text messages</h1>
{% if 'inbound_sms' in current_service.permissions %}
<p>
Your service can receive text messages sent to {{ current_service.sms_sender }}.
</p>
<p>
If you want to turn this feature off,
<a href="{{ url_for('.support') }}">get in touch with the GOV.UK Notify team</a>.
</p>
{% else %}
<p>
Receiving text messages from your users is an
invitation&#8209;only feature.
</p>
<p>
If you want to try it out,
<a href="{{ url_for('.support') }}">get in touch with the GOV.UK Notify team</a>.
</p>
<p>
Well set you up with a special phone number, and youll be able to see
the messages on your dashboard, or get them using the API.
</p>
{% endif %}
{{ page_footer(
back_link=url_for('.service_settings', service_id=current_service.id),
back_link_text='Back to settings'
) }}
</div>
</div>
{% endblock %}

View File

@@ -3,7 +3,7 @@
{% from "components/page-footer.html" import page_footer %}
{% block service_page_title %}
Text message sender
International text messages
{% endblock %}
{% block maincolumn_content %}