Commit Graph

393 Commits

Author SHA1 Message Date
Chris Hill-Scott
f1126c8cbb Say ‘team members’ not ‘users’ for permissions
This is consistent with the language we use elsewhere.

Also removes the colon (it’s considered implicit in a form label).
2019-04-01 17:23:16 +01:00
Chris Hill-Scott
8fb576e60a Allow excluding services from live services count
Adds a front end for:
https://github.com/alphagov/notifications-api/pull/2417

> Sometimes we have to make a few services for what really is one
> service, for example GOV.UK Pay and GOV.UK Pay Direct Debit. We also
> have our own test services which aren’t included in the count of live
> services. We currently count these as one service by not including
> them in the beta partners spreadsheet.
2019-03-25 15:46:35 +00:00
Chris Hill-Scott
50bb20ad32 Allow up to 20 domains per organisation
The most we have in the spreadsheet is 18
2019-03-22 16:27:30 +00:00
Chris Hill-Scott
936883bf7b Allow editing of an organisation’s details
Adds a user interface for updating all the columns added in
https://github.com/alphagov/notifications-api/pull/2368

Sorry for the mega commit 😓
2019-03-22 14:23:24 +00:00
Pea Tyczynska
86d8464fa2 Show all users in folder viewing permissions, correct users checked 2019-03-18 17:58:53 +00:00
Pea Tyczynska
1ab36dd026 Show checkboxes for users with permission to view the managed folder 2019-03-15 14:13:27 +00:00
Alexey Bezhan
a2389fe2ca Make folder permissions form label more descriptive 2019-03-05 11:45:50 +00:00
Alexey Bezhan
6fa975e867 Send updated user folder permissions to the API
Integrates the folder permissions form with the updated API endpoint
to store changes in the user folders.

Since user folder permissions are returned in the full list of template
folders for the service we need to invalidate the cache key for it each
time we update user permissions.
2019-03-05 11:44:34 +00:00
Pea Tyczynska
7413423243 Display nested folders permissions form on user permissions page
We're reusing the logic for the `move_to` nested radios field for the
user folder permissions nested checkboxes.

The main difference between the two forms (aside from the different
input type) is that "Move" form contains the root "Templates" as an
option, whereas the folder permissions doesn't.

It turns out that, because of the way NestedFieldMixin.children and
select_nested macro are implemented the easiest way to get the desired
folder permissions behaviour is to add the root folder as a choice with
a `None` value and `NONE_OPTION_VALUE = None` set on the field, which
allows the `child_map` to be constructed but doesn't display the root
folder checkbox itself since it gets overwritten in the final `child_map`.
2019-03-05 11:44:34 +00:00
Pea Tyczynska
340fd021bb Move field definitions before form definitions 2019-03-05 11:44:34 +00:00
Alexey Bezhan
194756bc2e Make radio form components reusable for nested checkboxes
For the template folders permission editing we need a nested
checkboxes form that is similar to "move folder" input, except
it's using checkboxes instead of radio buttons.

This moves most of the macros into a shared "select-input" components
file, which are wrapped by the existing radios.html by setting the
required input type.
2019-03-05 11:44:34 +00:00
Chris Hill-Scott
6a6b3f78b1 Revise error message for non-numeric responses
Things we talked about:
• asking users to write the number 'as numerals' or 'using digits' isn't
  very plain English
• the style guide says to use an example in the error `..., like 5,000`
  but not if you have an example in the hint text, so we can't do that
• I have reservations about 'correct format', because it sounds odd if
  you're not describing something like a phone number, NI number or
  credit card number.

Looking back through Request to Go Live tickets on Zendesk.
---

I got to September before I found anything that would count as invalid
under our new rules:

> Possibly around 1,000,000- not planning on implementing emails yet but
might change

I'll keep looking, but if most people enter the number according to the
hint example we might be able to go with a much simpler error just
prompting them to enter a number – no convoluted descriptions of what we
mean by a number

There seemed to be more problems when the Qs were about start volume and
peak volume. Users felt the need to explain their plans more.

Using 'number' instead of 'volume' is more explicit too – so that
probably helps.

In terms of errors:
`Enter the number of emails you expect to send`
`Enter the number of text messages you expect to send`
`Enter the number of letters you expect to send`
– will probably do it, right?
2019-02-27 15:13:42 +00:00
Chris Hill-Scott
9691ef27da Round max number limit down
A round number feels better than a very arbitrary-looking one.
2019-02-27 15:13:33 +00:00
Chris Hill-Scott
1a94137ff6 Add latest content
From: https://docs.google.com/document/d/1aykf1MjJH5y21Bz1ht6WJncb9cKu0fsPlac3-bkMPe8/edit
2019-02-27 15:13:23 +00:00
Chris Hill-Scott
61ac7fa069 Don’t reformat numbers if there are errors
It’s confusing to at the same time:
1. change what you’ve inputted
2. tell you it’s wrong

This commit makes it so that 1. only happens if 2. doesn’t.
2019-02-27 13:26:23 +00:00
Chris Hill-Scott
a24c853dce Also allow spaces in numbers
Apparently this is a French thing.
2019-02-27 13:23:15 +00:00
Chris Hill-Scott
9f63449384 Make answers to volume questions optional
It’s annoying and very ‘computer says no’ to make people type `0` in a
box. We can see from our analytics that this error is affecting about 7%
of users trying to go live.

This commit relaxes the validation to only require a number greater than
1 for at least one of the questions.

It also lets people enter their numbers comma-separated – like our
examples suggest – but normalises them to integers before sending them
over to the API.
2019-02-27 13:20:20 +00:00
Chris Hill-Scott
8791134c60 Move the ‘estimated usage’ questions
We get a bunch of requests to go live where people have told us they're
going to send email but there is no email reply-to address present.

These come from 2 scenarios:

1. when there are email templates, and no reply to address – but they
   ignore the checklist
2. when there are no email templates (yet) but they provide anticipated
   volumes for email

At the moment we only auto-check for a reply to address when they have
email templates. And because the question about anticipated volumes
follows the checklist, you'll get a checklist that passes (reply
addresses not required as no templates present) - but your future intent
that differs (reply address IS required because you have anticipated
volumes).

So let’s bring the request for anticipated volumes into the checklist,
that way we can dynamically add the requirement for a reply to address
if they say they will send email but don't have templates yet.

We should begin storing it in the database against the service to stop
people having to re-enter it each time they try to complete the go live
screens.

This also means moving the ‘consent to research question’ along with
the questions about volume, because
- we want people to answer both before going live
- we don’t want to clutter up the summary page by asking questions there
  too
2019-02-27 13:17:28 +00:00
Alexey Bezhan
75fd2d4ffc Add a new boolean radios fields and change forms to use it
This adds a new OnOffField class that implements a boolean field
that is rendered as two On / Off radio buttons. This allows us to
avoid comparing 'on' and 'off' string values in the views since
the field takes care of transforming form data into python booleans.

This also adds a form class that can be used for any single On / Off
switch forms (e.g. service permissions).
2019-02-20 16:45:12 +00:00
karlchillmaid
aaacf69fdc Updated new template menu content
Updated new template menu content to make it consistent with the `New template` button and `Copy an existing template` page
2019-02-20 14:39:40 +00:00
Leo Hemsted
bfefb115ed move choices from form to view
so that when updating, you don't have to update two separate places
2019-02-19 11:35:34 +00:00
Leo Hemsted
1dcba53daf add clear cache platform admin page
a form that allows you to clear entries from the cache for all of
either users, services or templates. It'll tell you the largest amount
of keys deleted, since there are multiple keys associated with each
model.
2019-02-15 11:44:08 +00:00
Chris Hill-Scott
7d7b790dc1 Remove add template as separate page
This has moved to the choose template page.
2019-02-11 17:55:58 +00:00
Chris Hill-Scott
3a5bfeb7aa Remove folders feature flag
Every service has this feature now[1] so we don’t need to check whether
or not it’s switched on any more.

1. https://github.com/alphagov/notifications-api/pull/2286
2019-02-11 17:55:57 +00:00
Leo Hemsted
f83910599c remove option for branding to sometimes not show search
it wouldn't show search if there were under a certain amount of letter
or email branding options - however we know there will always be more
than that amount so lets remove some complexity.

Also, rename the SearchTemplatesForm because it can search anything -
it just prompts you to search by name is all.
2019-02-07 11:39:23 +00:00
Leo Hemsted
8266635a7a remove dvla_organisation and other unused things
dvla_organisation, branding_dict, a weird `branding` property on
update_service. all gone 💥
2019-02-07 11:38:20 +00:00
Leo Hemsted
a1caf77b0e use new letter branding instead of dvla organisation id
new code is copied stylistically from the email branding patterns.
Instead of `service.dvla_organisation`, there's now
`service.letter_branding` and `service.letter_branding_id`. However,
unlike email branding we're not currently showing a preview of the
logo. That can come later when we work out how we want to do it.
2019-02-07 11:30:18 +00:00
Leo Hemsted
0e20ca44a3 rename branding to email_branding
to help transition to having letter branding as well
2019-02-07 11:30:18 +00:00
Katie Smith
529d7df5f5 Add page to create new letter branding
This has a form with 3 fields - the file upload field, logo name, and an
optional logo domain. Logos need to be uploaded in `.svg` format and we
then convert this to `.png` format and upload both file types to S3 as
well as saving the letter branding details in the database.
2019-02-06 17:26:58 +00:00
Pea Tyczynska
fe6b73b8dc Remove service postage setting and choose_postage switch 2019-02-04 14:55:16 +00:00
Pea Tyczynska
20ae200de9 Remove choosing postage from edit template content flow 2019-02-04 14:45:33 +00:00
Pea Tyczynska
db5378bac2 Edit template postage from a separate view 2019-02-04 14:45:33 +00:00
Chris Hill-Scott
3b15b04fc2 Let users switch channels on and off by themselves
We let people do this for letters already. We should let them do it for
emails and texts too, rather than have to email us.
2019-01-29 16:05:32 +00:00
Katie Smith
5b77329e63 Validate name field on ServiceUpdateEmailBranding form
This introduces a validator to validate that the name field is not empty
on the ServiceUpdateEmailBranding form, but only if the form details are
being submitted. If a file is being uploaded, the name is allowed to be
empty.
2019-01-29 11:37:27 +00:00
Chris Hill-Scott
39506c4794 Rename ‘All templates’ 2019-01-04 15:15:58 +00:00
Tom Byers
9bce22f766 Swap order of move_to validators
If Optional runs before required_for_ops, it stops
the validation chain so it doesn't get to
required_for_ops. The move_to field isn't required
for the 'move-to-new-folder' operation, so this has
been removed.

This also adds comments explaining why we set
default to an empty string when instantiating the
move_to field.
2019-01-03 17:09:00 +00:00
Katie Smith
3cf36c592f Change move folder form to not have default radio btn and to show hint
Updated the move folder form to add a hint for the radio button for the
current folder saying 'current folder'. This hint does not get shown if
you are viewing all folders (so you are not inside a folder).

Also stopped a default radio button from being selected on the form.
2019-01-03 16:51:47 +00:00
Tom Byers
501ec2a534 Make all options descend from 'all templates' 2019-01-03 16:51:47 +00:00
Tom Byers
3c4a186a25 Display the template folders nested on the move template/folder form
Before, all the folders were displayed in a list which was ordered but
not nested. This changes the move form to nest the template folders.
2019-01-03 16:51:47 +00:00
Pea (Malgorzata Tyczynska)
5d99b2d2f6 Merge pull request #2616 from alphagov/choose_postage
Choose and display postage on template
2019-01-02 15:39:15 +00:00
Pea Tyczynska
85b8b343e2 Service deafault radio checked by default, existing tests pass. 2018-12-21 17:13:18 +00:00
Pea Tyczynska
687e9e5866 Change postage while editing template 2018-12-18 18:22:03 +00:00
Leo Hemsted
5c3c4ec78c change error message for not selecting a template
needed to subclass RadioField for this
2018-12-17 15:25:27 +00:00
Leo Hemsted
6f8dc7e6d3 fix being able to add template without selecting a radio button 2018-12-17 15:25:27 +00:00
Chris Hill-Scott
184a9fa605 Use email fields for feedback form
Otherwise we can end up collecting invalid email addresses…

This required some refactoring to allow our email fields to be optional
(but not by default).
2018-12-07 13:11:41 +00:00
Chris Hill-Scott
d81af78977 Merge pull request #2559 from alphagov/template-js
Template folder form smart JS
2018-12-05 16:36:12 +00:00
Chris Hill-Scott
d4a9fb52a5 Use normal radio field for add template choices
It doesn’t have a ‘none’ option.
2018-12-05 11:31:02 +00:00
Leo Hemsted
97f663f99e change operations to kebab-case
so that they better align with the front-end, where they'll be used in
data attributes. Also, making the kebab case is nice because it doesn't
give favouritism to either JS or python naming conventions
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
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