Commit Graph

277 Commits

Author SHA1 Message Date
Chris Hill-Scott
18d11aa013 Move code for rendering messages/templates → utils
Utils is better structured to handle the logic of what thing to show
for what template type, especially now that what we show for different
template types in different contexts has diverged significantly.

See https://github.com/alphagov/notifications-utils/commit/6b39c1a for
an example of this code moving into utils

Depends on and implements:
https://github.com/alphagov/notifications-utils/pull/84

The main reason for doing this is to get Paul’s fix for the misaligned
CSV columns: https://github.com/alphagov/notifications-utils/pull/87
2016-12-05 12:11:54 +00:00
Chris Hill-Scott
b6ad19fa31 Fix heading spacing on dashboard with 0 templates 2016-11-18 15:50:56 +00:00
Chris Hill-Scott
257fa7f9bb Shift propositional navigation down
This seems to be a custom thing done on Tim and Stephen’s prototype to
re-align the proposition nav. Not sure if it’s better or worse.
2016-11-18 12:00:01 +00:00
Chris Hill-Scott
ee78d0bf59 Move switch service out of black header
Also following the pattern work that Tim and Stephen have done.
2016-11-18 12:00:01 +00:00
Chris Hill-Scott
bfe234b535 Use two-weight GOV.UK Notify logo
Based on the work Tim, Stephen et. al have done on patterns for admin
interfaces across GaaP.

See their prototype here:
https://govuk-product-page-prototypes.herokuapp.com/govuk-notify
2016-11-18 11:59:40 +00:00
Chris Hill-Scott
48496eefde Merge pull request #1024 from alphagov/add-letters-templates-2
Let users upload a CSV file of addresses against a letter template
2016-11-15 17:57:28 +01:00
Imdad Ahad
eaa246bd26 Use SASS var for border colour and correct closing tbody tag 2016-11-14 16:00:45 +00:00
Chris Hill-Scott
88631a680c Sprinkle letter throughout the app
Let users create/edit/delete letter templates.

Let them upload a CSV file or send a test against a letter template.

Big assumption at the moment is that addresses only have one line, and
therefore one column in the CSV file.
2016-11-14 14:51:26 +00:00
Chris Hill-Scott
4a0c860a04 Make border around letter neater
The drop shadow stolen from GOV.UK was a bit crude; this commit makes
it a bit more refined.

Also makes things line up a bit better.
2016-11-14 14:51:26 +00:00
Imdad Ahad
7e269a454a Show more granular email & sms counts on platform admin page 2016-11-14 14:46:26 +00:00
Chris Hill-Scott
fb410496dc Add letter component
Similar to the components we have for previewing email and text
messages.

Style stolen from PDF thumbnail at
https://www.gov.uk/government/publications/honey-bees
2016-11-14 14:29:13 +00:00
Chris Hill-Scott
a36f38edb8 Remove banner for trial mode message
The yellow banner didn’t make this information much more noticeable,
and it made some people miss the request to go live link because it
wasn’t blue.

This commit brings the design back to where it was as of this PR:
https://github.com/alphagov/notifications-admin/pull/904
2016-11-04 14:05:32 +00:00
Chris Hill-Scott
4ae28386a6 Always show live key, reword key labels
This is trying to resolve these confusions:

- that you’re in trial mode, which means you can’t have a live key yet (
  or you can but it wont work, which is what we used to have)
- what does simulate mean

The create key page is the right place to resolve these confusions
because it’s where users are actively reading.

This commit also removes the trial mode banner from API integration
page because this where users _aren’t_ actively reading. A whole bunch
of users weren’t seeing this banner at all.

The implementation of the disabled API key options is kinda clunky
because WTForms doesn’t have a native way of doing this.

¯\_(ツ)_/¯
2016-11-04 14:05:30 +00:00
Chris Hill-Scott
103e09e3a0 Make the UI more performant by not reflowing
Fixes the height of the component until it’s loaded so that it doesn’t
causes the page to reflow while it’s rendering the buttons.

Stops the options being shown and then immediately hiding on initial
page load.
2016-10-31 09:14:05 +00:00
Chris Hill-Scott
8a01e6af36 Make it say later today
Categories before:

> Now, today, tomorrow, Friday…

Categories after:

> Now, later today, tomorrow Friday…

This reduces the ambiguity of ‘now’ vs ‘today’, and keeping the word
‘later’ suggests what this features is about.

This implementation here is a bit hacky, but it works…
2016-10-31 09:14:05 +00:00
Chris Hill-Scott
a78d9d5048 Group choices for scheduling a job by day
The options for scheduling a job by time should be grouped by day,
because a long list of 96 options is not very usable.

On the server side, this commit generates label for the next 4 days in
a friendly format (ie today/tomorrow/Sunday/Monday)

The Javascript component for choosing a time was built in a kind of
old-school jQuery way, where it manipulated the elements on the page.
The complexity of introducing groups of options was just too much for
this pattern, because it involves storing a lot of state in the DOM.

This commit completely rewrites the JS to:

- read the initial options and groups from the HTML and store them
  in the object
- use Hogan to completely re-render the UI from a series of Mustache
  templates, each of which represents a state of the UI and takes the
  inital options and groups
- filter the choices to show when the today/tomorrow/… buttons are
  clicked
2016-10-31 09:14:05 +00:00
bandesz
df313ad3d4 Add minimal 404 page for Cloudfront 2016-10-27 13:13:49 +01:00
Imdad Ahad
2a2a733a41 Fix 500s when requesting json after logged out:
* Update permissions decorator to make sure user is logged in first, else 401
* Stop further ajax json calls on failure
2016-10-21 14:24:21 +01:00
Chris Hill-Scott
f561bfe603 Show expander arrow for all browsers
The polyfill we use for details/summary only renders the arrow if the
browser doesn’t natively support the feature.

The latest versions of Firefox _do_ now support the feature (after 5
years), but for some reason they don’t draw the arrow. So this commit
forces the arrow to be polyfilled in all browsers, and hides the browser
default one, for those browsers that do render it.
2016-10-12 15:55:53 +01:00
Chris Hill-Scott
c13f1aa5d1 Fix API log page in Firefox
The details of each notification were not being hidden on page load in
Firefox.

Firefox does not natively support the `<details>` element, so we
polyfill it.

Because of the way the polyfill is written[1]

1. There can’t be any `<div>` elements inside the `<summary>` (this
   commit changes them to be `<span>`s instead, and adds CSS to make
   sure they wrap as before)
2. The contents to be shown/hidden must be wrapped in a `<div>` (which
   this commit adds)

***

1. 48fde82c72/public/javascripts/govuk/details.polyfill.js (L90)
2016-10-12 15:28:38 +01:00
Chris Hill-Scott
b760457ba9 Add monthly breakdown of usage
Basically:
- shows all the months from start of given financial year to now or end
  of given financial year (whichever is earliest)
- shows a breakdown of free and paid text messages for each of these
  months

Depends on:
- [x] https://github.com/alphagov/notifications-api/pull/699
2016-10-05 16:11:19 +01:00
Chris Hill-Scott
6c96b90922 Make relative timestamps update automatically
It’s weird to be on a page that says ‘2 seconds ago’ and stays stuck
there.

We don’t want to AJAX the whole page because it would get in the way of
interacting with the list of notifications.

This commit adds the venerable jQuery Timeago[1] plugin to keep the
relative times accurate and fresh.

1. http://timeago.yarp.com/
2016-09-29 09:28:13 +01:00
Chris Hill-Scott
48891babc4 Add log of notifications to API integration page
Now that we’ve removed simulated notifications from the dashboard and
activity pages they’re not visible anywhere in the app.

While they should’t be visible to non-technical users, developers have
a real need for Notify to confirm that their code is doing what they
expect. This is needed especially when they’re just getting started with
Notify.

There’s no way of seeing this info from the API either, because a key
can only get notifications created with a key of that type.

It doesn’t make sense to make this a ‘mode’ of the dashboard or activity
because the information about notifications that developers need is
also different. So this commit adds up to 50 of the most recent
notifications sent via the API to the page that developers use as their
‘home’ page.

This also lets us explain the 7 days thing to developers via the
empty slate state of this area of the page.
2016-09-29 09:28:04 +01:00
Chris Hill-Scott
3e42042156 Add a page to manage a service’s whitelist
Services who are in alpha or building prototypes need a way of sending
to any email address or phone number without having to sign the MOU.

This commit adds a page where they can whitelist up to 5 email addresses
and 5 phone numbers.

It uses the ‘list entry’ UI pattern from the Digital Marketplace
frontend toolkit [1] [2] [3].

I had to do some modification:
- of the Javascript, to make it work with the GOV.UK Module pattern
- of the template to make it work with WTForms
- of the content security policy, because the list entry pattern uses
  Hogan[1], which needs to use `eval()` (this should be fine if we’re
  only allowing it for scripts that we serve)
- of our SASS lint config, to allow browser-targeting mixins to come
  after normal rules (so that they can override them)

This commit also adds a new form class to validate and populate the two
whitelists. The validation is fairly rudimentary at the moment, and
doesn’t highlight which item in the list has the error, but it’s
probably good enough.

The list can only be updated all-at-once, this is how it’s possible to
remove items from the list without having to make multiple `POST`
requests.

1. 434ad30791/toolkit/templates/forms/list-entry.html
2. 434ad30791/toolkit/scss/forms/_list-entry.scss
3. 434ad30791/toolkit/javascripts/list-entry.js
4. http://twitter.github.io/hogan.js/
2016-09-29 09:27:38 +01:00
Chris Hill-Scott
4a596c1dd2 Add a new banner for telling you about trial mode
We’ve found in research that developers have no idea they’re in trial
mode until they hit an error. And even then they don’t really know what
trial mode means.

So this commit:
- adds a message to the API integration page about trial mode
- puts it in a really yellow banner to draw attention to it
- adds the same banner to the settings page
2016-09-28 17:00:46 +01:00
Chris Hill-Scott
f514d377f7 Add a new pattern for sub-navigation
This is like the ‘pill’ pattern that we use for filtering lists of
notifications. However it is meant for navigating between discrete
things, not a filtered view of the same list.

This is why is has a gutter between each item, and no selected state.

Turns out we already had a pattern about this on the dashboard, so this
commit also changes the dashboard to use the same code.
2016-09-28 17:00:46 +01:00
Chris Hill-Scott
70a9582c91 Make ‘add new’ button line up with <h1>
Having changed the layout of the API keys page a bit the vertical
misalignment was apparent.
2016-09-28 17:00:45 +01:00
Chris Hill-Scott
6bad0101c8 Merge pull request #939 from alphagov/platform-admin-reorg
Reorganise list of services on platform admin page
2016-09-13 12:06:14 +01:00
Chris Hill-Scott
2156085813 Fix right aligned table headings
The CSS for these wasn’t being set on the correct class.
2016-09-13 10:38:33 +01:00
Chris Hill-Scott
6c961cc792 Remove date table field type
No longer used anywhere.
2016-09-13 10:37:38 +01:00
Chris Hill-Scott
17d5af1a6e Show delivery time even for failed notifications
We reckon it’s probably still useful.
2016-09-13 10:37:38 +01:00
Chris Hill-Scott
2d7ed4d34f Fix overlapping text on tables of notifications
This commit changes the tables of notifications from 3 columns to two
columns. This is so the text has more room, so it doesn’t start
overlapping.

It also makes sure that if the recipient gets really long that it will
be cut off with an ellipsis, rather than overlapping…

I hypothesize that if a notification fails you probably don’t care when
it failed, just that it failed.
2016-09-13 10:37:38 +01:00
bandesz
d11c7e08c2 Add final error page texts 2016-09-12 16:49:52 +01:00
bandesz
15fd390432 Add custom static error pages for 413 and some 5xx errors 2016-09-12 16:11:34 +01:00
Chris Hill-Scott
93a1f194e9 Remove ‘active’ title on team page
This section of the page is covered by the ‘Team members’ `<h1>`.

Only the invited users is a special case that needs its own title.
2016-09-07 15:16:02 +01:00
Chris Hill-Scott
32b34ddb06 Fix top keyline on tables with hidden col headings
The way that we collapse column headings so that they don’t take up any
vertical space is by setting their `font-size` to zero. However this
seems to take them out of the flow of the document, so their top border
also disappears. This commit sets the `font-size` to the smallest
non-zero value to avoid this.
2016-09-01 16:13:51 +01:00
Chris Hill-Scott
4342b721f1 Show upcoming jobs on the dashboard
On the dashboard:
- adds a new ‘in the next 24 hours’ section to the dashboard which lists
  upcoming jobs
- tweaks some spacing on the dashboard so that it doesn’t look like too
  much of a mess
- don’t show scheduled jobs in the table of normal jobs

On the jobs page:
- don’t show scheduled jobs
2016-08-31 16:58:43 +01:00
Chris Hill-Scott
225a61ddd3 Add a component for picking the time to send a job
Users need to pick a time in the next 24hrs, or send a file immediately.

Rationale for this is a bit lost in time-before-holiday, but generally:

‘Now’ and ‘later’ as the inital choices makes it really clear what
this feature is about conceptually.

The choice of times is absolute, eg ‘1pm’ not ‘in 3 hours’
2016-08-31 16:58:09 +01:00
Chris Hill-Scott
45c4b24d9a Make placeholder highlighting align at all size
Because the placeholder highlighting was defined in pixels it got
slightly out of line when it was used at larger type sizes, eg inside a
heading.

By using `em`s it will scale with the size of the type.
2016-08-30 15:34:12 +01:00
Chris Hill-Scott
3b3245adbd Explain trial mode on the settings page
The previous text on this page around trial mode was a bit of a
mouthful. Also it only really made sense if you already knew what trial
mode was.

This commit tries to make it really explicit:
- that you’re in trial mode
- what it means to be in trial mode (copied from the trial mode page)
- where you go to not be in trial mode
2016-08-24 15:16:13 +01:00
Chris Hill-Scott
bc0c620fa1 Delete spacer.png
Depends on:
- [ ] https://github.com/alphagov/notifications-utils/pull/63
- [ ] https://github.com/alphagov/notifications-api/pull/587

The utils fix needs to be deployed to live on the API before this can be merged/deployed
2016-08-08 12:00:00 +01:00
Chris Hill-Scott
aed10f711c Add spacer image for email template
Forgot to include this before.

The template expects it in `./images` but it should probably live in
`./images/email-template`.

This commit puts it in both places; we can clean up later.
2016-08-08 11:12:01 +01:00
Chris Hill-Scott
d0ac61403a Merge pull request #837 from alphagov/add-crests
Add department crests for email sub branding
2016-08-08 10:27:30 +01:00
Chris Hill-Scott
940815b33c Tighten up spacing around download link 2016-08-05 10:59:49 +01:00
Chris Hill-Scott
b9a69def00 Revert "Stop AJAX updater consuming ever-increasing memory" 2016-08-04 12:06:04 +01:00
Chris Hill-Scott
776299c26f Add department crests for email sub branding
We need to host these images somewhere. Let’s start off doing it in
the admin app, like we do for other email assets.

Eventually we should have a CDN in front of this.

Images lifted from
76ff2e0b6d/app/assets/images/crests
2016-08-03 14:42:13 +01:00
Chris Hill-Scott
ec724ce417 Stop AJAX updater consuming ever-increasing memory
The pages with AJAX on were feeling quite sluggish, and it felt like
they were making the whole browser slow down.

Looking at the performance stuff in Chrome, the number of DOM nodes was
going up and up, which is weird because the number of things on the page
wasn’t changing. This was causing the page to consume more and more
memory in order to store all these nodes.

This is kinda beyond my understanding, but I tried a few things and it
looks like the browser was having a hard time garbage collecting the
temporary bits of DOM used to update the page.

By assinging these bits of DOM to variables before using them it seems
that the browser has an easier time cleaning them up.
2016-08-03 10:29:25 +01:00
Chris Hill-Scott
f22b61b9f4 Add beta banner to homepage
Because the homepage of the app is discoverable to the public, it makes
“gives the wrong impression” for it not to have a beta banner.
2016-07-28 09:08:15 +01:00
Chris Hill-Scott
1c8c86bd1c Merge pull request #781 from alphagov/template-previews
Adds previews of email templates
2016-07-15 10:35:15 +01:00
Chris Hill-Scott
9c83d559f3 Fix wonky tables on dashboard and activity page
Tables with a `layout` of `fixed` determine column widths from the
width of the column headings.

We weren’t setting the width of the first column heading, so our tables
were getting out of alignment.
2016-07-13 16:56:28 +01:00