Commit Graph

3139 Commits

Author SHA1 Message Date
Chris Hill-Scott
eb395db2d6 Fix error when file has header rows but no data
Previously the error was saying ‘It needs at least one row of data, and
columns called None’.
2017-12-20 11:59:51 +00:00
Chris Hill-Scott
5f5dd3ac41 Rewrite check for row existence as conditional
Because exceptions can be expensive performance wise (see:
https://docs.python.org/3/faq/design.html#how-fast-are-exceptions).

Since we’re counting the number of rows anyway this doesn’t introduce
any performance overhead there. And I think it’s equally readable/same
number of lines of code.
2017-12-20 11:48:30 +00:00
Chris Hill-Scott
c3e2bce98b Add URLs for previewing all rows of a spreadsheet
We’ve heard from some users, especially those sending letters, that
they’d like to check that a spreadsheet they’ve uploaded has populated
the template correctly.

My reckon is that seeing just one row of the spreadsheet populate the
template isn’t enough to give people confidence that everything’s
working properly. So this commit is the first step towards being able
to preview an arbitrary row of a template, by extending the URL
structure to optionally accept a row number for pages or files (ie PNG)
that preview successfully uploaded spreadsheets.

What this commit doesn’t do is link to these pages; that will come as
part of a subsequent commit.
2017-12-20 11:15:38 +00:00
Chris Hill-Scott
587e18d2ef Lookup index, rather than iterating
Since instances of `Recipients` are now iterable we can just look up the
first row by index, rather than having to hit the rows property as a
generator.

There is a chance that there won’t be a first row, if the file has 1 or
fewer columns. So we still need to handle a possible exception (albeit
it a different one to before).
2017-12-20 11:15:37 +00:00
Chris Hill-Scott
5bac021493 Remove unused variable
This variable isn’t used by our Jinja templates. Presumably it was
from the time before instances of `Template` were responsible for
showing who the email/text message was being sent to.
2017-12-20 11:15:36 +00:00
Chris Hill-Scott
3a67555d4d Update callbacks.html 2017-12-18 14:14:36 +00:00
Chris Hill-Scott
3df3c61279 Fix page titles on callbacks documentation
This page is no longer just about inbound.
2017-12-18 14:13:40 +00:00
Chris Hill-Scott
08c007d998 Add Marine Management Organisation as email domain
Seems like sometimes they use a Defra email address, sometimes their
own .org.uk one.
2017-12-18 11:52:56 +00:00
Chris Hill-Scott
fa3885d47d Remove error-handling code from OK page
`ok.html` is only used when there’s a spreadsheet which doesn’t have
any errors in it.
2017-12-14 18:06:25 +00:00
Pete Herlihy
2378854cc8 120-121 for Analyse School Performance 2017-12-14 11:20:16 +00:00
Chris Hill-Scott
a8829cd154 Make whitespace stripping work for whitelists too
It’s a bit hacky, but it fixes a potential issue for users.

Code adapted from:
2c34f678ab
2017-12-14 11:06:55 +00:00
Chris Hill-Scott
d0d230f119 Remove existing whitespace stripping code
Since we’re doing this globally, we don’t need to handle it in a custom
way for the sign in form (and it’s much nicer encapsulated like this).

Also added some more extensive tests in this commit.
2017-12-14 11:06:55 +00:00
Chris Hill-Scott
70badae575 Strip whitespace before validating any form
We’ve had whitespace-in-emails problems on:
- register form
- sign in form
- send one off form

We should just handle whitespace gracefully, by ignoring it. Makes sense
to do this at a global level because there might be other places it’s
causing problems that we don’t know about.

The only place that users _might_ be relying on leading/trailing spaces
(and we have no way of knowing this) is in passwords or tokens. So this
filter ignores any instances of `PasswordField`.

Adapted from @pcraig3’s work on Digital Marketplace:
- 4b06f5cfb7
- e761c1ce65
2017-12-14 11:06:55 +00:00
Chris Hill-Scott
3f01da05c7 Fix order of callbacks
Delivery comes before inbound. The order of the URLs was jumbled in two
places:
- in the view function
- in the Jinja template

So as the user saw it the URLs were in the right order, because the
double jumbling cancelled itself out. But it made the code _really_
confusing to read.
2017-12-13 11:58:21 +00:00
Chris Hill-Scott
f02ec30979 Make table labels match titles of callback pages
This makes it consistent from page to page, and match the wording that
Thom came up with.
2017-12-13 11:56:26 +00:00
Katie Smith
87f5a9e124 Fix bug when editing letter contact block from letter template page
When viewing a letter template, there is a button to edit the letter
contact block. This should take the user to the page to edit the letter
contact block, but if a service has not set any letter contact blocks, the
button was returning a 404 error.

The code has now been changed so that if the service has no letter contact
blocks the edit button will link to the page to add a letter contact
block.

Pivotal story: https://www.pivotaltracker.com/story/show/152881444
2017-12-12 16:38:07 +00:00
Pete Herlihy
13569bb7f8 119-120 for Home Office Tier 4 Premium 2017-12-12 15:06:53 +00:00
venusbb
6f0ce3b33d rewrite one of the obsolete test 2017-12-11 17:17:40 +00:00
venusbb
3377efb267 Merge branch 'master' of https://github.com/alphagov/notifications-admin into vb-callback-admin
Some content change
Refractor api_integration to api_keys to reduce git difference.
2017-12-11 13:43:29 +00:00
venusbb
deda4e1d57 Merged 2017-12-11 11:44:29 +00:00
venusbb
482309af3b fixed empty callback dict problem 2017-12-11 11:40:38 +00:00
chrisw
9c0d2c2a39 refactor of api callbacks admin work 2017-12-11 11:37:33 +00:00
chrisw
cd3d8edccd Allowed custom attributes to be added to textbox component 2017-12-11 11:37:26 +00:00
chrisw
df383b5c0f renamed api_keys file 2017-12-11 11:37:26 +00:00
chrisw
76117c148c Allow service to set callback url for notifications 2017-12-11 11:37:26 +00:00
Chris Hill-Scott
eef66b70de Reword because ‘inbetween’ isn’t a word 2017-12-11 11:19:33 +00:00
Chris Hill-Scott
242a216c1b Update error message about commas in placeholders
We call the yellow things ‘double brackets’ on the frontend, not fields
or placeholders. This error message was a bit out of date.

Also refactored it to use the `Field` class; this code was probably
written before `Field` was factored out of `Template`.
2017-12-11 11:19:33 +00:00
Pete Herlihy
79912166d7 117-119 for Cash Service MK and HMCTS Small Claims Mediation
50 - 51 orgs too
2017-12-11 10:25:23 +00:00
Chris Hill-Scott
bef8e8887b Strip spaces from email addresses when signing in
If you copy and paste an email address into the sign in box, there’s a
chance you’ll also copy some leading or trailing spaces. This is
especially likely to happen if you’re doing this while using your
computer upside down.

If this happens, it never even gets as far as looking up the user,
because the form validation doesn’t consider a string with a leading
space to be a valid email address.

This commit makes sure that accidental spaces are handled, by removing
them before doing any validation or hitting the API to look up the user.
2017-12-08 16:17:45 +00:00
chrisw
71c9618a26 refactor of api callbacks admin work 2017-12-08 10:53:02 +00:00
chrisw
d812ff8b7c Allowed custom attributes to be added to textbox component 2017-12-08 10:52:50 +00:00
chrisw
719dad375a renamed api_keys file 2017-12-08 10:52:50 +00:00
chrisw
43c14fb756 Allow service to set callback url for notifications 2017-12-08 10:52:50 +00:00
Pete Herlihy
25600e3363 115-117 and 48-50
West Suffolk
Marine Management Organisation

Woo Hoo.
2017-12-07 10:26:12 +00:00
Leo Hemsted
2a28278cb8 make sure service api client doesnt expect free sms fragment 2017-12-04 16:57:00 +00:00
Leo Hemsted
eb3d4acb45 update free sms fragment limit to go via billing client instead of service 2017-12-04 16:03:11 +00:00
Chris Hill-Scott
fc45acb2d4 Remove features from top nav when signed in
Features is a sales tool. Once you’re using the product already there’s
less of a need to see it. The pages are still accessible from the
footer, and for users who aren’t signed in.
2017-12-04 14:58:10 +00:00
Leo Hemsted
9c412a7f4e Merge pull request #1679 from alphagov/ken-add-send_letters_as_pdf-setting
Add send letters as PDF service setting
2017-12-04 11:59:41 +00:00
Leo Hemsted
cab61a3d0a Merge pull request #1665 from alphagov/change-csrf-token-status
Change the CSRF error from 400 to 403
2017-12-04 11:59:29 +00:00
Ken Tsang
8fb7f79e5e Add send letters as PDF service setting 2017-12-01 19:12:22 +00:00
Pete Herlihy
212ac7c0ef 114-115 and 47-48 for CareCERT NHS Digital 2017-12-01 15:28:18 +00:00
Chris Hill-Scott
c7c1559697 Fix order of nav when signed out
Got this wrong in a previous commit. Now it matches the footer (which
is the right order).
2017-12-01 14:15:19 +00:00
Chris Hill-Scott
3c057a5131 Merge pull request #1673 from alphagov/rationalise-top-nav
Rationalise top navigation and footer
2017-12-01 10:44:01 +00:00
Chris Hill-Scott
4cc455a7cc Rename Slack link
It was quite long, and Thom wasn’t a fan of the wording.
2017-12-01 10:28:51 +00:00
Chris Hill-Scott
7c643b7ff3 Remove headings from footer
It doesn’t make sense to have a section called ‘Support’ which has a
link called ‘Support’ in it.

And by splitting up, and reducing the number of links in the footer,
they don’t _need_ headers – hopefully they’re self explanatory.
2017-12-01 10:28:51 +00:00
Chris Hill-Scott
e64ca206cb Make pricing its own column in footer
This makes the footer match the order and grouping of links in the top
navigation.
2017-12-01 10:28:51 +00:00
Chris Hill-Scott
2369187f18 Make order of About links match features sidebar
The links in the footer should be in the same order as those in the
sidebar of the features page. That’s the order that’s been thought about
more.
2017-12-01 10:28:50 +00:00
Chris Hill-Scott
1817d3f091 Remove external link support in sub navigation
This navigation will only have internal links in it.
2017-12-01 10:28:50 +00:00
Chris Hill-Scott
b6096dbe06 Remove performance link from features nav
The features nav is supposed to navigate your between pages in the app.
It’s very unexpected to have it open an external link.

Performance isn’t strictly a part of Support, but it’s worked having it
there for long enough that it’s probably not a bother.
2017-12-01 10:16:40 +00:00
Chris Hill-Scott
49aa42464a Make features and documentation always visible
These links should always appear in the header, because they’re useful
to both signed in and signed out users.
2017-12-01 10:16:40 +00:00