From bd3b9c96e10e435dedf36e935c9a7ec45de2d85d Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Thu, 23 Mar 2017 16:16:15 -0600 Subject: [PATCH] Clean up UI Former-commit-id: 15a1200308fe75f9c3163d400ff3c56287492dfb [formerly 79f3f90c3d0e620372f1ad338252a988135b302e] [formerly 3d62c398b3487e92160d35a200c08134fcf4eb32 [formerly 52370dde7adf6c4fe9899544567a2469c03b031a]] Former-commit-id: bbe42ca94a0e072215e5fef3f163add591206ab2 [formerly df5785bc10f23dab6110d38900a55946d95f0fce] Former-commit-id: 4c02db90005227a23605f2a46d6546ab3f698a99 Former-commit-id: a456b44b5ac1c0cb41840e14f5cd1658ecd50345 --- bindata.go.REMOVED.git-id | 2 +- handlers.go | 4 ++-- templates/index.tmpl | 31 ++++++++++++++++++++++--------- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/bindata.go.REMOVED.git-id b/bindata.go.REMOVED.git-id index f0c00ad..b7bf748 100644 --- a/bindata.go.REMOVED.git-id +++ b/bindata.go.REMOVED.git-id @@ -1 +1 @@ -34bb35db683f8a7a61bc69989052e94f30862994 \ No newline at end of file +5c9e26680d9e507e2c4fe676ac97c5785f72de79 \ No newline at end of file diff --git a/handlers.go b/handlers.go index ac698fb..f4c2024 100755 --- a/handlers.go +++ b/handlers.go @@ -83,7 +83,7 @@ func handlePageRequest(c *gin.Context) { // Destroy page if it is opened and primed if p.IsPrimedForSelfDestruct && !p.IsLocked && !p.IsEncrypted { - p.Update("*This page has now self-destructed.*\n\n" + p.Text.GetCurrent()) + p.Update("*This page has self-destructed. You can not return to it.*\n\n" + p.Text.GetCurrent()) p.Erase() } if command == "/erase" { @@ -176,7 +176,7 @@ func handlePageUpdate(c *gin.Context) { p.Save() message = "Saved" } - c.JSON(http.StatusOK, gin.H{"success": false, "message": message}) + c.JSON(http.StatusOK, gin.H{"success": true, "message": message}) } func handlePrime(c *gin.Context) { diff --git a/templates/index.tmpl b/templates/index.tmpl index 7562885..17eca06 100755 --- a/templates/index.tmpl +++ b/templates/index.tmpl @@ -43,6 +43,12 @@ .success { color: #5cb85c; + font-weight: bold; + } + + .failure { + color: #d9534f; + font-weight: bold; } .pure-menu a { @@ -147,6 +153,8 @@ $('#saveEditButton').text(data.message); }, error: function(xhr, error) { + $('#saveEditButton').removeClass() + $('#saveEditButton').addClass("failure"); $('#saveEditButton').text(error); }, contentType: "application/json", @@ -171,6 +179,8 @@ $('#saveEditButton').text(data.message); }, error: function(xhr, error) { + $('#saveEditButton').removeClass() + $('#saveEditButton').addClass("failure"); $('#saveEditButton').text(error); }, contentType: "application/json", @@ -235,6 +245,8 @@ } }, error: function(xhr, error) { + $('#saveEditButton').removeClass() + $('#saveEditButton').addClass("failure"); $('#saveEditButton').text(error); }, contentType: "application/json", @@ -262,6 +274,8 @@ } }, error: function(xhr, error) { + $('#saveEditButton').removeClass(); + $('#saveEditButton').addClass("failure"); $('#saveEditButton').text(error); }, contentType: "application/json", @@ -272,7 +286,7 @@ $("#encryptPage").click(function(e) { e.preventDefault(); - var passphrase = prompt("Please enter a passphrase", ""); + var passphrase = prompt("Please enter a passphrase. Note: Encrypting will remove all previous history.", ""); if (passphrase != null) { encryptPage(passphrase); } @@ -306,8 +320,10 @@ var passphrase = prompt("Please enter a passphrase to lock", ""); if (passphrase != null) { if ($('#lockPage').text() == "Lock") { + $('#saveEditButton').removeClass(); $("#saveEditButton").text("Locking"); } else { + $('#saveEditButton').removeClass(); $("#saveEditButton").text("Unlocking"); } lockPage(passphrase); @@ -318,7 +334,7 @@ $("#clearOld").click(function(e) { e.preventDefault(); - var r = confirm("This will erase all cleared list items, are you sure you want to do that?"); + var r = confirm("This will erase all cleared list items, are you sure you want to do that? (Versions will stay in history)."); if (r == true) { clearOld() } else { @@ -383,11 +399,6 @@
  • New

  • {{ if (or (.IsLocked) (.IsEncrypted) )}} - {{ if .IsLocked }} -
  • {{ if .IsLocked }}Unlock{{ else }}Lock{{end}}
  • - {{ else }} -
  • {{ if .IsEncrypted }}Decrypt{{ else }}Encrypt{{end}}
  • - {{ end }} {{ else }}
  • {{ if .IsEncrypted }}Decrypt{{ else }}Encrypt{{end}}
  • {{ if .IsLocked }}Unlock{{ else }}Lock{{end}}
  • @@ -401,9 +412,11 @@
  • View
  • {{ if (or (.IsLocked) (.IsEncrypted) )}} {{ if .IsLocked }} -
  • Locked
  • +
  • {{ if .IsLocked }}Unlock{{ else }}Lock{{end}}
  • +
  • Locked
  • {{ else }} -
  • Encrypted
  • +
  • {{ if .IsEncrypted }}Decrypt{{ else }}Encrypt{{end}}
  • +
  • Encrypted
  • {{ end }} {{else}} {{ if .ListPage }}