Make the flow of using templates better

For users who:
- want to send messages from a template
- want to edit templates

For developers:
- who need to get the ID of a template

This commit mainly cleans up the choose template page so there are less
options, and the options that are there are less wordy.

This means:
- moving ‘send yourself a test’ onto the send messages page, and making
  it button
- stripping a lot of stuff out of the ‘send from API’ page, so it’s more
  obvious what the template ID is
This commit is contained in:
Chris Hill-Scott
2016-04-18 11:10:47 +01:00
parent ddec619913
commit 27ad1532e4
20 changed files with 102 additions and 115 deletions

View File

@@ -6,13 +6,13 @@
Modules.ApiKey = function() {
const states = {
'keyVisible': key => `
'keyVisible': (key, thing) => `
<span class="api-key-key">${key}</span>
<input type='button' class='api-key-button-copy' value='Copy API key to clipboard' />
<input type='button' class='api-key-button-copy' value='Copy ${thing} to clipboard' />
`,
'keyCopied': `
'keyCopied': thing => `
<span class="api-key-key">Copied to clipboard</span>
<input type='button' class='api-key-button-show' value='Show API key' />
<input type='button' class='api-key-button-show' value='Show ${thing}' />
`
};
@@ -30,21 +30,22 @@
this.start = function(component) {
const $component = $(component),
key = $component.data('key');
key = $component.data('key'),
thing = $component.data('thing');
$component
.html(states.keyVisible(key))
.html(states.keyVisible(key, thing))
.attr('aria-live', 'polite')
.on(
'click', '.api-key-button-copy', () =>
this.copyKey(
$('.api-key-key', component)[0], () =>
$component.html(states.keyCopied)
$component.html(states.keyCopied(thing))
)
)
.on(
'click', '.api-key-button-show', () =>
$component.html(states.keyVisible(key))
$component.html(states.keyVisible(key, thing))
);
};