Add flow for composing an alert without a template

We think that in some cases alerts will be composed in the moment, and
therefore making people first create a template is:
- not a good use of their time
- adding some conceptual complexity which they don’t need

This commit makes it possible to type some words and have them go
straight into the `content` field in the database.

In the future we might want to progressively enhance the radio buttons
so they show on the same page (like we do with the grey buttons on the
templates page).
This commit is contained in:
Chris Hill-Scott
2020-11-20 15:42:52 +00:00
parent 81b576acad
commit 99b7d8a66f
11 changed files with 380 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
{% from 'components/ajax-block.html' import ajax_block %}
{% from "components/button/macro.njk" import govukButton %}
{% extends "withnav_template.html" %}
@@ -24,4 +25,15 @@
'current_broadcasts'
) }}
{% if current_user.has_permissions('send_messages') %}
<div class="js-stick-at-bottom-when-scrolling">
{{ govukButton({
"element": "a",
"text": "New alert",
"href": url_for('.new_broadcast', service_id=current_service.id),
"classes": "govuk-button--secondary"
}) }}
</div>
{% endif %}
{% endblock %}

View File

@@ -0,0 +1,23 @@
{% from "components/page-header.html" import page_header %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/form.html" import form_wrapper %}
{% extends "withnav_template.html" %}
{% block service_page_title %}
New alert
{% endblock %}
{% block maincolumn_content %}
{{ page_header(
'New alert',
back_link=url_for('.broadcast_dashboard', service_id=current_service.id),
)}}
{% call form_wrapper() %}
{{ form.content }}
{{ page_footer('Continue') }}
{% endcall %}
{% endblock %}

View File

@@ -0,0 +1,49 @@
{% from "components/form.html" import form_wrapper %}
{% from "components/page-header.html" import page_header %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/textbox.html" import textbox %}
{% extends "withnav_template.html" %}
{% block service_page_title %}
New alert
{% endblock %}
{% block maincolumn_content %}
{{ page_header(
'New alert',
back_link=url_for('.new_broadcast', service_id=current_service.id),
)}}
{% call form_wrapper() %}
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
{{ form.name(param_extensions={
"classes": "govuk-!-width-full",
"hint": {"text": "Your recipients will not see this"},
"label": {"text": "Title"}
}) }}
</div>
<div class="govuk-grid-column-two-thirds">
{{ textbox(
form.template_content,
highlight_placeholders=False,
autosize=True,
width='1-1',
rows=5,
extra_form_group_classes='govuk-!-margin-bottom-2'
) }}
</div>
<div class="govuk-grid-column-full">
<div class="template-content-count">
<div data-module="update-status" data-target="template_content" data-updates-url="{{ url_for('.count_content_length', service_id=current_service.id, template_type='broadcast') }}" aria-live="polite">
&nbsp;
</div>
</div>
{{ page_footer('Continue') }}
</div>
</div>
{% endcall %}
{% endblock %}