Sending notifications don’t have an `updated_at`. This causes the time
formatting to throw a wobly, because it doesn’t expect `None`.
This commit changes the template to also look for the `created_at`,
which all notifications have.
When you edit a template, you’re probably going to do something with
it straight afterwards, eg send yourself a test.
We could make it easy to find the template you’ve just saved by putting
it at the top of the pile. This gets confusing for other reasons (order
of templates will constantly shift about).
So this commit changes the flow to take you to the single page for the
template you’ve just edited.
For the button on the check page, we need to be able to say ‘1 text message’ or
‘55 emails’. We already have the logic to do this on the dashboard (101 text
messages sent), and it’s already in a component. So this commit makes the check
page use the same component.
We have a couple of places now where we want nice lists made from `list`s, eg
- ‘name’, ‘date’ and ‘phone number’
- ((firstname)) ((lastname)) or ((date))
This commit adds a more generic component for doing this, which can handle:
- 1, 2, and n items
- comma (or other character) separated lists
- a conjunction between the last and one-before-last item
- characters to be inserted before and after each item, eg an opening and
closing HTML tag
It also pulls the `list_of_placeholders` component from the breaking change
page, and makes it use the `formatted_list` component under the hood.
Row-level errors are:
- bad phone number/email address
- missing data
I think it’s distracting to show these on the page if there’s something more
fundamentally wrong with the file, eg placeholders don’t match.
So this commit makes sure that these error messages are only displayed when the
top-level error says ‘There is a problem with your data’
This commit rearranges the CSV errors (again) to make them geared towards
teaching you how to match placeholders to the column headers.
So the order of errors now is:
1. No phone number/email column
2. Column headers don’t match placeholders
3. Missing or bad data
4. Trial mode
5. Daily limit reached
This depends on:
- [x] https://github.com/alphagov/notifications-utils/pull/39 for 1.
‘How to format your file’ sounds complicated and incidental.
‘See an example’ sounds like something that might be useful if you’re feeling
stuck.
Also makes the list of file formats a list, because it’s a list.
While the blue should help reinforce the relationship between the placeholders
and the column headings, it makes the column headings very busy visually, and
less like column headings. Which make the relationship harder to see. I think.
Now that the example on the breaking changes page looks more like a spreadsheet,
we should do the same thing for the downloadable example on the send page.
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.
While battling the bank holiday traffic on my way home this evening I realised
why looking at the job page was causing lots of 403 errors in the Chrome
console (a spike which was reflected on the Graphite screen).
There is a separate `.json` endpoint for getting updates to a job. This enpoint
did not have the `admin=True` option set in its permissions decorator. So when
viewing a service as a platform admin you could see the page, but not receive
any AJAX-powered updates to it.
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.