Commit Graph

27 Commits

Author SHA1 Message Date
Chris Hill-Scott
0df88f923c Refactor sticky button into component 2019-01-14 15:05:08 +00:00
Chris Hill-Scott
509a9e861d Use sticky footer on edit template page
If you have a long template it’s annoying to have to scroll all the
way to the bottom to click save, when you’ve only changed a small thing
near the staert of the content.
2019-01-14 15:05:04 +00:00
Chris Hill-Scott
d9da219b7e Use a macro for form tags
This will stop us repeatedly forgetting to add `novalidate` and
`autocomplete='off'` to our forms (which is how most of them are set
up).

It uses sensible defaults, based on how we most-commonly configure
forms:
- most of our forms are `post`ed (but this can be overridden)
- `autocomplete` should only be enabled where it makes sense, otherwise
  it’s more annoying than useful (but this can be overriden)
- we should never be using HTML5 form validation because our own error
  styles and messages are better
2018-09-19 12:43:15 +01:00
Rebecca Law
d512f330cd Edit, don’t duplicate, existing templates 2018-07-31 16:23:46 +01:00
Chris Hill-Scott
19632ea4ab Add option to copy existing template when adding
Sometimes when setting up a service you might have a few very similar
templates, in which only a small amount of content. Or you might even
have a few of services, which are used by different teams but have
similar templates.

Copy and pasting, especially from one service to another, is a pain.
This commit makes it easier by allowing users to copy an existing
template when choosing to add a new one, instead of starting from
scratch.
2018-07-30 11:31:51 +01:00
Leo Hemsted
7ddad7c99e dont use has_permissions to check for platform admins
platform_admin is a separate concept to permissions, so by removing the
checks for it from the current_user.has_permissions function, we can
simplify things greatly. We already record on the user whether they're
a platform admin anyway.
2018-03-06 13:08:06 +00:00
Chris Hill-Scott
d9a63c07a9 Refactor user permissions to use args, not list
This makes the interface a bit cleaner and less verbose.
2018-01-16 11:22:57 +00:00
Chris Hill-Scott
d5b78fac17 Move delete link from edit to view template page
Users were having trouble finding the delete template link. It sort of
made sense having it on the edit page before we had the view template
page. But it doesn’t make sense now – having to choose to ‘edit’ the
template before you can delete is counterintuitive.

The single template page is where you go to choose an action to perform
on your template. Deleting is a good example of an action you can
perform on a template.

So this commit moves the delete link from the edit template page to the
view template page.

It also puts the confirm banner on same page as the delete link

The idea being that, in order to make a decision about whether to delete
the template, it’s useful to be able to see the template you’re
deleting. There’s no user need to edit the template before you delete
it.
2017-04-18 13:47:36 +01:00
Chris Hill-Scott
135ff1ee77 Include service name in page <title>
In pages specific to a service (e.g. dashboard and sub pages) the title
needs to distinguish which service it applies to. This is mainly to give
context to screen reader users who could be managing multiple services.

Implementing this uses template inheritance:

`page_title` includes `per_page_title` includes `service_page_title`

‘GOV.UK Notify’ is inserted into every page title.

Pages that set `service_page_title` get the service name inserted too.
2017-02-14 11:53:53 +00:00
Rebecca Law
b372ab7ba1 Change the selectField on the edit template form to a radio field.
It's more stylish
2017-01-19 09:35:34 +00:00
Rebecca Law
3dfb3806d2 Add a selectField to edit and create templates that is only visible for platform admins that makes the template a priority template.
There is a check that the template can not be created as priority if the user is not a platform admin.
There is a check that the template can not change the `priority` unless they are a platform admin.
2017-01-18 15:11:34 +00:00
Pete Herlihy
ab345c0871 Added optional content guidance on edit sms template view 2016-11-11 11:44:48 +00:00
Chris Hill-Scott
ee52e72f90 Move template guidance underneath
Two problems with having it on the side:
- some users didn’t see it at all
- there wasn’t space to have additional guidance about Markdown-style
  formatting
2016-08-02 09:29:11 +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
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
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
cfeb7514c3 Make placeholder hint work for SMS messages
The changes introduced in 54e42a2021
didn’t get applied to the add/edit SMS template page. This commit fixes
that.
2016-04-15 17:16:18 +01:00
Nicholas Staples
33cc90488c Fix template delete links.
Fix bug with 'current_service' not available for non service urls.

Code review adjustment.

Static code check.
2016-04-13 16:57:16 +01:00
Chris Hill-Scott
7307d77923 Merge pull request #370 from alphagov/add-tour
Make first time use clearer
2016-04-04 13:40:37 +01:00
Chris Hill-Scott
95b75d8220 Add a hint to ‘Template name’ text input
We’ve seen lots of users unsure what the ‘template name’ field is for,
especially on first use. Is it the subject line of the text message?
Will it be who the message comes from? Answer: neither.

So this commit adds a hint to make that clearer.
2016-04-04 09:35:59 +01:00
Chris Hill-Scott
eaa72074db Enhance the ‘how to do placeholders’ hint
This commit makes the ‘how to do placeholders’ box part of the tour,
with the same blue background.

It also adds some Javascript enhancement so that:
- it responds to the contents of the message template
- has a ‘show me’ link which inserts ‘Dear ((name))’ into the template
  contents textbox

We’ve found that this has helped people understnad what placeholders
are, and how to do them.
2016-04-04 09:25:41 +01:00
Chris Hill-Scott
370fd68a2c Fix innaccurate headings on add/edit template page
The same `.html` file is shared between adding a template and editing a
template.

The page heading needs to be contextual to the URL, either ‘add’ or ‘edit’.
Somewhere along the way this got lost; this commit reinstates it.
2016-03-14 10:39:52 +00:00
Chris Hill-Scott
b4e6f734c8 Reword the help text about adding placeholders
In research we’ve seen users struggle with this. Often they’d type
((Joe Bloggs)) or ((XX/XX/XXXX)) instead of a sensible name.

Lets see if explaining it differently helps.
2016-03-14 10:39:52 +00:00
Chris Hill-Scott
562fc4e73c Remove ‘cancel’ links from edit template page
Since cancel just takes you back to the list of templates, which is accessible
from the left nav, it’s only adding clutter to the page.
2016-03-14 10:39:52 +00:00
Chris Hill-Scott
c733b4318e Fix create SMS template
When creating an SMS template the form validation was looking for a subject.
SMS messages don’t have a subject.
2016-02-25 10:43:48 +00:00
Chris Hill-Scott
c6de605311 Add basic flow for adding email _or_ sms templates
Templates now have:
- a type (email or sms)
- a subject (if they are email templates)

We don’t want two completely separate view files for email and SMS, because they
would have an enormous amount of repetition.

So this commit adds
- different templates for SMS and email templates
- different form objects for SMS and email templates

…and wires them up.
2016-02-24 09:23:38 +00:00