Commit Graph

10052 Commits

Author SHA1 Message Date
Katie Smith
756a17f8db Add filter for formatting a number as currency
This is used on the usage page, but is likely to become useful in other
places now that letter rates can be greater than £1.
2020-07-15 14:09:49 +01:00
Katie Smith
355e981028 Show international letters on the usage page
The api returns letter details split by postage, so international
letters are returned with a postage of `europe` or `rest-of-world` not
`international` and these rows need to be added together when the rate
is the same before they are displayed on the usage page.

To do this, we need to replace the postage of `europe` and
`rest-of-world` with `international`. The data then needs to be sorted
by postage and rate before the letter units for rows which are
international and have the same rate are added together.
2020-07-15 14:09:49 +01:00
Katie Smith
2a6691f665 Refactor letters code for usage page
No functional changes, but this changes the letter details that are
used for the usage page from a tuple to a named tuple since this makes
it easier to understand.
2020-07-15 14:09:49 +01:00
Tom Byers
0f29b3d64c Merge pull request #3526 from alphagov/revert-3476-introduce-govuk-checkboxes
Revert "Re-introduce govuk checkboxes"
2020-07-15 14:03:04 +01:00
Tom Byers
dfcddb757e Revert "Re-introduce govuk checkboxes" 2020-07-15 13:41:34 +01:00
Tom Byers
86f70ae9fa Merge pull request #3476 from alphagov/introduce-govuk-checkboxes
Re-introduce govuk checkboxes
2020-07-15 13:14:19 +01:00
Chris Hill-Scott
cc925238c7 Merge pull request #3518 from alphagov/view-broadcast-page
Add a page to view a single broadcast
2020-07-15 11:42:45 +01:00
Chris Hill-Scott
da29d35482 Merge pull request #3524 from alphagov/no-templates-message-broadcast
Add ‘no templates’ message for broadcast services
2020-07-15 11:37:56 +01:00
Chris Hill-Scott
de333a7d83 Merge pull request #3519 from alphagov/broadcast-settings
Remove emails, text messages and letter permissions from broadcast services
2020-07-15 09:38:59 +01:00
Chris Hill-Scott
c20958ef34 Clean up test formatting
Ensures that:
- test name reflects what it now does
- only one parameter per line
- argument order in parameterize matches argument order in function
  definition
2020-07-15 09:16:06 +01:00
Chris Hill-Scott
fd05bed600 Remove references to email, text and letters in trial mode
We don’t know what trial mode for broadcast services is going to look
like, but it’s not going to involve sending emails.
2020-07-15 09:14:56 +01:00
Chris Hill-Scott
89dd64cbad Don’t let broadcast re-enable other channels
When a service is switched over to broadcast it has the email, text
message and letter permissions removed. And the links to switch these
settings back on are hidden.

This commit ensures that even if the user manually goes to the URLs for
these pages, they still won’t be able to switch the other channels back
on.
2020-07-15 09:13:46 +01:00
karlchillmaid
aab8e1bb6e Merge pull request #3525 from alphagov/update-roadmap
Update road map
2020-07-14 17:29:02 +01:00
karlchillmaid
62021c0d4d Remove comment-out 2020-07-14 17:20:08 +01:00
karlchillmaid
b689db6cd6 Remove Q1 – move letters to Q2 – commented out 2020-07-14 17:15:49 +01:00
Chris Hill-Scott
9dfa48cfdd Don’t treat letters as a special case
This conditional comes from before we launched the letters feature.
Since we were only giving the letters permission to teams that we were
inviting, we didn’t want to confuse new users by mentioning letters.

Nowadays all new services will have the letters permission, so this
check is redundant.
2020-07-14 15:00:57 +01:00
Chris Hill-Scott
008e4befb4 Add ‘no templates’ message for broadcast services
This shouldn’t talk about emails, text messages or letters.
2020-07-14 14:59:46 +01:00
Chris Hill-Scott
41624295c9 Refactor conditional inside paragraph
This will make it easier to add more branches later.
2020-07-14 14:58:06 +01:00
Tom Byers
6ae9d15141 Add analytics error tracking to checkbox fields
The existing macros added data attributes to any
error message displayed which communicated the
error to Google Analytics (if the user had given
consent).

This re-implements that functionality.
2020-07-14 10:41:09 +01:00
Tom Byers
2ad0d5f18c Convert checkboxes for broadcast areas
Includes removal of MultiCheckboxField due to it
no longer being used elsewhere in this file.
2020-07-14 10:41:09 +01:00
Tom Byers
2b49e5eb7c Make tests work with new template list HTML
Adds the extra text added to each checkbox label.
It's a copy of the text of the link in the same
list item which does add a lot of duplication to
the test data.

This reformats a lot of the test data, stacking it
to separate out the duplicate items.
2020-07-14 10:41:09 +01:00
Tom Byers
67c27fff8c Make template-list checkbox label text match link
The checkboxes need an accessible name that
identifies the folder/template and this needs to
include their full path to avoid duplication.

There's a lot of debate about how to write out
breadcrumb/path syntax so this just puts all the
words together under the assumption that the
folder naming will describe the path (and to
introduce as little extra semantics as possible
to start with).
2020-07-14 10:41:09 +01:00
Tom Byers
a99622aec5 Change HTML for template list items
Moves the link out of the label and increases
the hit-size for the checkbox. The intention is to
reduce the chance of clicking the wrong thing by
accident.

This includes a TODO in the checkboxes component
template code. The item meta needs to be
associated with the checkbox input by use of
`aria-describedby` but this needs changes in
govuk-frontend-jinja to happen.
2020-07-14 10:41:09 +01:00
Tom Byers
05088037d2 Fix issues in tests from new fields 2020-07-14 10:41:09 +01:00
Tom Byers
3b23ae46a7 Remove all unused checkbox macros and imports 2020-07-14 10:41:09 +01:00
Tom Byers
d1ae3b812a Update all single field checkboxes
Includes adding some code to govukCheckboxesField
to add a single boolean-like option by default, if
there are no choices added.
2020-07-14 10:41:09 +01:00
Tom Byers
2cdea66c88 Update templates page
Includes:
- changes to the govukCheckboxesField class
  to allow params to be extended at render time
- updates to templates and folders CSS
2020-07-14 10:41:09 +01:00
Tom Byers
91ce7b32e0 Update manage folder page 2020-07-14 10:41:09 +01:00
Tom Byers
b8aa85e9bb Update permissions page 2020-07-14 10:41:09 +01:00
Tom Byers
a43ab9d0eb Split common checkbox methods off into mixin 2020-07-14 10:41:09 +01:00
Tom Byers
5185f8bae6 Add govukCheckboxField for single checkboxes
Single checkboxes are distinct because:
- they don't need to be wrapped in a `<fieldset>`
- they are a subclass of BooleanField so their
  data is either True or False
2020-07-14 10:41:09 +01:00
Tom Byers
c10969084f Fix nested checkboxes with single top-level node
Nested checkboxes with a single top-level node
will only have one item in their `items` list.
This is because the other choices are children of
that list item.

This means we need to check the `choices`
attribute, which lists all the checkboxes, to see
if they should be marked as a group (by being
wrapped in a `<fieldset>`) or not.
2020-07-14 10:41:09 +01:00
Tom Byers
e0cd3c5efb Add govukCollapsibleNestedCheckboxesField
Includes:
1. changes to make NestedFieldMixin work
  with new fields and CSS for nested checkboxes
2. adds custom version of GOVUK checkboxes
  component to allow us to:
  - add classes to elements currently inaccessible
  - wrap the checkboxes in a list
  - add child checkboxes to each checkbox (making
    tree structures possible through recursion

Change 2. should be pushed upstream to the GOVUK
Design System as a proposal for changes to the
GOVUK Checkboxes component.
2020-07-14 10:41:09 +01:00
Tom Byers
e6e81ec2fe Add mixin & field to make collapsible checkboxes
Allows checkboxes to be collapsed so they take up
less space in the page. The collapsed state
includes a live summary tracking which of them are
selected.

Includes changes to the JS for collapsible
checkboxes to make it work with the GOVUK
Checkboxes component HTML.
2020-07-14 10:41:09 +01:00
Tom Byers
6f4d117e1d Add govukCheckboxesField
govukCheckboxesField subclasses
SelectMultipleField and overwrites how it renders
HTML to let us use the GOVUK Checkboxes component
while retaining all the functionality of WTForms
fields.

Based on work on github.com/richardjpope/recourse:

https://github.com/richardjpope/recourse/blob/master/recourse/forms.py#L6
2020-07-14 10:41:09 +01:00
Tom Byers
d95feb35cf Bring in Jinja and Sass for checkboxes component 2020-07-14 10:41:08 +01:00
Chris Hill-Scott
c17db333d3 Hide email, text message and letter settings
Services with the broadcast permission won’t be able to send emails,
text messages or letters. So we should avoid confusion by removing any
reference to these things.
2020-07-13 09:59:05 +01:00
Chris Hill-Scott
97aca503f7 No emails, texts or letters for broadcast services
To make the interface as simple as possible we don’t want to mix up
sending other types of communication where services have the broadcast
permission.

This commit removes the other permissions once a service has been given
the broadcast permission by a platform admin user.
2020-07-13 09:58:58 +01:00
Chris Hill-Scott
494636937b Merge pull request #3517 from alphagov/underscore-dot
Fix the ‘remove‘ link on broadcast areas
2020-07-10 16:58:36 +01:00
Chris Hill-Scott
2a62ba9cbb Redirect to ‘view’ page after cancelling
This is better confirmation of your action than the dashboard, because
everything will stay the same except the thing you’ve just done.
2020-07-10 15:56:07 +01:00
Chris Hill-Scott
15611d67d3 Remove ‘Stop’ links from dashboard
Now you have to click in to cancel a broadcast instead.
2020-07-10 15:55:52 +01:00
Chris Hill-Scott
7d6dffc098 Add a page to view a single broadcast
This commit adds a page to view a single broadcast. This is important
for two reasons:
- users need an audit of what happened when, and who else was involved
  in approving or cancelling a broadcast
- we need a place to put actions (approving, cancelling) on a broadcast
  so that you can confirm details of the message and the areas before
  performing the action
2020-07-10 15:55:05 +01:00
Chris Hill-Scott
9723b34c5b Fix the ‘remove‘ link on broadcast areas 2020-07-10 14:35:17 +01:00
Chris Hill-Scott
1a79a037f6 Merge pull request #3516 from alphagov/cancel-broadcast
Support cancelling and sorting of broadcasts on the dashboard
2020-07-10 10:04:39 +01:00
Chris Hill-Scott
9a1f2b2555 Make ended broadcast status less prominent 2020-07-10 09:57:06 +01:00
Chris Hill-Scott
3136d1a33b Implement sorting
Shows the broadcasts with the longest time still to live at the top. At
the moment this will be the same as the newest broadcasts, so we may
want to revisit this sort order when we have broadcasts of variable
duration.

For no-longer-live broadcasts we show the most-recently-finished at the
top, whether it finished naturally or was cancelled.
2020-07-10 09:57:06 +01:00
Chris Hill-Scott
b57bbd4642 Fix back link 2020-07-10 09:57:06 +01:00
Chris Hill-Scott
44e177b402 Allow broadcasts to be cancelled
Currently this is a `get` request from the dashboard. Once we have a page
for viewing an individual broadcast it should probably show there
instead and be a `get`/confirm/`post` loop like for deleting a template.
2020-07-10 09:57:06 +01:00
Chris Hill-Scott
23cd6b9c9e Merge pull request #3514 from alphagov/broadcast-dashboard
Broadcast dashboard
2020-07-10 08:43:57 +01:00
Chris Hill-Scott
bddcd18e11 Fix wonky spacing
Got this wrong in a previous commit. `0` made it too tight.
2020-07-09 16:34:03 +01:00