Commit Graph

220 Commits

Author SHA1 Message Date
Chris Hill-Scott
68cb76a12e Merge pull request #715 from alphagov/fancy-homepage
Make it clearer what Notify is for from homepage
2016-06-22 15:01:17 +01:00
Chris Hill-Scott
1667996716 Make it clearer what Notify is for from homepage
Uses some graphic design to communicate what Notify is:

- for sending messages to lots of people
- messages can be personalised
2016-06-22 14:37:02 +01:00
Leo Hemsted
cabf6cb6b1 Merge pull request #717 from alphagov/service-status
Add live/trial flag on platform-admin page
2016-06-22 14:28:44 +01:00
Chris Hill-Scott
2aabc4a7e9 Merge pull request #719 from alphagov/dashboard-link
Add a ‘dashboard’ link to the navigation
2016-06-22 14:12:27 +01:00
Chris Hill-Scott
0c31931876 Fix background colours on big numbers without links 2016-06-22 13:40:55 +01:00
Chris Hill-Scott
3ffeec6fbb Use tabular numbers for all big numbers
Reimplements https://github.com/alphagov/notifications-admin/pull/169

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

— 5f38012f94/docs/mixins.md (tabular-numbers)
2016-06-22 09:56:17 +01:00
Chris Hill-Scott
743c747688 Refactor navigation SASS
Moves the right-padding from being on the container and each element
to just being on the container.

No visual changes.
2016-06-22 09:34:21 +01:00
Chris Hill-Scott
9abd19e092 Add a ‘dashboard’ link to the navigation
It’s been unclear that:

- the dashboard exists
- that you click the name of the service to get back to it

So this commit:

- takes the link off the service name
- adds a link labelled ‘Dashboard’ to the navigation
2016-06-22 09:31:37 +01:00
Chris Hill-Scott
d2b4dd5007 Revert "Add character count as you type"
This reverts commit fbc4abf85d.
2016-06-20 16:03:21 +01:00
Chris Hill-Scott
c975e0f671 Remove placeholder hint JS
This was used for an older iteration of placeholder guidance. Not used
anywhere now.
2016-06-20 14:45:59 +01:00
Chris Hill-Scott
fbc4abf85d Add character count as you type
Text messages have a maximum length, which we tell the users. We
shouldn’t expect people to count the characters in the message
themselves.

This commit borrows [the word counter from the Digital Marketplace
frontend toolkit](9d17690de5/toolkit/javascripts/word-counter.js)
and adapts it to count characters instead.

Things I’m still not sure about with this:

- what should it say when the message goes over the length of one text
  message
- what’s the interaction with placeholders, which will change the length
  of the message

This commit also adds a line to the pricing page which explains that
service name counts towards the length of the message.
2016-06-20 14:45:59 +01:00
Chris Hill-Scott
3fa0e3aa66 Give more guidance about what to put in templates
There are some common questions that keep coming up when users are
editing or creating templates. This commit adds a pattern for sections
of guidance which can be shown/hidden.

It then modifies the guidance as follows.

Change:

- guidance about placeholders; give an example about what to do and what
  not to do (because the mistake we keep seeing people make is putting
  the thing itself, not the name of the thing)

Add (pretty basic at the moment but a need for these has come out of
research):

- guidance about links
- guidance about message length for text messages
2016-06-20 14:05:25 +01:00
Chris Hill-Scott
5a95f4a7dd Tighten up spacing for better visual grouping 2016-06-17 16:30:02 +01:00
Chris Hill-Scott
fa7345e9d0 Make template statistics on the dashboard a table
It was a `<dl>` before which is kinda weird. Especially when the jobs
table was a real `<table>`.

It also means we can give it column headings so that new and invited
users have a better idea of what it is.
2016-06-17 16:30:02 +01:00
Chris Hill-Scott
18578af75c Merge pull request #686 from alphagov/no-jump-email
Stop page jumping on first load with a long email
2016-06-15 09:38:56 +01:00
Chris Hill-Scott
66a33e4e47 Stop page jumping on first load with a long email
A long email message needs to be collapsed to only show the first few
lines. The problem is that we were doing this by adding a class with
Javascript, meaning that the email wasn’t being collapsed until the
script in the footer ran.

This caused a jump in the page because the browser was painting the
whole email message, then repainting it once it was collapsed.

This commit takes advantage of the `.js-enabled` class added to the
`<body>` by a script in the `<head>` of GOV.UK template.

This means that the email message is collapsed with CSS before the first
paint of the page, so no jump.

This introduces some complexity in how we determine which emails get the
expander toggle. Because they’re already collapsed we can’t get their
height and work out if they’re long enough to need collapsing.

So we need to take a copy of the message, put it off-screen, expand it,
get its height, then remove it from the DOM. Bit of a faff.

Because of this there’s still a quick flash of the toggle if you see an
email message that’s too short to need collapsing. I think this is the
lesser of two evils—very short email messages will be few and far
between in the real world.
2016-06-15 09:35:55 +01:00
Chris Hill-Scott
a0f6956eab Give headline numbers a blue, not black background
These numbers don’t look very clickable white-on-black.

Blue is the colour of links, so lets see if they are more clickable in
blue.

The same clicking-a-big-number thing is also happening on the activity
page, so this commit also changes the activity page to look the same.
2016-06-14 11:00:56 +01:00
Chris Hill-Scott
e7e0b2f227 Put counts into the notification filters
We can filter notifications on the activity page by state.

This commit adds counts to those filters.

This is mainly so that we can consistently do the same thing on the job
page later on.
2016-06-14 11:00:56 +01:00
Chris Hill-Scott
e5d2514846 Make template graphs look consistent with page
The graphs of template usage feel a bit weird to me now.

1. They are counts of messages, but the numbers are very small
   not big like we do everywhere else (eg the counts on a job)

2. There’s a lot of blue, especially for something that you can’t
   click

This commit makes the numbers bigger and the bar chart grey.
2016-06-14 11:00:56 +01:00
Chris Hill-Scott
cdc900b7ef Merge pull request #675 from alphagov/fix-table-display
Fix table display
2016-06-13 11:39:08 +01:00
Chris Hill-Scott
281c54b80b Make job counters smaller
With sending, delivered and failed all on one line there’s not much
space. When these numbers get relatively big (in the 000s) they can
start mushing into each other.

This commit makes them smaller so that they remain separate.
2016-06-13 10:26:01 +01:00
Chris Hill-Scott
4077e2860d Fix display of spreadsheet tables
a9f79bcf07 made all tables have a `fixed`
layout. This causes issues with the spreadsheet-looking tables.

This commit treats tables with half-width first columns as the
exception, not the rule, and makes other tables display as before.
2016-06-13 10:26:01 +01:00
Chris Hill-Scott
940170159a Handle AJAX errors when updating content
With the change in implementation in the previous commit, any error
(eg server responds with `500`) would cause the page to not be updated
again.

This is better than the previous implementation, whereby the browser
would re-request as fast as it could until it got a successful response.

This commit handles errors by clearing the render queue if the server
returns an error. So:

- Any updates that would have been performed based on this request are
  dropped
- Subsequent updates will be attempted as if it was the first load of
  the page, ie after a delay of `x` seconds
2016-06-12 14:16:27 +01:00
Chris Hill-Scott
9c92a2bd86 Stop AJAX updates queuing requests
The `updateContent` module updates a section of the page based on an
AJAX request.

The current implementation will poll every `x` seconds. If the server
takes a long time to respond, this results in a the browser queuing up
requests. If a particular endpoint is slow, this can result in one
client making enough requests to slow down the whole server, to the
point where it gets removed from the loadbalancer, eventually bringing
the whole site down.

This commit rewrites the module so that it queues up the render
operations, not the requests.

There is one queue per endpoint, so for
`http://example.com/endpoint.json`:

1. Queue is empty
```javascript
{
  'http://example.com/endpoint.json': []
}
```

2. Inital re-render is put on the queue…
```javascript
{
  'http://example.com/endpoint.json': [
    function render(){…}
  ]
}
```

…AJAX request fires
```
GET http://example.com/endpoint.json
```

3. Every `x` seconds, another render operation is put on the queue
```javascript
{
  'http://example.com/endpoint.json': [
    function render(){…},
    function render(){…},
    function render(){…}
  ]
}
```

4. AJAX request returns queue is flushed by executing each queued
render function in sequence
```javascript
render(response); render(response); render(response);
```
```javascript
{
  'http://example.com/endpoint.json': []
}
```

5. Repeat

This means that, at most, the AJAX requests will never fire more than
once every `x` seconds, where `x` defaults to `1.5`.
2016-06-12 14:15:04 +01:00
Chris Hill-Scott
a9f79bcf07 Truncate items that don’t fit in the first column
The first column of a table is a heading, and will always be 50% wide.

It makes the table harder to scan when the information in the first
column breaks onto multiple lines, and introduces uneven whitespace in
the table.

This commit adds some CSS to force things in the first column to only
ever be one line. If they are too long to fit, they get truncated with
an ellipsis (`…`)
2016-06-09 11:36:22 +01:00
Chris Hill-Scott
2e8e650733 Put same info in both tables of notifications
We have tables listing notifications on:
- the job page
- the ‘activity’ page

Previously that had subtly different information, in a different order.
This commit makes them exactly the same.
2016-06-09 11:36:22 +01:00
Chris Hill-Scott
d213e2cc67 Give each row in a table a heading
The first columns of our tables are always headings for the
subsequent columns, even though they go horizontally.

HTML has the `<th>` tag, which doesn’t just have to be used for headings
along the top of a table. So this commit changes the first column to be
a `<th>`.

This then allows us to style these elements differently, specifically
making them 50% wide. This makes pages like the dashboard align more
nicely.
2016-06-09 11:36:22 +01:00
Chris Hill-Scott
51f6450e5d Make placeholder look more editable
Depends on:
- [ ] https://github.com/alphagov/notifications-utils/pull/40

In research we’ve noticed two problems with the appearance of
placeholders:

1. We are inconsistent about when we display the ((double brackets)).
   Sometimes we show them, sometimes we don’t. This doesn’t help user’s
   understanding about where the column names in their CSV file come
   from, or how they can edit the template to fix any errors.

2. Because they look so different from normal `<textarea>` text, it’s
   not immediately obvious that they can be edited just like normal
   text. They look more like something that can be dragged/inserted.

So this commit:

1. Makes the brackets always-visible.

2. Makes the text colour of the placeholder `$text-colour`, and only
   highlights the name of the ‘variable’, not the brackets themselves.
2016-06-06 12:59:40 +01:00
Chris Hill-Scott
3ac76192d0 Warn users a template change will break things
When a user adds or removes placeholders in their template we should consider
this a ‘breaking change’ and warn them accordingly.

Implementing this mostly relies on using
https://github.com/alphagov/notifications-utils/pull/37

Temporarily storing the new template until the user confirms that they want to
make the changes in done using hidden fields. This is a bit hacky, but the
complexity of making sessions interact with WTForms was just too much to handle.

This commit also changes the example spreadsheet that we show on this page to
look more like a spreadsheet.
2016-05-31 17:07:05 +01:00
Chris Hill-Scott
b84d06bd68 Move parameters out of the …_message components
This commit refactors the `email_message` and `sms_message` UI components to
take fewer parameters.

`name`, `edit_link` and anything to do with versions are identical for both
text and email messages so I’ve moved them to the pages where you choose a
template or see the versions.

This commit also tidies up the wording and styling of the template history
stuff.
2016-05-27 11:08:40 +01:00
Chris Hill-Scott
16d83faa72 Put uploaded files on the dashboard
This commit depends on and uses the data returned by:
- [x] https://github.com/alphagov/notifications-api/pull/345
- [x] https://github.com/alphagov/notifications-api/pull/347
- [x] https://github.com/alphagov/notifications-admin/pull/612

It puts the last 5 jobs on the dashboard. This should be changed to all the jobs
from the last 7 days when that parameter is available.

It also:
- links to the jobs page
- makes the numbers on the jobs page consistent with the dashboard
- makes the numbers on an individual job consistent with the appearance of the
  dashboard
2016-05-26 09:00:00 +01:00
Chris Hill-Scott
c41944080c Make the tour interactive
_The code for this is quite hacky and light on tests. But I’d really like to get
it in the app for the research tomorrow to see how well the feature works._

This commit changes the tour from being a set of static screens to some help
which guides you through the process of sending your first test message.

The theory behind this is that what users are really struggling with is the
concept of a variable, rather than the relationship between the placeholders and
the column headers. And like learning to program, the best way to learn is by
taking an example and modifying it to your own needs.

This means that when someone adds their first service we set them up an
example email template and an example text message template. Then there is a
guided, three step process where _all_ the user can do is send a test message to
themselves.

Once the message is sent, the user still has the example templates which they
can edit, rather than having to remember what they’re supposed to be doing.
2016-05-25 13:14:09 +01:00
Chris Hill-Scott
45f21e9a10 Hide ‘created at…’ on the templates page
I don’t think that if there’s only one version of the template that it’s
useful to see the created at date.

The auditing stuff only becomes relevant once someone a template has been
changed.
2016-05-24 09:22:12 +01:00
Nicholas Staples
83f25cd89b Beautify the template version links and template link page. 2016-05-20 13:58:16 +01:00
Chris Hill-Scott
2ba801ff73 Add polyfill for HTML5 <details> element
The details element is fairly new. It doesn’t work in all browsers,
and isn’t keyboard/screenreader accessible even in some new browsers.

This commit adds the Polyfill script from GOV.UK elements[1] which
polyfills these features for browsers that don’t support them.

1. http://govuk-elements.herokuapp.com/typography/#typography-hidden-text
2016-05-17 14:54:05 +01:00
Chris Hill-Scott
c6ab4d2c94 Hide the instructions for formatting a CSV
> On the send pages, we have a call to action in the middle of the
> page with lots of words and placeholder buttony looking things
> above and below it....
>
> You'll also see this every time you use this page, even though you
> probably get it after a single use.
>
> So let's wrap it up under a usefully titled (?) help link that
> expands to reveal all the things.

This commit implements the above.

It also rewords the messaging to talk about various spreadsheet formats,
not just CSV.
2016-05-17 14:52:40 +01:00
Chris Hill-Scott
3dc349c8a7 Include template type in bar graph label
It’s possible that users will have email and SMS templates with similar
names, and will send them depending on their users’ contact preferences.

So it’s useful to be able to compare how many emails vs SMS you’re
sending, even if the template names are similar.
2016-05-13 10:19:46 +01:00
Chris Hill-Scott
1b8236f5f8 Make template usage on dashboard easier to scan
The dashboard looked a bit table-y. This commit makes four main changes:

- show a bar chart (drawn in CSS) for template usage (only shown if
  you’ve used more than one template recently)
- only break down template usage by template name, not template type
  (because that’s happening with the big numbers)
- change the style of the ‘show more’ links under each section so that
  they are all consistent, and a little less busy (one less keyline)
- remove the ‘recent templates‘ title so that the first two sections of
  the page group under ‘in the last 7 days’
2016-05-13 09:59:41 +01:00
Chris Hill-Scott
a659c75276 Give the <code> example in docs better CSS
- adds a background colour, to words wrapped in `<code>` tags, like we
  have for whole snippets of code
- reduces the font size of all code blocks
  a) to differentiate them further
  b) to fit more on the screen
2016-05-12 11:34:57 +01:00
Adam Shimali
5d7ff0cb47 Merge pull request #542 from alphagov/previous-weeks
Add a page to show delivery rates week-by-week
2016-05-09 10:17:59 +01:00
Chris Hill-Scott
b5d5689d5c Make right-aligned big numbers left aligned 2016-05-05 11:01:34 +01:00
Chris Hill-Scott
50427ecd3f Add a page to show delivery rates week-by-week
Implements
https://github.com/alphagov/notifications-api/pull/286

Will always show weeks as Monday to Sunday.
2016-05-05 10:56:20 +01:00
Chris Hill-Scott
6917e11207 Make ‘send emails/text messages’ link bold
It:
- makes this whole block of links slightly more prominent
- reinforces that ‘send’ is the primary action
2016-05-05 08:58:13 +01: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
9d37040d49 Add recipient to message previews
When previewing a template on the send page, having the recipient appear
as a placeholder should help reinforce the relationship between the
columns in the CSV and the placeholders.

Then, when previewing a message, having the template populated with the
first recipient’s email address/phone number should reinforce that
relationship again.
2016-05-05 08:45:29 +01:00
Chris Hill-Scott
00030bc254 Add usage to the dashboard
Takes the number of emails and SMS fragments sent from:
https://github.com/alphagov/notifications-api/pull/273

Using these numbers it’s possible to show:
- how much of your allowance is left
- or how much you have spent

For now the allowance and rates are hard coded.

Only for users that have manage service.
2016-05-03 11:06:12 +01:00
Chris Hill-Scott
f6ba5ec8d0 Merge pull request #528 from alphagov/activity-improvements
Link up the last 7 days
2016-05-03 10:58:51 +01:00
catherineheywood
d4c77f3164 Resize image file 2016-05-03 10:42:31 +01:00
catherineheywood
e11879ede7 Change JWT to JSON Web Tokens 2016-05-03 10:20:53 +01:00
Chris Hill-Scott
43ef3e86ae Make big numbers on the homepage linkable
The big numbers on the home page relate directly to the notifications on
the notification page. So let’s link them. With a _hyper_ link.

This commit actually adds two links, one of which is semantically
correct, and one of which is visually correct, ie makes the whole black
area of the box clickable/hoverable.
2016-04-29 16:03:56 +01:00