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.
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).
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
```
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.
> 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).
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)
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).
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
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.
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