Commit Graph

10239 Commits

Author SHA1 Message Date
Tom Byers
8659e46828 Remove skiplink & fix table caption on bulk send
error pages

The skiplink in those pages is in the error summary
at the top. In this case, it seems redundant
because:
- it jumps to a section of the page just below it
- the section it would jump to is the only error
  on the page

Because of this, and because The Digital
Accessibility Centre (DAC) reported that the
skiplinks in these pages may not be needed, we
decided to remove it.

This commit also adds a prefix to the table caption to
indicate that it only contains the errors from the
CSV, not the rest of its contents.
2020-08-19 11:29:17 +01:00
Pea Tyczynska
9451531bc6 Fix first skip to contents link
It was invisible at all times. Now it is visible when selected.
This will help keyboard users take advantage of it.
2020-08-19 11:28:49 +01:00
David McDonald
8e9e169961 Merge pull request #3577 from alphagov/pyup-scheduled-update-2020-08-17
Scheduled weekly dependency update for week 33
2020-08-18 10:16:16 +01:00
David McDonald
06c844b7cb make freeze requirements 2020-08-18 09:55:52 +01:00
pyup-bot
e3a0aa2798 Update humanize from 2.5.0 to 2.6.0 2020-08-17 14:53:02 +01:00
Pea M. Tyczynska
3bbce24b06 Merge pull request #3558 from alphagov/only-allow-new-template-if-permission-is-there
Services can only create templates of types they have turned on
2020-08-17 14:39:16 +01:00
karlchillmaid
6b4ee2f7e0 Merge pull request #3576 from alphagov/postage-letter-features-update
Update postage section of letters features
2020-08-17 13:58:21 +01:00
Chris Hill-Scott
95078d2d51 Change page title on new broadcast template page
Since broadcast services can only have one type of template we probably
don’t need to disambiguate what kind of template you’re creating.

And you’ve just come from a page where the button says ‘New template’,
without the choice of radios after, so it’s nice for the page title to
match that.
2020-08-17 13:01:33 +01:00
karlchillmaid
280f6226d9 Update letters.html 2020-08-17 12:55:29 +01:00
David McDonald
f003c6df32 Merge pull request #3575 from alphagov/row-scope
Bump utils to bring in accessibility fix
2020-08-17 09:36:37 +01:00
Pea Tyczynska
36c1ffa7be New template button takes user to new template page
for all services that only allow sending one type of notifications
2020-08-14 17:15:45 +01:00
Pea Tyczynska
bdfc0adcc0 New template button creates new template for broadcast services 2020-08-14 17:13:57 +01:00
Pea Tyczynska
bf5ccd044b Services can only create templates of types they have turned on 2020-08-14 17:13:56 +01:00
David McDonald
e95908a04b Bump utils to bring in accessibility fix 2020-08-14 16:16:13 +01:00
David McDonald
6b05c754a9 Merge pull request #3566 from alphagov/gitignore
Reduce risk of commiting files with personal information in
2020-08-14 11:40:02 +01:00
Leo Hemsted
07cd014c3d Merge pull request #3573 from alphagov/nhs-scot
Add nhs.scot
2020-08-14 11:38:59 +01:00
Leo Hemsted
1f4cb25a64 Add nhs.scot
some scottish nhs domains are migrating from nsh.net to nhs.scot
2020-08-14 11:29:38 +01:00
Chris Hill-Scott
04c0c6422f Merge pull request #3568 from alphagov/fix-live-search-broadcast
Fix live search when selecting broadcast sub areas
2020-08-14 10:25:34 +01:00
David McDonald
41b5b60cec Update .gitignore
Make nice words

Co-authored-by: Chris Hill-Scott <me@quis.cc>
2020-08-14 10:22:39 +01:00
Chris Hill-Scott
24e54a9345 Merge pull request #3572 from alphagov/rationalise-libraries
Rationalise broadcast libraries into one for national and one for local areas
2020-08-14 09:28:56 +01:00
Chris Hill-Scott
1c74d0798a Add singular descriptions for libraries
This lets us write nice interface copy like ‘Choose a local authority
from the local authorities library’.
2020-08-13 17:54:46 +01:00
Chris Hill-Scott
72f5dcb91f Remove the counties and unitary authorities library
It’s been superceded by the ‘Local’ library (formerly ‘Electoral wards
in the United Kingdom’).

The latter is better because:
- it’s covers all 4 nations, not just England and Wales
- it has electoral wards as well as local authorities which group them,
  so there’s more flexibility when choosing an area to broadcast to
2020-08-13 17:54:37 +01:00
Chris Hill-Scott
be16c0187f Rename electoral wards to local areas
We’ve observed people using ‘national’ and ‘local’ during user research.
It has less tongue-twisting ambiguity than county vs country.

But we think that maybe just getting rid of ‘counties’ is enough to
disambiguate them. So this commit just takes the ‘local’ concept.

This commit also gives the libraries and areas new IDs, which means if
we want to rename them in the future it won’t be a breaking change.
2020-08-13 17:54:28 +01:00
Chris Hill-Scott
76a00c9b61 Merge pull request #3565 from alphagov/polygon-overspill
Show indication of how a broadcast will overspill the selected area
2020-08-13 16:37:52 +01:00
Tom Byers
5220e1fbcb Merge pull request #3571 from alphagov/fix-fix-for-pill-spacing
Replace horizontal padding on pill items
2020-08-13 12:47:39 +01:00
Tom Byers
661c8c130c Replace horizontal padding on pill items
If the text isn't centrally aligned, it is needed.
2020-08-13 11:58:35 +01:00
Chris Hill-Scott
969e7a6dbd Show how a broadcast will overspill selected area
Broadcasting is not a precise technology, because:
- cell towers are directional
- their range varies depending on whether they are 2, 3, 4, or 5G
  (the higher the bandwidth the shorter the range)
- in urban areas the towers are more densely packed, so a phone is
  likely to have a greater choice of tower to connect to, and will
  favour a closer one (which has a stronger signal)
- topography and even weather can affect the range of a tower

So it’s good for us to visually indicate that the broadcast is not as
precise as the boundaries of the area, because it gives the person
sending the message an indication of how the technology works.

At the same time we have a restriction on the number of polygons we
think and area can have, so we’ve done some work to make versions of
polygons which are simplified and buffered (see
https://github.com/alphagov/notifications-utils/pull/769 for context).

Serendipitously, the simplified and buffered polygons are larger and
smoother than the detailed polygons we’ve got from the GeoJSON files. So
they naturally give the impression of covering an area which is wider
and less precise.

So this commit takes those simple polygons and uses them to render the
blue fill. This makes the blue fill extend outside the black stroke,
which is still using the detailed polygons direct from the GeoJSON.
2020-08-13 11:20:49 +01:00
Chris Hill-Scott
513d11eb98 Merge pull request #3562 from alphagov/fix-pill-spacing
Remove horizontal padding for pill items
2020-08-13 11:19:55 +01:00
Chris Hill-Scott
525d6338d2 Merge pull request #3567 from alphagov/bump-to-41
deps: bump notifications-utils to 41
2020-08-13 11:19:50 +01:00
Chris Hill-Scott
f625853388 Merge pull request #3569 from alphagov/remove-regions
Remove ‘Regions of England’ library
2020-08-13 11:19:42 +01:00
Chris Hill-Scott
8ef1e98745 Remove ‘Regions of England’ library
It made for a good early demo to show how we could have different
libraries, but we’d don’t think there’s a strong user need for being
able to broadcast to a region of England.

Regions also have the problem that:
- they are ambiguous – both England and Scotland have a region called
  ‘South east’
- Northern Ireland doesn’t have formal regions

This commit removes the regions library.
2020-08-12 18:03:50 +01:00
Chris Hill-Scott
a85134ee22 Merge pull request #3563 from alphagov/better-library-examples
Improve examples given for broadcast area libraries
2020-08-12 16:50:14 +01:00
Chris Hill-Scott
4242078885 Always show 4 items in the example list
If a library has lots of items then the first 3 should be shown, with
a count of how many more there are, for a total of 4 list items:
> a, b, c, and 23 more

If the library only has 4 items then all 4 should be shown, with
consistent use of conjunction and Oxford comma[1]:
> a, b, c, and d

This keeps the lengths of the examples nice and consistent.

1. We use an Oxford comma because it helps disambiguate when an area
itself has a comma or ‘and’ in it, for example ‘Armagh City, Banbridge
and Craigavon’
2020-08-12 16:34:17 +01:00
Chris Hill-Scott
dfa2ae0ced Order areas by name in examples
When you click through to the page for a library you see the available
areas in alphabetical order. The examples given for each library should
match this.
2020-08-12 16:34:17 +01:00
Chris Hill-Scott
53fd5b8869 Exclude grouped areas from examples
The given examples should match the choices offered when you visit the
next page. The choices offered on the next page are either the areas
(when a library is not grouped) or the groups (when a library is
grouped).

This commit makes the examples match the choices by excluding sub-areas,
ie those that have a grouping ID.
2020-08-12 16:34:17 +01:00
Chris Hill-Scott
40dacdeac9 Fix live search when selecting broadcast sub areas
It was targeting the wrong element because it hadn’t been updated to
reflect that we’re now using the Design System checkboxes.
2020-08-12 16:33:00 +01:00
Toby Lorne
4ba157ae8a deps: bump notifications-utils to 41
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
2020-08-12 16:11:38 +01:00
David McDonald
48fee71c2b Reduce risk of commiting files with personal information in 2020-08-12 15:38:01 +01:00
Chris Hill-Scott
781847d32c Merge pull request #3557 from alphagov/view-only-broadcast-page
Let users without `send_messages` view broadcasts
2020-08-12 15:16:39 +01:00
Tom Byers
222bb864bc Remove horizontal padding for pill items
This gives the contents of each item more space
which is useful on smaller screens or at higher
zoom levels.

Each item still has a 2px border so is prevented
from its contents touching those of the other
items. They are also flex-items, set to occupy a
quarter of the available space so will removing
this padding will not effect their width.
2020-08-12 11:32:55 +01:00
Chris Hill-Scott
0b206e3c0f Merge pull request #3561 from alphagov/optimise-broadcast
Optimise broadcast area code for fast page loads
2020-08-12 11:32:13 +01:00
Chris Hill-Scott
8d74e9c08d Store names and IDs of areas in memory
Now that the data needed to create a `BroadcastArea` is pretty
lightweight because it doesn’t include the GeoJSON we can go back to
putting it in memory when we start up the app, to make the pages load
really fast.

Rough estimate for the size of this dataset:
> 10,000 areas
> Average length of area name = 20 characters
> Average length of area id = 20 characters
> Size of one area in bytes = 20 + 20 = 40
> Size of dataset = 40 * 10,000 = 400,000 bytes = 400kb
2020-08-12 10:45:44 +01:00
Chris Hill-Scott
6c21a1732c Refactor to assign directly
There’s no need for an intermediate variable here, and it’s confusing
having two properties containing the same data.
2020-08-12 10:45:14 +01:00
Chris Hill-Scott
f96c43f5bc Store GeoJSON in a separate table
I think that even with good indexes, querying the area names from one
table is always going to be slow because there’s so much GeoJSON to scan
past.

This commit splits the data into two tables, one for the names and
grouping IDs and one for the blobs of GeoJSON. So for most pages the app
will never even be looking at the table where the GeoJSON is held.

I don’t know if this is a proper, normalised way of structuring the
data, but it does go brrr.
2020-08-12 10:43:01 +01:00
Chris Hill-Scott
e267e3d9f1 Refactor to use .query
All the other methods of this class call through to query, we can make
this code clearer by making `get_areas` do the same.
2020-08-12 10:42:28 +01:00
Chris Hill-Scott
adad27dadb Lazy load feature from the SQLite database
Rather than querying all the features whenever we look up area(s) let’s
only get them when we need them.

The features are really big blobs of data to pass around, so there’s a
significant performance gain to be had from doing this.
2020-08-12 10:40:27 +01:00
Chris Hill-Scott
3f9e49603d Merge pull request #3544 from alphagov/choose-electoral-ward
Let users select specific electoral wards in a local authority to broadcast to
2020-08-12 08:48:13 +01:00
Chris Hill-Scott
e47dbc0caa Add tests to check permission-restricted broadcast pages
Some pages should only be shown to users who have permission to send or
approve broadcasts. This commit adds a test to ensure that this is true,
and that we don’t accidentally regress the checks for this permission.
2020-08-12 08:19:51 +01:00
Chris Hill-Scott
78c88530b5 Let users without send_messages view broadcasts
At the moment viewing a broadcast is limited to those users who have
the `send_messages` permission.

This doesn’t match how we describe the permissions on the team members
page

This commit makes it so that any team member can see a broadcast that’s
in any state other than `draft`.
2020-08-12 08:19:49 +01:00
Chris Hill-Scott
8570901731 Let users select electoral wards of local authorities
If a library has groups, we should show a link instead of selecting the
group directly.

Then we can give the user the choice of selecting the whole of that
group, or specific areas within the group.

For now the only libraries we have with groups are local authorities,
which group electoral wards.
2020-08-11 17:38:15 +01:00