Closes #2638: Copy Button for Secrets (#2860)

* Added clipboard.min.js

* Added copy button to secrets

* renamed clipboard JS library
This commit is contained in:
hSaria
2019-02-21 18:26:19 +00:00
committed by Jeremy Stretch
parent 6f9ef3909a
commit add94c5254
5 changed files with 20 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,6 @@
$(document).ready(function() {
// Instantiate ClipboardJS on all copy buttons
new ClipboardJS('button.copy-secret');
// Unlocking a secret
$('button.unlock-secret').click(function(event) {
@@ -45,6 +47,7 @@ $(document).ready(function() {
console.log("Secret retrieved successfully");
$('#secret_' + secret_id).text(response.plaintext);
$('button.unlock-secret[secret-id=' + secret_id + ']').hide();
$('button.copy-secret[secret-id=' + secret_id + ']').show();
$('button.lock-secret[secret-id=' + secret_id + ']').show();
} else {
console.log("Secret was not decrypted. Prompt user for private key.");
@@ -67,6 +70,7 @@ $(document).ready(function() {
var secret_div = $('#secret_' + secret_id);
secret_div.html('********');
$('button.lock-secret[secret-id=' + secret_id + ']').hide();
$('button.copy-secret[secret-id=' + secret_id + ']').hide();
$('button.unlock-secret[secret-id=' + secret_id + ']').show();
}