This doesn’t need to be a form—it’s not changing any data.
And having the primary action on the page as ‘Use this template’ it makes it
clear what the page is for.
The first 3/last 3 messages didn’t test well, it wasn’t immediately obvious what
was going on.
This commit replaces it with just a preview of the first message, and a table
showing the details of the subsequent messages.
If the templates page contains text messages and emails then there’s two ways it
could be structured:
- into two sections, all text messages first, then all emails
- emails and text messages interleaved, sorted by date
I think the second one is better. Imagine a situation where you mostly do emails
but have a few text messages. You’d have to scroll past the text messages to get
to your emails. Every time.
I reckon that the most commonly accessed templates will be the most recent ones.
At the moment the file contents are not persisted by checked in
memory.
The first and last three records are show if all are valid.
If there are invalid rows, they are reported and the user is
prompted to go back and sort out upload file.
The storing of upload result (i.e. validation of file) in session
will be removed in next story which is about persisting of file
for later processing.
This commit:
- replaces links that look like buttons with forms and submit buttons
- splits the view code for SMS into its own file
- moves the routing into the Python by adding handling for `post` requests
- uses Flask’s `url_for` to generate URLs, rather than hard coding them (so that
it’s easier to change the URLs)
- chages the URLs for sending text messages