Commit Graph

9046 Commits

Author SHA1 Message Date
Tom Byers
d37379fc68 Change banner content to just cover analytics
Follows discussions with @quis, @yahoopete and
@karlchillmaid.
2020-01-20 10:03:47 +00:00
Tom Byers
8a0d0a15a8 Hide cookie banner if no-js
Decided in discussions with @quis and @yahoopete
that users without JS available cannot
accept/reject analytics cookies so the banner has
no use.
2020-01-20 10:03:47 +00:00
Tom Byers
3e8ed578d0 Improvements based on frontend feedback
Paired with @aliuk2012 on the implementation and
with a view to making the component generic enough
to be used on digital marketplace apps as well.
These changes came from that session.

They include:
- removal of an unused `data-accept-cookies`
  attribute
- removal of `govuk-!-padding-top-4` class and
  moving of associated styles into component CSS
- swapping out the `aria-label` on the parent
  element for an `aria-describedby` linked to the
  h2 to have one thing labelling the banner region
- removal of unused CSS and any already provided
  by the govuk-button class
- inclusion of @import's for styles attached to
  govuk-body and govuk-button classes
2020-01-20 10:03:36 +00:00
Tom Byers
9a0d522964 Add JS tests for analytics & cookies JS
Includes:
- tests for the analytics interface ported from
  GOVUK Frontend Toolkit
- tests for the cookie banner that appears on all
  pages except the cookies page
- tests for the cookies page JS
- tests for the hasConsentFor function
- adding a deleteCookie helper to remove
  cookies during tests
- polyfill for insertAdjacentText

The last one is because JSDOM doesn't support
insertAdjacentText but our target browsers
do. This polyfill also includes one for
insertAdjacentHTML.
2020-01-20 10:03:36 +00:00
Tom Byers
28140104f1 Fix python tests broken by cookie banner 2020-01-20 10:03:19 +00:00
Tom Byers
ca019d4a0d Fix typo on privacy page 2020-01-20 10:03:19 +00:00
Tom Byers
34b85cae10 Update cookies page
Includes:
- new content
- added option to turn analytics on/off
- non-js version for the on/off switch
- a banner to confirm user's choice was saved,
  shown when they click the save button
- the cookie banner that appears on all other
  pages removed from this page
2020-01-20 10:03:19 +00:00
Tom Byers
1d864943c5 Move code for deleting old cookies into banner JS
Removes the following cookies:
- seen_cookie_message (flags if banner was already
  shown)
- _gid (Google Analytics cookie)
- _ga (Google Analytics cookie)

These were set by default before so potentially
still around for some users.

The code for this now exists as a static method on
the cookieMessage module and is called when the JS
loads for the first time.
2020-01-20 10:03:19 +00:00
Tom Byers
fa7104d6c8 Add new cookie banner code.
Copies HTML and Sass from GOV.UK Pubishing
components cookie-banner with changes to content
and functionality to better suit Notify.

Changes are:
- adds a 'reject' button which the GOV.UK
  code doesn't have
- adds Sass from the GOV.UK Frontend button
  component which the GOV.UK version used so
  is included here
- removed click tracking from cookie banner
2020-01-20 10:03:18 +00:00
Tom Byers
6ef77cfff3 Add new analytics code to frontend build 2020-01-20 10:03:18 +00:00
Tom Byers
181adc9940 On page load, call analytics based on consent 2020-01-20 10:03:18 +00:00
Tom Byers
0ecbff6a8b Add consent tracking to cookie functions
Taken from GOVUK components:

https://github.com/alphagov/govuk_publishing_components/blob/master/app/assets/javascripts/govuk_publishing_components/lib/cookie-functions.js

Also includes:
- make new cookie functions handle notify domains
- addition of hasConsentFor function to allow easy
  checking of consent for categories of cookie
2020-01-20 10:03:18 +00:00
Tom Byers
a8d6df9b04 Wrap analytics code in GOVUK interface
Wraps our analytics code in a stripped down
version of GOVUK.Analytics to allow us to plug in
the GOVUK code for consent.
2020-01-20 10:03:18 +00:00
Chris Hill-Scott
a5fe50ce72 Merge pull request #3262 from alphagov/rename-model-property
Rename `client` property on `ModelLists`
2020-01-17 11:08:08 +00:00
Chris Hill-Scott
462a3b56a0 Merge pull request #3264 from alphagov/account-for-missing-scheduled_for
Account for missing scheduled for field
2020-01-17 10:12:01 +00:00
Chris Hill-Scott
fa4fd1c896 Account for missing scheduled for field
Jobs have a `scheduled_for` field. Single letter uploads don’t.

At the moment we treat both of them as `Job`s. So the `Job` model needs
to account for when the `scheduled_for` field is missing.
2020-01-17 10:01:39 +00:00
Chris Hill-Scott
67b3619229 Remove redundant redefinition of __init__
At some point we made the __init__ method on the base class accept
`*args` as an argument, so we don’t need to define our own method here.
2020-01-16 16:34:49 +00:00
Chris Hill-Scott
c4818eb7f2 Rename property on ModelLists
The property doesn’t represent the whole client, but just one method on
it. So this commit renames the property to better describe what it is
designed to store.
2020-01-16 16:31:20 +00:00
Chris Hill-Scott
721134dc17 Merge pull request #3251 from alphagov/job-model
Make models for individual jobs and collections of jobs
2020-01-16 15:52:21 +00:00
Chris Hill-Scott
cbf0d905e3 Remove duplicative notifications_processed property
It returned the same value (and had the same code as
`.notifications_sent`).

I think `.notifications_sent` is a better name because it’s closer to
the language (‘sending’ and ‘sent’) that we use in the interface.
2020-01-16 15:40:49 +00:00
Leo Hemsted
861a29ddd3 Merge pull request #3261 from alphagov/revert-cookies
Revert "Merge pull request #3238 from alphagov/cookies-update"
2020-01-15 15:42:18 +00:00
Leo Hemsted
66db735e09 Revert "Merge pull request #3238 from alphagov/cookies-update"
This reverts commit eec4bec761, reversing
changes made to 64480e2fff.
2020-01-15 14:40:48 +00:00
Tom Byers
04b9fa8927 Merge pull request #3260 from alphagov/fix-ga-code
Fix Google Analytics tracking code
2020-01-15 12:08:53 +00:00
Tom Byers
b86398ddda Fix associated test 2020-01-15 12:03:44 +00:00
Tom Byers
749e199e63 Fix Google Analytics tracking code 2020-01-15 11:56:38 +00:00
Tom Byers
eec4bec761 Merge pull request #3238 from alphagov/cookies-update
New cookies banner and page
2020-01-15 10:37:14 +00:00
Chris Hill-Scott
64480e2fff Merge pull request #3259 from alphagov/1-in-60
Fix test that fails 1 in 60 times
2020-01-14 14:21:40 +00:00
Tom Byers
dce6a46df6 Make Google Analytics cookies expire in 1 year 2020-01-14 14:16:00 +00:00
Chris Hill-Scott
0b6744854b Fix test that fails 1 in 60 times
This test looks for how many times the string `50` appears in the text
of the `<main>` element of the page. The `<main>` element also contains
some times, for example 1:23pm.

This means that when the time reaches 1:50pm, 2:50pm, etc the number of
times the string `50` appears in the page changes. Which causes the test
assertions to fail.
2020-01-14 14:06:04 +00:00
Chris Hill-Scott
4552587829 Merge pull request #3256 from alphagov/fix-session-bug-change-user-email
Fix session bug when changing user’s email address
2020-01-14 13:46:03 +00:00
Chris Hill-Scott
578f0c2d56 Merge pull request #3257 from alphagov/overlay-only-bad-pages
Only put the overlay on bad pages
2020-01-14 13:45:56 +00:00
Tom Byers
4a303cf0d8 Merge branch 'master' into cookies-update 2020-01-14 13:17:21 +00:00
Tom Byers
c18cb1e984 Default the cookie banner to be hidden
It should only be shown if JS is available and the
cookieMessage JS finds consent has not been set.
2020-01-14 12:11:40 +00:00
Tom Byers
b6e37a6ac8 Add event tracking to window.GOVUK.analytics
app/assets/javascripts/errorTracking.js sent
events to `window.ga`.

This extends the API of `window.GOVUK.Analytics`
to include support for sending events so all
calls to `window.ga` can use it instead of direct
access.

This use of `window.ga` was missed from the
initial work on `window.GOVUK.Anaytics`.
2020-01-14 11:28:06 +00:00
karlchillmaid
727db50a1a Merge pull request #3258 from alphagov/update-footer-and-get-started
Update footer and get started
2020-01-14 11:00:33 +00:00
karlchillmaid
d0ee3c45b7 Move 'performance' to the Support column 2020-01-14 10:45:10 +00:00
karlchillmaid
3dab5ca73e Update list of organisations that can use Notify
Update list of organisations that can use Notify to remove 'housing associations' and rephrase 'companies owned by local or central government that deliver services on their behalf'.
2020-01-14 10:38:34 +00:00
Chris Hill-Scott
e9ad2e9c42 Only put the overlay on bad pages
This will make it easier to find errors in your file, because you won’t
spent time looking for them on pages which are OK.
2020-01-13 17:42:44 +00:00
Chris Hill-Scott
bf56a9bac1 Merge pull request #3255 from alphagov/fix-import-make-command
Add a command to fix import order
2020-01-13 15:58:47 +00:00
Chris Hill-Scott
fda979a5f2 Refactor again 2020-01-13 15:10:21 +00:00
Chris Hill-Scott
2f6a8a5864 Refactor stats calcualtions 2020-01-13 15:10:19 +00:00
Chris Hill-Scott
7d52ac97f1 Move stats to the model
The API clients should just deal with calling the API and returning the
data from it.

Inferring things from the data is more logically done at the model
layer. But we couldn’t do that before, because we didn’t have a model
layer for jobs.
2020-01-13 15:10:16 +00:00
Chris Hill-Scott
340cb33fdd Refactor ‘finished’ to the model layer
By moving it from the view we reduce the complexity of the methods in
the view layer, so it’s easier to see what they do.

This also renames the variable `finished` to the property
`processing_finished` to disambiguate from the `job_status` field in the
JSON, which can also have a value of `finished`.
2020-01-13 15:10:14 +00:00
Chris Hill-Scott
25464a141b Use a ModelList for lists of jobs
This follows the pattern of what we’ve done with services, users and
events.

It gives us a way of neatly instantiating a model for each item in the
list we get back from the API and reduces the complexity of the view
layer code.

Now is a good time to do this because we’re going to be making a bunch
of changes to the jobs pages, and those changes will be easier to code
and understand with a sensible model behind them.
2020-01-13 15:10:10 +00:00
Rebecca Law
e7928512e8 Merge pull request #3240 from alphagov/recipient-address
Show the first line of the address from the to field.
2020-01-13 14:29:33 +00:00
Rebecca Law
68bf013a0c Removed method from conftest, that's not being used. 2020-01-13 14:19:20 +00:00
Chris Hill-Scott
5e7ec3e30d Make a job model for individual jobs
This follows the pattern of what we’ve done with services, users and
events.

It gives us a better interface to the data we get back from the API than
dealing with the raw JSON directly.

Now is a good time to do this because we’re going to be making a bunch
of changes to the jobs pages, and those changes will be easier to code
and understand with a sesnsible model behind them.
2020-01-13 13:05:35 +00:00
Chris Hill-Scott
72eb6ef99a Fix session bug when changing user’s email address
The session key we use is global.

This means if you open the edit page for two different users in two
different tabs the session for the first tab is overwritten with the
session from the second tab. This means the two users are both set to
the same email address, which causes an exception (email addresses are
unique).

This commit fixes that bug by including the user ID in the session ID.
2020-01-13 12:03:39 +00:00
Chris Hill-Scott
c391729dc0 Merge pull request #3247 from alphagov/buttony
Make create account button more buttony
2020-01-13 10:35:34 +00:00
Chris Hill-Scott
0fc1ae63e9 Add a command to fix import order
We check import order as part of our automated tests. But fixing them
means:
- manually editing them and rechecking
- remembering the parameters to `isort`
- looking up the `isort` command from the last time you ran it

Putting it in the Makefile should make life a bit easier.
2020-01-13 10:26:11 +00:00