Skip to content

Commit

Permalink
Add view to confirm display and destroy of the secret
Browse files Browse the repository at this point in the history
Signed-off-by: Knut Ahlers <[email protected]>
  • Loading branch information
Luzifer committed Aug 19, 2017
1 parent b6331ac commit 937a119
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 16 deletions.
24 changes: 12 additions & 12 deletions assets.go

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions frontend/application.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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 '|'
Expand All @@ -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]
Expand All @@ -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()
Expand All @@ -75,6 +85,7 @@ showData = (data) ->
$('#panelSecretURL').hide()
$('#notfound').hide()
$('#somethingwrong').hide()
$('#panelReadSecretPre').hide()
$('#panelReadSecret').show()
$('#panelReadSecret').find('textarea').val secret

Expand Down
19 changes: 16 additions & 3 deletions frontend/application.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<![endif]-->

<style>
#somethingwrong, #notfound, #panelReadSecret, #panelSecretURL {
#somethingwrong, #notfound, #panelReadSecret, #panelSecretURL, #panelReadSecretPre {
display: none;
}
.footer {
Expand Down Expand Up @@ -105,6 +105,21 @@ <h3 class="panel-title">{{T "title-secret-created"}}</h3>
</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>
Expand Down
6 changes: 6 additions & 0 deletions frontend/locale/de-de.all.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
},
Expand All @@ -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:"
},
Expand Down
6 changes: 6 additions & 0 deletions frontend/locale/en-us.all.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"btn-new-secret": {
"other": "New Secret"
},
"btn-reveal-secret": {
"other": "Show me the secret!"
},
"label-secret-data": {
"other": "Secret data:"
},
Expand All @@ -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:"
},
Expand Down

0 comments on commit 937a119

Please sign in to comment.