Commit Graph

831 Commits

Author SHA1 Message Date
Chris Hill-Scott
0d86be0feb Don’t show styleguide on live environment
Its audience is people working on the product, not the end users.
2016-02-15 11:48:04 +00:00
Chris Hill-Scott
10a92258a4 Make page heading a link to preview
Mainly because it looks good when this page is printed and stuck on the wall.
2016-02-15 11:41:46 +00:00
Chris Hill-Scott
97304a6681 Remove ‘info’ banner type
We’re not using this banner type anywhere any more
2016-02-15 11:37:40 +00:00
Chris Hill-Scott
3ee09d03bd General updates to styleguide
More complete examples of:
- tables
- SMS messages
2016-02-15 11:37:08 +00:00
NIcholas Staples
5928c3bb2c Merge pull request #174 from alphagov/clear-cookie-on-sign-out
Use session.clear()  sign-out.
2016-02-12 16:01:31 +00:00
Rebecca Law
035d4152fd Use session.clear() sign-out.
NOTE: you can not test that the session is cleared out by checking the session cookie does not exist on the index page,
because ItsDangerousSession will create a new session when it hits the index page. The unit test confirms that the session has been cleared.
2016-02-12 15:06:54 +00:00
Rebecca Law
8d1cd930ef Merge pull request #170 from alphagov/main-is-main
Use <main> element in semantically appropriate way
2016-02-12 09:49:11 +00:00
Rebecca Law
db16e2583e Merge pull request #171 from alphagov/add-cachebusting-for-assets
Make URLs for assets cache-proof
2016-02-12 09:48:38 +00:00
Rebecca Law
8d6c61f3ad Merge pull request #172 from alphagov/upgrade_notifications_python_client
notifications-python_client upgraded to 0.2.5
2016-02-12 09:46:15 +00:00
Rebecca Law
8e85dae7fd Merge pull request #173 from alphagov/invalid_validation_code_fails
Fix error with invalid token causing an error.
2016-02-12 09:45:44 +00:00
Nicholas Staples
737e490276 Fix error with invalid token causing an error. 2016-02-11 16:23:41 +00:00
Nicholas Staples
92b0d74a25 Tests fixed. 2016-02-11 16:04:50 +00:00
Nicholas Staples
dbdd689f8d Fix for forgotten password. 2016-02-11 15:59:28 +00:00
Nicholas Staples
48368584d9 notifications-python_client upgraded to 0.2.5 2016-02-11 15:27:08 +00:00
Chris Hill-Scott
fc09750662 Cache static files for a year
We only want static files to not come from the browser cache when they have
changed. The best way to do this is by cache busting the URLs.

Otherwise, we want static files to be cached for a long time. This commit sets
the `Expires` HTTP header to 1 year in the future.

Previously it was set to 12 hours, the default.

From the Flask docs:
> Default cache control max age to use with send_static_file() (the default
> static file handler) and send_file(), in seconds. Override this value on a
> per-file basis using the get_send_file_max_age() hook on Flask or Blueprint,
> respectively. Defaults to 43200 (12 hours).
2016-02-10 16:07:10 +00:00
Chris Hill-Scott
2f0cc99610 Make URLs for assets cache-proof
https://www.pivotaltracker.com/story/show/113448149

This commit adds a query string to assets URLs which is generated from a hash
of the file contents. When asset files are changed they will now be served from
a different URL, which means they wont be loaded from browser cache.

This is similar to how GOV.UK template adds its version number as a querystring
parameter for its assets.

This is mostly copied from Digital Marketplace utils:
https://github.com/alphagov/digitalmarketplace-utils/pull/102

They have it in a shared codebase, we only have one frontend app so don’t need
to do that.

Usage in a template:
``` jinja
{{ asset_fingerprinter.get_url('stylesheets/application.css') }}
```

Output:
```
static/stylesheets/application.css?418e6f4a6cdf1142e45c072ed3e1c90a
```
2016-02-10 16:00:29 +00:00
Chris Hill-Scott
8e607debd4 Use <main> element in semantically appropriate way
Assistive technologies use the `<main>` element to navigate around a document.
In `<main>` their users expect to find:

> [content] unique to the document, excluding any content that is
> repeated across a set of documents such as sidebars, navigation links,
> copyright information, site logos, and search forms…
— https://developer.mozilla.org/en/docs/Web/HTML/Element/main

Previously, the `<main>` element also wrapped the sidebar navigation. This
commit moves the `<main>` element to only wrap the content of the page when the
page has a navigation sidebar.

This commit also removes the `page-container` class which wasn’t being used for
anything.
2016-02-10 12:33:11 +00:00
NIcholas Staples
5fd8ca492d Merge pull request #168 from alphagov/mask-phone-number-jobs-page
Make job page more realistic for demo
2016-02-10 12:19:47 +00:00
NIcholas Staples
a9064b51b8 Merge pull request #169 from alphagov/tabluar-big-number
Use tablular numbers for ‘big number’ pattern
2016-02-10 11:21:22 +00:00
Chris Hill-Scott
bd33fa3c26 Use tablular numbers for ‘big number’ pattern
> Tabular numbers have numerals of a standard fixed width. As all numbers have
> the same width, sets of numbers may be more easily compared. We recommend
> using them where different numbers are likely to be compared, or where
> different numbers should line up with each other, eg in tables.

The big number pattern is good candidate for tabluar numbers, especially if
we ever have these numbers update dynamically (in that case tabular numbers
won’t jump around like lining ones would).
2016-02-10 11:03:56 +00:00
Chris Hill-Scott
fd052d5667 Make message sent, not queued, for realism 2016-02-10 09:46:02 +00:00
Chris Hill-Scott
d7ac0fd12e Mask phone number on jobs page
The phone number on the job page is hard coded at the moment. This is not good
for the demo, and showing it is probably not good because we don’t want to be
storing it forever. So this commit:

- masks it out with bullets • because they’re nicer than asteriks
- adds a ‘row number’ column, which I think is good for users uploading CSVs
  to reconcile the job run with their data (if we’re not showing the data any
  more)
2016-02-10 09:40:05 +00:00
NIcholas Staples
1e60b7d635 Merge pull request #167 from alphagov/remove-test-number
Remove need for TWILIO_TEST_NUMBER
2016-02-09 16:11:42 +00:00
Rebecca Law
3a89039795 Remove need for TWILIO_TEST_NUMBER 2016-02-09 15:56:09 +00:00
NIcholas Staples
1880ca3c9e Merge pull request #166 from alphagov/quis-patch-1
Add all the configs
2016-02-09 14:14:20 +00:00
Chris Hill-Scott
7f2d2bd5c2 Add all the configs 2016-02-09 14:10:28 +00:00
Chris Hill-Scott
fc162da0d8 Merge pull request #165 from alphagov/read-environment-from-file
Updated wsgi so that it can read the environment from the files prese…
2016-02-09 14:03:11 +00:00
Martyn Inglis
eaf37ea29c Updated wsgi so that it can read the environment from the files present on AWS instances 2016-02-09 13:53:04 +00:00
NIcholas Staples
25f74b79bf Merge pull request #164 from alphagov/swap-3fa-fields
Swap order of fields of three factor page
2016-02-09 10:58:23 +00:00
NIcholas Staples
52ef4cb83e Merge pull request #163 from alphagov/syntax-highlight-docs
Add syntax highlighting to code examples in docs
2016-02-09 10:55:31 +00:00
Chris Hill-Scott
ff400d7857 Swap order of fields of three factor page
Most people seem to get the text message before the email, so it makes sense
for this to be the first field on the page.
2016-02-09 10:49:28 +00:00
Chris Hill-Scott
7e8046be47 Add syntax highlighting to code examples in docs
Uses the Pygments[1] package.

1. http://pygments.org/
2016-02-09 10:33:49 +00:00
NIcholas Staples
2da67fa78f Merge pull request #162 from alphagov/allow_test_number
Allow test number
2016-02-08 16:56:10 +00:00
Rebecca Law
6d318659ff fix codestyle 2016-02-08 15:23:10 +00:00
Rebecca Law
05adb1f3ad Add test number for functional testing. 2016-02-08 15:22:19 +00:00
Adam Shimali
06d9c1f7d3 Merge pull request #161 from alphagov/template-content-fix
Restore template content when deleting template
2016-02-08 13:40:47 +00:00
Adam Shimali
3b7d1f9d12 Merge pull request #160 from alphagov/front-end-lint
Add linting for SASS and Javascript
2016-02-08 13:37:45 +00:00
Chris Hill-Scott
de6ed99006 Restore template content when deleting template
When the template content was renamed in
9ee8610da0 I missed doing the same change for the
delete template route.

This commit does the same fix, so that template content is still visible when
you’re about to delete a template (so you can make sure it’s the right one).
2016-02-08 12:35:18 +00:00
Chris Hill-Scott
3f365058ef Fix problems found by SASS Lint 2016-02-08 12:02:22 +00:00
Chris Hill-Scott
0201825c45 Add linting for SASS and Javascript
Similar to how PEP8 enforces Python style, there are tools for front end code:
- jshint[1] for Javascript
- sass-lint[2] for SASS

This commit adds the Gulp plugins for both, and sets up some sensible rules
(which can be iterated on).

It also adds a command to `./scripts/run_tests.sh`, so that any errors in the
front end code will fail the build before it has a chance to be deployed.

1. http://jshint.com/
2. https://www.npmjs.com/package/sass-lint
2016-02-08 12:02:22 +00:00
Rebecca Law
d57e54874d Merge pull request #157 from alphagov/s3-errors
In case there are problems reading back the csv file from
2016-02-08 10:51:48 +00:00
Adam Shimali
cae5418a6d Merge pull request #159 from alphagov/edit-template-textbox-width
Make ‘edit template’ textboxes the same width
2016-02-08 10:47:20 +00:00
Chris Hill-Scott
d1a7c8ef39 Make ‘edit template’ textboxes the same width
This involves:
- removing the hard coded width on any textbox that does placeholder
  highlighting
- adding JS to make sure that the extra layers on top of the textbox inherit
  the width of the textbox that the user types in (so the layers don’t get
  misaligned)

Keeping the textboxes at 2/3 width for consistency with how wide the messages
are on the ‘manage templates’ page.
2016-02-08 10:03:30 +00:00
Adam Shimali
0e55c581d5 Merge pull request #158 from alphagov/title-tags
Make page titles consistent
2016-02-08 09:53:21 +00:00
Chris Hill-Scott
382cfa2907 Make page titles consistent
This commit modifies the HTML `<title>` tags for all the pages. It makes two
main changes:
- make the title tag match the `<h1>` of the page, for better or worse
- put the service name after the page title, seperated by an en dash, as per
  GOV.UK
2016-02-08 09:23:51 +00:00
Adam Shimali
3bd2565129 In case there are problems reading back the csv file from
s3 bucket flash error message instead of stack trace from s3 client.
2016-02-05 16:13:06 +00:00
Adam Shimali
4338bc9aaf Merge pull request #156 from alphagov/skip-choose-service
Skip ‘choose service’ page if user has one service
2016-02-05 15:20:34 +00:00
Chris Hill-Scott
d5656a4dc2 Add mocked get_services to test_client.login
Because the redirect after logging in checks the number of services a user has,
this now needs to be mocked.

Right now this means adding `mock_get_login` to any tests that need a login.
This must be one of the first mocks, so that it can be overridden by any use
of `mock_get_services`, for tests that specifically want to rely on a quantity
of mocked services, or their contents.

This is a bit fragile, but there’s already a TODO in the code to make it better
so ¯\_(ツ)_/¯
2016-02-05 15:11:44 +00:00
Chris Hill-Scott
939954cd64 Skip ‘choose service’ page if user has one service
We used to do this by redirecting on the choose service page. However when we
lost the dropdown and this page also became the page for adding a new service
(in 3617f2e936) the redirect was removed.

This commit re-adds the redirect on the two factor page, so that it only happens
on first login.

So the flows are:

**Multiple services**
```
`Sign in` → `Enter two factor code` → `Choose service` → `Service dashboard`
```

**One service**
```
`Sign in` → `Enter two factor code` → `Service dashboard`
```

**No services (you’ve deleted all your services)**
`Sign in` → `Enter two factor code` → `Choose service` → `Add new service`
2016-02-05 14:50:55 +00:00
NIcholas Staples
7854617453 Merge pull request #155 from alphagov/fixes-to-front-end-patterns
Fixes to front end patterns
2016-02-05 11:39:46 +00:00