Commit Graph

4 Commits

Author SHA1 Message Date
Chris Hill-Scott
3483490f03 Fix colour preview not loading on page load
The event was changed from `change` to `input`. The trigger was not updated accordingly.
2018-08-22 16:51:16 +01:00
Chris Hill-Scott
b10f0747ae Use input event not keyup
The `oninput` event is a more performant way to detect changes to a
textbox’s contents (compared to `onkeydown`, `onpaste`, etc).

It’s not supported in older browsers, but since this is a likely to be
used by platform admin users only that’s OK.
2018-08-22 16:31:05 +01:00
Chris Hill-Scott
6501105768 Refactor to not repeat lots of Jinja code 2018-08-22 16:31:05 +01:00
Chris Hill-Scott
b73e42650d Refactor hex colour preview Javascript
This commit improves the code that previews a hex colour when setting up
or changing an email branding.

Specifically it:
- refactors the Javascript to conform to our patterns (module pattern,
  preprocessed with Gulp)
- makes the code work when there are multiple colour previews on one
  page

It also does some visual prettifying, because I couldn’t help myself…
2018-08-22 16:31:05 +01:00