Commit Graph

10019 Commits

Author SHA1 Message Date
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
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
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
Chris Hill-Scott
6b822f9fde Add broadcasts to the dashboard
Shows current and previous broadcasts. Does not add a page for viewing
an individual broadcast.

Broadcasts are split into live and previous.

Draft broadcasts are excluded from the dashboard.
2020-07-09 16:32:15 +01:00
Chris Hill-Scott
78bda9d267 Merge pull request #3512 from alphagov/make-broadcast-flow-talk-to-api
Make the flow to create a broadcast talk to the API
2020-07-09 16:24:13 +01:00
Chris Hill-Scott
6d566b116d Merge pull request #3513 from alphagov/selected-area-state
Visually tweak selected area state
2020-07-09 15:28:18 +01:00
Chris Hill-Scott
effe24893e Make the broadcast flow talk to the API
This commit removes the code the puts areas into the session and instead
creates and then updates a draft broadcast in the database.

This is so we can avoid session-related bugs, and potentially having a
large session when we start adding personalisation etc.

Once a broadcast is ready to go it is set to `broadcasting` straight
away with no approval. We’ll revisit this as we learn more about how
users might want to manage who can create and approve broadcasts.

The tests are a bit light in terms of checking what’s on the page, but
clicking through the pages is probably good enough for now.
2020-07-09 14:31:12 +01:00
Chris Hill-Scott
3b494a5efd Visually tweak selected area state
This brings it back a bit closer to the page with the map, so the two
feel cohesive, while still making the selected areas look different to
textboxes.
2020-07-09 14:13:35 +01:00
Chris Hill-Scott
2c33325dc2 Merge pull request #3511 from alphagov/style-broadcast-message
Add some styling to broadcast messages
2020-07-09 13:55:19 +01:00
David McDonald
868e2b0ee8 Merge pull request #3510 from alphagov/bump-gds-metrics
Bump gds metrics to 0.2.2 to bring in bug fix
2020-07-09 13:12:09 +01:00
Chris Hill-Scott
4d0da6594d Add style for areas once selected
Just having them in the boxes with the 2px black border made them look
too much like textboxes.
2020-07-08 17:41:20 +01:00
Chris Hill-Scott
846fcbb8dd Add a rendered template to the preview page 2020-07-08 17:31:51 +01:00
Chris Hill-Scott
0cf3124f73 Add some styling to broadcast messages
This is borrowed from an earlier prototype, and is meant to be temporary
– something better than just plain text.

Text in generated content isn’t always announced by screen readers, so
we should definitely move away from that once we understand what text
will be shown on the phone and where it comes from.
2020-07-08 17:24:08 +01:00
David McDonald
4ee15c94c4 Bump gds metrics to 0.2.2 to bring in bug fix
https://github.com/alphagov/gds_metrics_python/blob/master/CHANGELOG.md#021

This will mean that if an exception is thrown in any `before_request`
functions that run before the gds metrics `before_request` function,
then we will no longer throw an uncaught exception.

Note, this could still be the case (and has been seen in production) as
`init_app(application)` in `create_app` in `init.py` can indeed throw
exceptions, for example when it can't find the current service. We could
move our init app for gds metrics further up if we wanted to to further
counter this.
2020-07-08 16:26:28 +01:00
Chris Hill-Scott
ea1c9f4059 Merge pull request #3509 from alphagov/fix-broadcast-library-examples
Fix examples on choose broadcast library page
2020-07-08 16:22:44 +01:00
Chris Hill-Scott
77a4c1ccb8 Merge pull request #3508 from alphagov/remove-template-id-redaction-broadcasts
Hide template ID and redaction for broadcast templates
2020-07-08 16:22:18 +01:00
Chris Hill-Scott
11032a1e7a Fix examples on choose broadcast library page
It should be `.get_examples()` (a method) not `.examples` (a property)
but Jinja swallows the error and prints nothing.
2020-07-08 16:02:16 +01:00
Chris Hill-Scott
60f9ea5f9c Hide template ID and redaction for broadcast templates
We’re not going to have an API for sending broadcasts at the moment, so
you don’t need the template ID for anything.

Broadcast also won’t contain personal information, or tokenised links,
etc, so there’s no need to redact them after sending.

Removing this things means the interface is less cluttered.
2020-07-08 15:49:32 +01:00
Chris Hill-Scott
33ab9171e2 Merge pull request #3507 from alphagov/duplicate-search-search
Remove duplicate live search control
2020-07-08 15:25:10 +01:00
Chris Hill-Scott
653b6b3601 Fix test broken by merging
The test came from one branch, the correct value came from another.
2020-07-08 15:12:29 +01:00
Chris Hill-Scott
a034ee0e1f Remove duplicate live search control
I must have introduced this while resolving a merge conflict. Oops.
2020-07-08 15:06:05 +01:00
Chris Hill-Scott
641bd41f8f Merge pull request #3506 from alphagov/broadcast-dashboard
Add a dashboard for broadcast services
2020-07-08 14:59:30 +01:00
Chris Hill-Scott
dd45fb99c6 Merge pull request #3505 from alphagov/broadcast-navigation
Hide irrelevant things from nav for broadcast services
2020-07-08 14:59:25 +01:00
Chris Hill-Scott
5c52d3c362 Redirect from normal dashboard to broadcast dashboard
There are lots of places where we redirect people to the dashboard, for
example after logging in. Rather than add logic to all these places to
check for the broadcast permission, let’s just redirect from the normal
dashboard to the broadcast dashboard.

Other places like the main navigation can still link directly to the
broadcast dashboard, where we do care about speed and not going through
multiple redirect jumps.
2020-07-08 14:18:13 +01:00
Chris Hill-Scott
6ec9a25dd1 Add a dashboard for broadcast services
This is just a placeholder for now
2020-07-08 14:18:13 +01:00
Chris Hill-Scott
255be194a6 Merge pull request #3500 from alphagov/choose-broadcast-area-flow
Add flow for choosing an area to broadcast to
2020-07-08 14:14:57 +01:00
David McDonald
4057506acc Merge pull request #3504 from alphagov/pyup-scheduled-update-2020-07-06
Scheduled weekly dependency update for week 27
2020-07-08 11:31:08 +01:00
Chris Hill-Scott
773f0b9ce7 Add search form
There can be lots of areas in a library, for example local councils. So
when there is, let’s allow people to do the find-as-you-type thing we
support in lots of other places.
2020-07-08 10:28:14 +01:00
Chris Hill-Scott
29ad5cf510 Add a form for choosing areas
Picking multiple areas at once definitely feels like a need, so let’s
make them checkboxes.
2020-07-08 10:28:04 +01:00
Chris Hill-Scott
49444221e9 Style the area labels and polygons
Gives them some colours, borders and stuff to make them visually
consistent with the rest of Notify.

The idea is the tags and polygons have a similar affordances (i.e.
border thickness, colour) to visually link them and imply that they are
two representations of the same thing.
2020-07-08 10:27:57 +01:00
Chris Hill-Scott
d0d3fc6857 Add a map
So you can check you’ve chosen the right areas, and to give you a clear
idea of where the boundaries of an area are.

The Javascript and CSS for the map is only loaded on this page because
it adds quite a few kb, and we don’t want to be sending assets to the
majority of our users who will never see them.
2020-07-08 10:27:50 +01:00
Chris Hill-Scott
18d464d4f0 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
2020-07-08 10:27:42 +01:00
Chris Hill-Scott
59470e9d6d Hide irrelevant things from nav for broadcast services
Services doing broadcasts wont:
- incur costs, so don’t need to see the usage page
- be sending anything by uploading, so don’t need to see the uploads
  page
- (for now) be sending anything using the API, so don’t need to see the
  API integration page
2020-07-08 09:57:32 +01:00
David McDonald
96470dbd1f make freeze requirements 2020-07-06 16:00:05 +01:00
pyup-bot
eb0b68f368 Update humanize from 2.4.1 to 2.5.0 2020-07-06 14:52:02 +01:00
Chris Hill-Scott
b833d83205 Merge pull request #3503 from alphagov/bump-utils-40.2.1
Bump utils to 40.2.1
2020-07-06 09:58:27 +01:00