Commit Graph

10068 Commits

Author SHA1 Message Date
Chris Hill-Scott
a1f063c9aa Merge pull request #3529 from alphagov/hint-status-pending-broadcast
Make the status text of pending broadcasts grey
2020-07-17 09:36:29 +01:00
Chris Hill-Scott
b3b2097556 Make the status text of pending broadcasts grey
Only live broadcasts have their status in black text. This is to
emphasise them. Lost this in a merge conflict somewhere.
2020-07-17 08:37:19 +01:00
Chris Hill-Scott
ca292037e7 Merge pull request #3522 from alphagov/broadcast-approval
Add an approval loop for broadcasts
2020-07-17 08:18:34 +01:00
Chris Hill-Scott
03b4aabf5f Add a link to reject a broadcast
If a broadcast definitely shouldn’t go out (for example because it has a
spelling mistake or is going to the wrong areas) then we should have a
way of removing it. Once it’s removed no-one else can approve it, and it
isn’t cluttering up the dashboard.

This is a link (because it’s a secondary action) and red (because it’s
destructive, in that it’s throwing away someone’s work).
2020-07-17 08:07:44 +01:00
Chris Hill-Scott
a99b40304b Add button to approve broadcast
Since new broadcasts will go into `pending-approval`, we now need a way
of approving them.

This commit adds a button to this page to start (or approve) the
broadcast. This button is wrapped in a bordered box, to emphasise that
it’s something consequential.
2020-07-17 08:07:44 +01:00
Chris Hill-Scott
5b83db9768 Don’t start broadcasts immediately
We don’t want one person going full yolo and start broadcasting without
any oversight. This commit changes the flow so that the button on the
‘preview’ page puts the broadcast into `pending-approval`, rather than
directly into `broadcasting`.
2020-07-17 08:07:43 +01:00
Chris Hill-Scott
4b1e3ec504 Refactor broadcast message model
There was a lot of duplicate code here for updating the status and other
properties of a broadcast.

This commit abstracts them into reusable methods. They’re named with an
underscore to suggest that they shouldn’t be used externally.
2020-07-17 08:07:42 +01:00
Chris Hill-Scott
73c5aa9bb7 Add page for broadcast in pending state
Since we’ll be linking to pending broadcasts from the dashboard, the
page needs to be ready to display them.

Pending broadcasts lack a few bits of information that live or previous
broadcasts have (like the start date for example). So this commit hides
the code that displays those bits of information.
2020-07-17 08:07:41 +01:00
Chris Hill-Scott
c270688fe4 Show pending broadcasts on dashboard
When we have an approval flow, `pending-approval` will be the state a
broadcast is in between being a draft and broadcasting.

This means it is the earliest stage at which a broadcast can appear on
the dashboard, so this commit adds a new section at the top of the
dashboard to display these broadcasts (since the dashboard is in a
reverse chronological order).

Rather than displaying the scheduled time, the extra information shown
is the person who drafted the broadcast, since I reckon you’ll be coming
to this page because they’ve asked you to approve their broadcast.
2020-07-17 08:07:40 +01:00
Chris Hill-Scott
7b00e3c5b9 Merge pull request #3523 from alphagov/broadcast-dashboard-ajax
Make the broadcast dashboard update via AJAX
2020-07-16 16:53:01 +01:00
Chris Hill-Scott
352388e92a Fix keyline width on empty dashboard tables
The styling of the empty message seems to conflict with the hard-coded
widths added by the `dashboard-table` class. So we should only add the
`dashboard-table` class when there is content we need to control the
width of.
2020-07-16 16:47:16 +01:00
Chris Hill-Scott
5229373341 Make the broadcast dashboard update via AJAX
Same technique as we use for other pages that update via AJAX.

I’ve split the page up into separate chunks because the DiffDOM library
we use finds it easier to work out what’s changed when there are fewer
elements/a shallower tree.
2020-07-16 16:47:08 +01:00
Chris Hill-Scott
414e4b5834 Merge pull request #3520 from alphagov/broadcast-user-permissions
Make user permissions make sense for services with the broadcast permission
2020-07-16 14:59:57 +01:00
Katie Smith
da1a280f7c Merge pull request #3515 from alphagov/update-usage-page-2
Update usage page to display international letters
2020-07-15 14:21:22 +01:00
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