mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-09 19:04:33 -04:00
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:
@@ -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))
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user