Commit Graph

7170 Commits

Author SHA1 Message Date
Leo Hemsted
e27540243d sticky scroll the template form 2018-12-04 16:41:47 +00:00
Leo Hemsted
05de491c0c pre-check templates/folders that were checked previously
(when rendering an error)
2018-12-04 16:41:47 +00:00
Leo Hemsted
bb50326811 remove extra add template button and cleanup of html
only remove the add template button if they have the folder service
permission (thus can see the add button at the bottom).

Also make some unnecessary functions into strings in the js, and
remove some commented out code
2018-12-04 16:41:47 +00:00
Leo Hemsted
af8de93c30 add cancel buttons to template folder flow
when cancelled, clears any data inputted into the sub-form action, and
then uses an icky hack to go back to the buttons, by changing the
state to "nothingSelectedButtons", and then pretending a checkbox was
clicked so it works out which actions to show and re-renders.
2018-12-04 16:41:47 +00:00
Leo Hemsted
9942725d35 go to forms on click of action buttons, and detatch and reattach els
the action buttons have a value that matches up with the key for the
target form in the `this.states` object - we can just set the
currentState to that and call re-render and it all Just Works™.

detatch and reattach feel better than hide/unhide, mainly because it
means when the form is posted, any data that might linger in them
definitely won't be sent in the POST.
2018-12-04 16:41:47 +00:00
Leo Hemsted
db9d4aa2cb change actions based on which checkboxes are selected
if action buttons are shown (either the nothing selected actions or the
stuff selected actions), when a checkbox is selected or deselected,
count how many checkboxes are selected. If it's zero, then show the
new template/folder buttons, if it's non-zero, then show the move
options.

Under the hood, we set the `currentState` variable, then the render fn
shows that element and hides all others.
2018-12-04 16:41:47 +00:00
Leo Hemsted
370f2527ff start js for template folder form
have a bunch of separate elements within the sticky_template_forms div
that we hide or show based on button presses and such. This commit just
sets up the class - it doesn't actually deal with button presses or
checkboxes etc yet.
2018-12-04 16:41:47 +00:00
Leo Hemsted
1a5ebb3e62 Merge pull request #2541 from alphagov/choose-new-template
Let users add new template from the choose page
2018-12-04 16:41:38 +00:00
karlchillmaid
ced35ac71c Merge pull request #2544 from alphagov/reply-to-address-content-update
Updated reply-to address content
2018-12-04 13:48:21 +00:00
Pea (Malgorzata Tyczynska)
050f768996 Merge pull request #2556 from alphagov/one_off_bug_bug
Correct argument name to mobile_number on is_current_user_the_recipient
2018-12-04 11:30:55 +00:00
Alexey Bezhan
ffa6413a13 Merge pull request #2555 from alphagov/cache-data-retention
Cache service data retention in Redis
2018-12-04 10:57:19 +00:00
Alexey Bezhan
b787ca6e5b Add Service.get_days_of_retention helper method
Data retention lookup by type is only performed to get the number
of days, so we can update the service method to return the number
or the default directly.
2018-12-03 18:04:58 +00:00
Alexey Bezhan
7a7a9ae854 Cache service data retention in Redis
Adds caching for service data retention. This removes separate API
client methods to retrieve individual data retention records by id
or type in favor of a single method that fetches and caches all
retention settings configured for the service. This makes it much
easier to invalidate cache when settings change.

Lookup by id or type is provided by helper methods in the service
model.
2018-12-03 17:57:02 +00:00
Pea Tyczynska
a21b398efd Correct argument name to mobile_number on is_current_user_the_recipient 2018-12-03 17:53:47 +00:00
Chris Hill-Scott
2fcf278a5b Use unambiguously magic value for None choices
WTForms coerces `None` as a choice to `'None'` as a string when
rendering form fields (form fields will only ever have string data
because that what the browser posts back).

But internally WTForms coerces `None` to mean an unset value, ie where
the user hasn’t selected a radio button:
283b280320/src/wtforms/utils.py (L1-L20)

We shouldn’t use `None` to mean two different things. And in fact we
can’t, because it in effect means that we’re always getting a value
for the `move_to` field, even if the user hasn’t chosen to move any
templates. Which results in some very expected behaviour.
2018-12-03 17:49:10 +00:00
Chris Hill-Scott
4c148c7c23 Look at other services only if no templates
This saves one call to the API or Redis in the common case where the
current service does have templates.

This is because `any()` evaluates all expressions before running,
whereas `or` will only evaluate the second expression if the first
returns `False`-y.
2018-12-03 17:38:38 +00:00
Chris Hill-Scott
8d0b3f47fd Set form choices as a list, not an iterator
Iterators can be exhausted, causing options to unexpectedly disappear
from the radio buttons.
2018-12-03 17:38:37 +00:00
Chris Hill-Scott
10100e51b6 Let users add new template from the choose page
Since we’re letting users add new folders directly from the choose page
it makes sense that they should also be able to add templates from
there.

This resolves the problem we saw in user research where people found it
hard to know where to go to add a new folder when they were all behind
one green button.
2018-12-03 17:38:37 +00:00
Pea (Malgorzata Tyczynska)
8aeea9929f Merge pull request #2551 from alphagov/one_off_bug
Back button on one-off message preview takes user to their flow
2018-12-03 17:12:58 +00:00
Chris Hill-Scott
fb38cd4d60 Merge pull request #2554 from alphagov/npt.gov.uk
Mark agreement signed by Neath Port Talbot County Borough Council
2018-12-03 15:41:22 +00:00
Chris Hill-Scott
cf11c1dc99 Mark agreement signed by Neath Port Talbot County Borough Council 2018-12-03 15:32:38 +00:00
Chris Hill-Scott
ba51e395f1 Fix apostrophe 2018-12-03 13:55:54 +00:00
Chris Hill-Scott
fb73fd228c Fix indentation 2018-12-03 13:55:47 +00:00
Chris Hill-Scott
4e3ddb22dc Remove go-live requirement content 2018-12-03 13:55:14 +00:00
Katie Smith
7e248e01d3 Merge pull request #2539 from alphagov/sending-content-changes
Content changes for notification pages
2018-12-03 13:36:35 +00:00
Chris Hill-Scott
8807028097 Refactor team members into the model
Follows the pattern we’re using elsewhere of having less logic in the
view methods.
2018-12-03 12:07:58 +00:00
Chris Hill-Scott
538a06c0bf Refactor filtering out accepted invites to client
None of our model or view layer code should need to know about accepted
invites. We don’t use them anywhere because once an invite is accepted
that person is now a user.

Putting this logic in the client means that:
- none of the code calling the client needs to care about accepted
  invites
- it’s easier to (if we want) update the API code to not return accepted
  invites
2018-12-03 11:06:03 +00:00
Chris Hill-Scott
29830da5e6 Scope live search on team page to name and email
It’s not useful for the search to also be picking up ‘Send messages’ or
‘Signs in with an email link’.
2018-12-03 11:05:10 +00:00
Katie Smith
b9688f9ad3 Update banner message for CSV letters
This was always showing the text 'Your letter has been sent...' This has
now been updated to start 'Your letters have been sent...' if a job has
more than one notification in it.
2018-12-03 10:42:47 +00:00
Katie Smith
088d6ee4b0 Content changes for notification pages
This commit adds content pages for the notifications pages, particularly
the letter pages, which will make things clearer now that we will soon be allowing
letters to be cancelled.

The main changes are:
* The confirmation banner for letters sent from a CSV file now states when
printing will start.
* We state the CSV file that notifications were sent from on the
notifications page
* The notification page for letters shows when printing starts (today,
tomorrow, or that date that the letter was printed)
2018-12-03 10:42:47 +00:00
Chris Hill-Scott
07a1d903eb Merge pull request #2550 from fidejoseph/patch-5
Update email_domains.yml
2018-12-03 10:12:51 +00:00
Chris Hill-Scott
c79e8bbcd9 Merge pull request #2552 from alphagov/eastrenfrewshire.gov.uk
Mark agreement signed by East Renfrewshire Council
2018-12-03 10:12:45 +00:00
Pea Tyczynska
0b45eda53f Update tests 2018-12-03 09:56:24 +00:00
Pea Tyczynska
b9abeb91d3 Back button on one-off message preview takes user to their flow
Earlier it always took user to one-off flow, even when they came
from test flow.

Also adjust steps calculation for test flow.
2018-12-03 09:56:24 +00:00
Chris Hill-Scott
d951919f40 Mark agreement signed by East Renfrewshire Council 2018-11-30 16:20:24 +00:00
Alexey Bezhan
ef4921d2f9 Merge pull request #2534 from alphagov/final_countdown
'Data available for {}' message on job page accounts for flexible data retention
2018-11-29 15:49:27 +00:00
Alexey Bezhan
8295632239 Merge pull request #2538 from alphagov/update-utils-30-7-1
Update utils to 30.7.1 to silence 'Header missing' warnings
2018-11-29 15:34:44 +00:00
Chris Hill-Scott
c41d0d5a1c Merge pull request #2549 from alphagov/cdn-images
Serve images from the CDN
2018-11-29 15:07:50 +00:00
Chris Hill-Scott
643dca0071 Use asset fingerprinter to serve images
This means we can cache them forever, and only invalidate the cache
when the image changes.
2018-11-29 14:31:31 +00:00
fidejoseph
784870fdd8 Update email_domains.yml
Adding careinspectorate.com  - they're a scrutiny body specialising in health and social care, early learning and childcare, social work, children’s services, and community justice
2018-11-29 14:24:22 +00:00
Chris Hill-Scott
8653430669 Merge pull request #2548 from alphagov/fix-app-var
Expose `application` as a variable
2018-11-29 14:10:01 +00:00
Chris Hill-Scott
5bf6bdcd20 Serve images from the CDN
Because it should be quicker than serving them from our app directly.
2018-11-29 14:09:44 +00:00
Chris Hill-Scott
58d3d70a7c Expose application as a variable
This is what Gunicorn is looking for when it’s running the app.

Renaming this variable to `app` has caused the app to break once
deployed on PaaS.

This commit also renames `app` to `flask_app` to make it clear which
app is wrapping which other app.
2018-11-29 14:02:20 +00:00
Chris Hill-Scott
e346bfeb9e Merge pull request #2546 from alphagov/make-whitenoise-audible
Make Whitenoise serve static assets
2018-11-29 13:35:49 +00:00
Chris Hill-Scott
d47e0482d4 Tell browsers not to re-fetch static assets
Since we version our asset filenames there’s no need for a browser to
ever fetch the same file twice. It should always cache fetch from its
own cache.

The accepted way to effect this behaviour is using the expires header,
which is what this argument to `WhiteNoise` does.
2018-11-29 13:22:52 +00:00
Chris Hill-Scott
d58c04d974 Make Whitenoise serve static assets
Currently it’s not configured properly, so isn’t having any effect.
This change makes it wrap the Flask app, so it intercepts any requests
for static content.

Follows the pattern documented in http://whitenoise.evans.io/en/stable/flask.html#enable-whitenoise
2018-11-29 13:22:52 +00:00
Chris Hill-Scott
c3cc4f4ded Merge pull request #2547 from alphagov/fix-asset-fingerprinter-path
Fix asset path in asset fingeprinter
2018-11-29 13:22:23 +00:00
Chris Hill-Scott
dd711f51b3 Fix asset path in asset fingeprinter
The asset fingerprinter was hard coded to always point to `/static`.

It needs to change depending on which environment the app is running
in.
2018-11-29 13:14:52 +00:00
Chris Hill-Scott
9541c02309 Merge pull request #2545 from alphagov/fix-csp-cdn
Fix content security policy for the CDN
2018-11-29 12:25:50 +00:00
Chris Hill-Scott
4e53cafd46 Use NOTIFY_ENVIRONMENT to test if running locally
This matches what we tell people, in the README, to put in their local
environment.sh

It doesn’t matter what Jenkins sets this to, as long as it’s not
`'development'`. We think Jenkins isn’t setting it at all (in which
case the value will be `undefined`)
2018-11-29 12:18:00 +00:00