Commit Graph

28 Commits

Author SHA1 Message Date
Jonathan Bobel
b1c6a768ec Committing before merge 2023-08-30 11:07:38 -04:00
Jonathan Bobel
a4fc40bcba Renamed components folder, put failing tests back in to get some assistance with those 2023-08-22 12:40:53 -04:00
Jonathan Bobel
348e29fb40 - Removed links to the gov uk stylesheets
- Deleted /stylesheets folder
- Removed sass build from gulpfile
- Changed gov links to usa links
- Changed other govuk styles, like breadcrumbs
- Changed name of uk_components file to us_components
- Fixed a few tests that broke on account of the changes
2023-08-08 16:19:17 -04:00
Jonathan Bobel
f266084ddb Test passed, good time to commit 2023-06-16 14:55:24 -04:00
stvnrlly
ac1d5f0983 move vendored uk components to templates 2022-12-14 11:55:21 -05:00
Tom Byers
ea3d61e6b9 Use format_list_items in file_upload component 2020-12-17 11:32:02 +00:00
Tom Byers
eaa1a67d76 Add allowed_file_extensions arg to file_upload
Safari has a bug where it stops input[type=file]
elements working if they don't specify the types
of file to accept (via the `accept` attribute).

It seems to just effect certain versions of Mojave
but completely blocks this action so worth fixing.

This adds a 'allowed_file_extensions' keyword
argument to the file_upload component to let you
specify a value to be passed to `accept`.

This was spotted on x-gov Slack:

https://ukgovernmentdigital.slack.com/archives/C06GCJW7R/p1607952390112800

...and StackOverflow:

https://stackoverflow.com/q/64843459/679924
2020-12-16 14:48:10 +00:00
Tom Byers
ee9f348ce4 Update all links to use GOVUK Frontend style
Includes:
- turning off :visited styles to match existing
  design
- swapping heading classes used to make links bold
  for the GOVUK Frontend bold override class
- adding visually hidden text to some links to
  make them work when isolated from their context

We may need to revisit whether some links, such as
those for documentation and features, may benefit
from having some indication that their target has
been visited.
2020-02-25 10:47:24 +00:00
Tom Byers
5b306dde4d Revert "Convert all links to govuk frontend" 2020-02-24 11:56:38 +00:00
Tom Byers
cd36182ea6 Update all links to use GOVUK Frontend style
Includes:
- turning off :visited styles to match existing
  design
- swapping heading classes used to make links bold
  for the GOVUK Frontend bold override class
- adding visually hidden text to some links to
  make them work when isolated from their context

We may need to revisit whether some links, such as
those for documentation and features, may benefit
from having some indication that their target has
been visited.
2020-02-20 09:11:26 +00:00
Katie Smith
e53c5e17b3 Update file upload component to use govuk-frontend buttons 2020-02-17 08:05:05 +00:00
Tom Byers
c1b8fb7531 Replace all visually-hidden classes
These have been replaced:

https://design-system.service.gov.uk/get-started/updating-your-code/#helper-class-names
2019-11-27 14:15:32 +00:00
Tom Byers
e09d510ab8 Revert "Replace govuk template with govuk frontend components - rewrite" 2019-11-26 12:14:09 +00:00
Tom Byers
2bd7ce8cf6 Replace all visually-hidden classes
These have been replaced:

https://design-system.service.gov.uk/get-started/updating-your-code/#helper-class-names
2019-11-25 11:43:30 +00:00
Tom Byers
e02f94f238 Revert "Replace govuk template with govuk frontend components" 2019-11-25 10:37:35 +00:00
Tom Byers
c3b2d3c521 Replace all visually-hidden classes
These have been replaced:

https://design-system.service.gov.uk/get-started/updating-your-code/#helper-class-names
2019-11-22 17:45:45 +00:00
Katie Smith
3b3f74bbf0 Use the new error messages when uploading a letter
We now use the pattern of showing a box at the top of the page with the
error. The error message has a heading and can have additional details.
Error messages and the invalid pages get stored in the S3 metadata.
2019-10-21 08:37:55 +01:00
Pea Tyczynska
3be129241f Add letter validation preview functionality
- add get/post view
- create a pdf upload form
- add a template where user can upload the file
- check boundaries of the letter by calling template-preview
- display banner messages with boundaries validation result
- display pages of the document, with visible boundaries overlay
if the document did not pass validation, and without overlay
if they do pass validation
2018-10-05 15:46:44 +01:00
Chris Hill-Scott
e74d261ec3 Don’t store info about bad uploads in session
Because we now[1] store info about each file upload separately in the
session the session isn’t overridden every time you upload a file. This
is good because you can do multiple file uploads idempotently.

Generally we are cleaning up after ourselves because we pop anything to
do with that upload from the session. However there is an edge case: if
you never send the file then the info about the file stays in the
session in perpetuity[2]. This is generally happening when people are
uploading files that are impossible to send, ie ones that have errors.

So this commit makes two changes:

1. remove info about a file upload from the session as soon as we know
   that it contains errors
2. `POST` reuploads to the same endpoint as initial uploads because
   otherwise we need to keep info about bad uploads in the session,
   which would prevent us from doing 1.

1. https://github.com/alphagov/notifications-admin/pull/1968
2. or at least until the session is cleared by the user logging out
2018-03-29 11:56:53 +01:00
Chris Hill-Scott
9aa4a7267a Use <button> not <input>s for form submission
Both `<button type='submit'>Submit<button>` and
`<input type='submit' value='Submit'>` can be used to submit a form.

We have historically[1] used `<input>` because it’s better-supported by
IE6 in that:
- the `submit` attribute is mandatory on `<button>`, not on `<input>`
- the `innerHTML` of a button will be submitted to the server, not the
  value (as in other browsers)

Reasons to now use `<button>` instead:
- IE6/7 support is no longer a concern (especially with deprecation of
  TLS 1.0 on the way)
- Because an `<input>` element can’t have children, the pseudo-element
  hack[2] used to ensure the top edge of the button is clickable doesn’t
  work. We’re seeing this bug[3] affect real users in research.

1. We inhereted our buttons from Digital Marketplace, here is me making
   that change in their code:  8df7e2e79e (diff-b1420f7b7a25657d849edf90a70ef541)
2. 24e1906c0d (diff-ef0e4eb6f1e90b44b0c3fe39dce274a4R79)

3. https://github.com/alphagov/govuk_elements/issues/545
2018-02-01 13:53:45 +00:00
Chris Hill-Scott
8d5af47620 Change class names for validation errors in html
Implements the class name changes detailed in:
https://github.com/alphagov/govuk_elements/pull/405
2017-04-10 14:54:27 +01:00
Chris Hill-Scott
3f41090a94 Fix duplicate labels on form inputs
It’s invalid HTML to have multiple labels nested within each other. This
was happening by accident because WTForms tries to be clever – when you
put `{{ field.label }}` in a template it prints a `<label>` tag for you,
not just the text of the label. But we put our own `<label>` tags in the
HTML to have more control of them.

This commit stops WTForms being so clever.
2017-02-14 11:55:46 +00:00
Chris Hill-Scott
687ccad018 Make send a test teach you how placeholders work
This commit does two main things:

- adds textboxes to the send yourself a test page, so you can replace
  ((name)) with ‘Chris’, or whatever your name is
- rejigs the send page a bit to make it clearer what the CSV upload is
  for and how to use it

The idea being that, since most users go into ‘send yourself a test’
first, it teaches them about how placeholders work by making them do the
replacing themselves.
2016-05-05 08:53:00 +01:00
Chris Hill-Scott
eb3734f1d1 Give the user better error messages for CSV files
Makes uses of the additions to utils in https://github.com/alphagov/notifications-utils/pull/9

This commit strips out a lot of the complex stuff that the views and templates
in this app were doing. There is now a cleaner separation of concerns:

- utils returns the number and type of errors in the csv
- `get_errors_for_csv` helper in this app maps the number and type of errors
  onto human-friendly error messages
- the view and template just doing the glueing-together of all the pieces

This is (hopefully) easier to understand, definitely makes the component
parts easier to test in isolation, and makes it easier to give more specific
error messages.
2016-03-08 18:36:22 +00:00
Chris Hill-Scott
16fbfe49a3 Fix missing CSRF token on send SMS page
As part of https://github.com/alphagov/notifications-admin/pull/187 the file
upload pattern was changed to auto-submit once a file had been picked. The
form that was submitted was, however, missing a CSRF token, as well as a submit
button for non-JS users.

This commit makes the file upload pattern self-contained, so that it will always
include a form with a CSRF token in a hidden input and a submit button, which is
then hidden when Javascript loads.
2016-02-23 07:29:50 +00:00
Chris Hill-Scott
97a3bf9225 Remove the ‘manage templates’ page
The ‘manage templates’ page was almost identical to the ‘send text messages’
page.

This commit consolidates them into one and makes them all hang together.

Part of this means tweaks to the javascript so that files upload as soon as
you’ve chosen them.
2016-02-22 13:39:02 +00:00
Chris Hill-Scott
26adcc64c1 Updates to ‘send SMS’ page
Based on discussion with Pete.

Make the blue banner an ‘important’ banner (copied from Register to Vote, used
because it’s not as boxy and fits on the page better).

Remove the back button because you haven’t changed any data yet. If you need to
go back you can just press back or start again.

Make the filename stand out more.

Remove the ‘download example’ link. Will need to revist the best way of doing
this.

Make text messages consistently 2/3rd width.
2016-02-04 14:06:19 +00:00
Chris Hill-Scott
4447af3fec Add custom file upload component
The default browser file upload control is difficult to style, but looks totally
out of place.

This commit replaces it with one that has a GOV.UK style button, as a first
step.

Based heavily on this example:
http://tympanus.net/codrops/2015/09/15/styling-customizing-file-inputs-smart-way/
2016-02-03 17:16:17 +00:00