Rewrite SMS ratio form to cope with 3 providers

This replaces the slider with an integer input for each provider.
Unfortunately showing a variable number of inputs isn't easy to
achieve in WTForms [^1], but we think this is the least worst way
to do it vs e.g. not using WTForms at all.

[^1]: https://github.com/wtforms/wtforms/issues/736
This commit is contained in:
Ben Thorner
2022-04-06 15:08:28 +01:00
parent 01389b5edf
commit 7f333ba5fe
5 changed files with 46 additions and 132 deletions

View File

@@ -4,44 +4,22 @@
{% from "components/form.html" import form_wrapper %}
{% block per_page_title %}
Text message providers
Edit SMS provider priorities
{% endblock %}
{% block platform_admin_content %}
{{ page_header('Text message providers') }}
{{ page_header('Edit SMS provider priorities') }}
<p class="govuk-body">
If you change one priority you will need to change the others so they add up to 100%.
</p>
<h2 class="heading-small top-gutter">
Now
</h2>
<div class="bottom-gutter">
<div class="history-list-item">
<div class="govuk-grid-row">
<div class="govuk-grid-column-one-third">&nbsp;</div>
<div class="govuk-grid-column-two-thirds">
<div class="history-list-percentage-without-border">
<div class="history-list-percentage-left-label">
{{ first_provider }}
</div>
<div class="history-list-percentage-right-label">
{{ second_provider }}
</div>
{% call form_wrapper() %}
<div class="radio-slider" data-module="radio-slider">
{{ form.ratio }}
<div class="radio-slider-left-value">
</div>
<div class="radio-slider-right-value">
</div>
</div>
{{ page_footer('Update', centered_button=True) }}
{% endcall %}
</div>
</div>
</div>
</div>
</div>
{% call form_wrapper() %}
{% for field in form %}
{{ field }}
{% endfor %}
{{ page_footer('Save') }}
{% endcall %}
{% endblock %}