Add some views for selecting broadcast areas

These are just so we have some pages to click through for now. They
don’t use real templates, or any of the broadcast stuff from the
database.

But I think it’s useful to get some skeleton pages in first so that we
can see the map etc working in production, then build on that, without
having to do it all in one mega PR.

For that reason there are two short term things I’ve done in this commit
which should be revisited soon:
- no tests for the endpoints
- data about which areas are selected is stored in the session
This commit is contained in:
Chris Hill-Scott
2020-07-06 10:53:14 +01:00
parent b833d83205
commit 18d464d4f0
12 changed files with 402 additions and 5 deletions

View File

@@ -0,0 +1,20 @@
{% from "components/page-header.html" import page_header %}
{% extends "withnav_template.html" %}
{% block service_page_title %}
{{ page_title }}
{% endblock %}
{% block maincolumn_content %}
{{ page_header(
regions.name,
back_link=url_for('.choose_broadcast_library', service_id=current_service.id),
)}}
{% for area in areas %}
<h2 class="govuk-heading-m"><a class="govuk-link govuk-link--no-visited-state" href="{{ url_for('.add_broadcast_area', service_id=current_service.id, area_slug=area.id) }}">{{ region.name }}</a></h2>
{% endfor %}
{% endblock %}

View File

@@ -0,0 +1,21 @@
{% from "components/page-header.html" import page_header %}
{% extends "withnav_template.html" %}
{% block service_page_title %}
Choose where to broadcast to
{% endblock %}
{% block maincolumn_content %}
{{ page_header(
"Choose where to broadcast to",
back_link=url_for(".preview_broadcast_areas", service_id=current_service.id)
) }}
{% for library in libraries|sort %}
<a class="file-list-filename-large govuk-link govuk-link--no-visited-state" href="{{ url_for('.choose_broadcast_area', service_id=current_service.id, library_slug=library.id) }}">{{ library.name }}</a>
<p class="file-list-hint-large">{{ library.examples }}</p>
{% endfor %}
{% endblock %}

View File

@@ -0,0 +1,47 @@
{% from "components/button/macro.njk" import govukButton %}
{% from "components/page-header.html" import page_header %}
{% from "components/page-footer.html" import sticky_page_footer %}
{% extends "withnav_template.html" %}
{% block service_page_title %}
Choose where to broadcast to
{% endblock %}
{% block maincolumn_content %}
{{ page_header("Choose where to broadcast to", back_link="#") }}
{% for area in selected %}
{{ area.name }} (<a href="{{ url_for('.remove_broadcast_area', service_id=current_service.id, area_slug=area.id) }}">remove</a>)&ensp;
{% if loop.last %}
<p class="govuk-body">
{{ govukButton({
"element": "a",
"text": "Add another area",
"href": url_for('.choose_broadcast_library', service_id=current_service.id),
"classes": "govuk-button--secondary govuk-!-margin-top-2"
}) }}
</p>
{% endif %}
{% else %}
<p class="govuk-body">
{{ govukButton({
"element": "a",
"text": "Add broadcast areas",
"href": url_for('.choose_broadcast_library', service_id=current_service.id),
"classes": "govuk-button--secondary"
}) }}
</p>
{% endfor %}
{% if selected %}
{% for area in area_polygons %}
{{ area }}<br><br>
{% endfor %}
<form action="{{ url_for('.preview_broadcast_message', service_id=current_service.id) }}" method="get">
{{ sticky_page_footer('Continue to preview') }}
</form>
{% endif %}
{% endblock %}

View File

@@ -0,0 +1,41 @@
{% from "components/button/macro.njk" import govukButton %}
{% from "components/form.html" import form_wrapper %}
{% from "components/page-header.html" import page_header %}
{% from "components/page-footer.html" import sticky_page_footer %}
{% extends "withnav_template.html" %}
{% block service_page_title %}
Preview message
{% endblock %}
{% block maincolumn_content %}
{{ page_header("Preview message", back_link=url_for('.preview_broadcast_areas', service_id=current_service.id)) }}
{% for region in selected %}
{% if loop.first %}
<ul class="region-list">
{% endif %}
<li class="region-list-item">
{{ region.name }}
</li>
{% if loop.last %}
</ul>
{% endif %}
{% endfor %}
{% if selected %}
<p class="govuk-body">
{{ "<message here>" }}
</p>
{% call form_wrapper() %}
{{ sticky_page_footer('Start broadcast') }}
{% endcall %}
{% endif %}
{% endblock %}

View File

@@ -29,8 +29,15 @@
</div>
{% endif %}
{% elif template.template_type == 'broadcast' %}
{% if current_user.has_permissions('send_messages') %}
<div class="govuk-grid-column-one-half">
<a href="{{ url_for(".broadcast", service_id=current_service.id) }}" class="govuk-link govuk-link--no-visited-state pill-separate-item">
Prepare broadcast
</a>
</div>
{% endif %}
{% if current_user.has_permissions('manage_templates') %}
<div class="govuk-grid-column-full">
<div class="govuk-grid-column-one-half">
<a href="{{ url_for(".edit_service_template", service_id=current_service.id, template_id=template.id) }}" class="govuk-link govuk-link--no-visited-state pill-separate-item">
Edit
</a>