Add view to confirm display and destroy of the secret

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2017-08-19 15:49:15 +02:00
parent b6331ac902
commit 937a119027
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
6 changed files with 67 additions and 16 deletions

File diff suppressed because one or more lines are too long

View file

@ -29,6 +29,14 @@ hashLoad = () ->
if hash.length == 0
return
$('#panelNewSecret').hide()
$('#panelSecretURL').hide()
$('#notfound').hide()
$('#somethingwrong').hide()
$('#panelReadSecretPre').show()
requestSecret = () ->
hash = window.location.hash
hash = decodeURIComponent(hash)
parts = hash.split '|'
@ -47,6 +55,7 @@ initBinds = () ->
$('#formCreateSecret').bind 'submit', createSecret
$('#newSecret, .navbar-brand').bind 'click', newSecret
$(window).bind 'hashchange', hashLoad
$('#revealSecret').bind 'click', requestSecret
newSecret = () ->
location.href = location.href.split('#')[0]
@ -59,6 +68,7 @@ secretCreated = (data) ->
url = "#{location.href.split('#')[0]}##{secretHash}"
$('#panelNewSecret').hide()
$('#panelReadSecretPre').hide()
$('#panelSecretURL').show()
$('#panelSecretURL').find('input').val url
$('#panelSecretURL').find('input').focus()
@ -75,6 +85,7 @@ showData = (data) ->
$('#panelSecretURL').hide()
$('#notfound').hide()
$('#somethingwrong').hide()
$('#panelReadSecretPre').hide()
$('#panelReadSecret').show()
$('#panelReadSecret').find('textarea').val secret

View file

@ -1,6 +1,6 @@
// Generated by CoffeeScript 1.12.4
(function() {
var createSecret, dataNotFound, hashLoad, initBinds, newSecret, secretCreated, securePassword, showData, somethingWrong;
var createSecret, dataNotFound, hashLoad, initBinds, newSecret, requestSecret, secretCreated, securePassword, showData, somethingWrong;
securePassword = null;
@ -33,11 +33,21 @@
};
hashLoad = function() {
var hash, id, parts;
var hash;
hash = window.location.hash;
if (hash.length === 0) {
return;
}
$('#panelNewSecret').hide();
$('#panelSecretURL').hide();
$('#notfound').hide();
$('#somethingwrong').hide();
return $('#panelReadSecretPre').show();
};
requestSecret = function() {
var hash, id, parts;
hash = window.location.hash;
hash = decodeURIComponent(hash);
parts = hash.split('|');
if (parts.length === 2) {
@ -57,7 +67,8 @@
initBinds = function() {
$('#formCreateSecret').bind('submit', createSecret);
$('#newSecret, .navbar-brand').bind('click', newSecret);
return $(window).bind('hashchange', hashLoad);
$(window).bind('hashchange', hashLoad);
return $('#revealSecret').bind('click', requestSecret);
};
newSecret = function() {
@ -73,6 +84,7 @@
}
url = (location.href.split('#')[0]) + "#" + secretHash;
$('#panelNewSecret').hide();
$('#panelReadSecretPre').hide();
$('#panelSecretURL').show();
$('#panelSecretURL').find('input').val(url);
$('#panelSecretURL').find('input').focus();
@ -90,6 +102,7 @@
$('#panelSecretURL').hide();
$('#notfound').hide();
$('#somethingwrong').hide();
$('#panelReadSecretPre').hide();
$('#panelReadSecret').show();
return $('#panelReadSecret').find('textarea').val(secret);
};

View file

@ -23,7 +23,7 @@
<![endif]-->
<style>
#somethingwrong, #notfound, #panelReadSecret, #panelSecretURL {
#somethingwrong, #notfound, #panelReadSecret, #panelSecretURL, #panelReadSecretPre {
display: none;
}
.footer {
@ -105,6 +105,21 @@
</div>
</div>
<div class="panel panel-primary" id="panelReadSecretPre">
<div class="panel-heading">
<h3 class="panel-title">{{T "title-reading-secret"}}</h3>
</div>
<div class="panel-body">
<p>
{{T "text-pre-reveal-hint"}}
</p>
<p>
<button class="btn btn-success" id="revealSecret">{{T "btn-reveal-secret"}}</button>
</p>
</div>
</div>
<div class="panel panel-primary" id="panelReadSecret">
<div class="panel-heading">
<h3 class="panel-title">{{T "title-reading-secret"}}</h3>

View file

@ -11,6 +11,9 @@
"btn-new-secret": {
"other": "Neues Secret"
},
"btn-reveal-secret": {
"other": "Zeig mir das Secret!"
},
"label-secret-data": {
"other": "Inhalt des Secrets:"
},
@ -23,6 +26,9 @@
"text-powered-by": {
"other": "Läuft mit"
},
"text-pre-reveal-hint": {
"other": "Um das Secret anzuzeigen klicke diesen Button aber denk dran, dass das Secret nur einmal angezeigt und dabei gelöscht wird."
},
"text-pre-url": {
"other": "Dein Secret wurde angelegt und unter folgender URL gespeichert:"
},

View file

@ -11,6 +11,9 @@
"btn-new-secret": {
"other": "New Secret"
},
"btn-reveal-secret": {
"other": "Show me the secret!"
},
"label-secret-data": {
"other": "Secret data:"
},
@ -23,6 +26,9 @@
"text-powered-by": {
"other": "Powered by"
},
"text-pre-reveal-hint": {
"other": "To reveal the secret click this button but be aware doing so will destroy the secret. You can only view it once!"
},
"text-pre-url": {
"other": "Your secret was created and stored using this URL:"
},