mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
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: a456b44b5a
This commit is contained in:
parent
a78468e086
commit
bd3b9c96e1
@ -1 +1 @@
|
|||||||
34bb35db683f8a7a61bc69989052e94f30862994
|
5c9e26680d9e507e2c4fe676ac97c5785f72de79
|
@ -83,7 +83,7 @@ func handlePageRequest(c *gin.Context) {
|
|||||||
|
|
||||||
// Destroy page if it is opened and primed
|
// Destroy page if it is opened and primed
|
||||||
if p.IsPrimedForSelfDestruct && !p.IsLocked && !p.IsEncrypted {
|
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()
|
p.Erase()
|
||||||
}
|
}
|
||||||
if command == "/erase" {
|
if command == "/erase" {
|
||||||
@ -176,7 +176,7 @@ func handlePageUpdate(c *gin.Context) {
|
|||||||
p.Save()
|
p.Save()
|
||||||
message = "Saved"
|
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) {
|
func handlePrime(c *gin.Context) {
|
||||||
|
@ -43,6 +43,12 @@
|
|||||||
|
|
||||||
.success {
|
.success {
|
||||||
color: #5cb85c;
|
color: #5cb85c;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.failure {
|
||||||
|
color: #d9534f;
|
||||||
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pure-menu a {
|
.pure-menu a {
|
||||||
@ -147,6 +153,8 @@
|
|||||||
$('#saveEditButton').text(data.message);
|
$('#saveEditButton').text(data.message);
|
||||||
},
|
},
|
||||||
error: function(xhr, error) {
|
error: function(xhr, error) {
|
||||||
|
$('#saveEditButton').removeClass()
|
||||||
|
$('#saveEditButton').addClass("failure");
|
||||||
$('#saveEditButton').text(error);
|
$('#saveEditButton').text(error);
|
||||||
},
|
},
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
@ -171,6 +179,8 @@
|
|||||||
$('#saveEditButton').text(data.message);
|
$('#saveEditButton').text(data.message);
|
||||||
},
|
},
|
||||||
error: function(xhr, error) {
|
error: function(xhr, error) {
|
||||||
|
$('#saveEditButton').removeClass()
|
||||||
|
$('#saveEditButton').addClass("failure");
|
||||||
$('#saveEditButton').text(error);
|
$('#saveEditButton').text(error);
|
||||||
},
|
},
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
@ -235,6 +245,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(xhr, error) {
|
error: function(xhr, error) {
|
||||||
|
$('#saveEditButton').removeClass()
|
||||||
|
$('#saveEditButton').addClass("failure");
|
||||||
$('#saveEditButton').text(error);
|
$('#saveEditButton').text(error);
|
||||||
},
|
},
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
@ -262,6 +274,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(xhr, error) {
|
error: function(xhr, error) {
|
||||||
|
$('#saveEditButton').removeClass();
|
||||||
|
$('#saveEditButton').addClass("failure");
|
||||||
$('#saveEditButton').text(error);
|
$('#saveEditButton').text(error);
|
||||||
},
|
},
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
@ -272,7 +286,7 @@
|
|||||||
|
|
||||||
$("#encryptPage").click(function(e) {
|
$("#encryptPage").click(function(e) {
|
||||||
e.preventDefault();
|
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) {
|
if (passphrase != null) {
|
||||||
encryptPage(passphrase);
|
encryptPage(passphrase);
|
||||||
}
|
}
|
||||||
@ -306,8 +320,10 @@
|
|||||||
var passphrase = prompt("Please enter a passphrase to lock", "");
|
var passphrase = prompt("Please enter a passphrase to lock", "");
|
||||||
if (passphrase != null) {
|
if (passphrase != null) {
|
||||||
if ($('#lockPage').text() == "Lock") {
|
if ($('#lockPage').text() == "Lock") {
|
||||||
|
$('#saveEditButton').removeClass();
|
||||||
$("#saveEditButton").text("Locking");
|
$("#saveEditButton").text("Locking");
|
||||||
} else {
|
} else {
|
||||||
|
$('#saveEditButton').removeClass();
|
||||||
$("#saveEditButton").text("Unlocking");
|
$("#saveEditButton").text("Unlocking");
|
||||||
}
|
}
|
||||||
lockPage(passphrase);
|
lockPage(passphrase);
|
||||||
@ -318,7 +334,7 @@
|
|||||||
|
|
||||||
$("#clearOld").click(function(e) {
|
$("#clearOld").click(function(e) {
|
||||||
e.preventDefault();
|
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) {
|
if (r == true) {
|
||||||
clearOld()
|
clearOld()
|
||||||
} else {
|
} else {
|
||||||
@ -383,11 +399,6 @@
|
|||||||
<li class="pure-menu-item"><a href="/" class="pure-menu-link">New</a></li>
|
<li class="pure-menu-item"><a href="/" class="pure-menu-link">New</a></li>
|
||||||
<hr>
|
<hr>
|
||||||
{{ if (or (.IsLocked) (.IsEncrypted) )}}
|
{{ if (or (.IsLocked) (.IsEncrypted) )}}
|
||||||
{{ if .IsLocked }}
|
|
||||||
<li class="pure-menu-item"><a href="#" class="pure-menu-link" id="lockPage">{{ if .IsLocked }}Unlock{{ else }}Lock{{end}}</a></li>
|
|
||||||
{{ else }}
|
|
||||||
<li class="pure-menu-item"><a href="#" class="pure-menu-link" id="encryptPage">{{ if .IsEncrypted }}Decrypt{{ else }}Encrypt{{end}}</a></li>
|
|
||||||
{{ end }}
|
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<li class="pure-menu-item"><a href="#" class="pure-menu-link" id="encryptPage">{{ if .IsEncrypted }}Decrypt{{ else }}Encrypt{{end}}</a></li>
|
<li class="pure-menu-item"><a href="#" class="pure-menu-link" id="encryptPage">{{ if .IsEncrypted }}Decrypt{{ else }}Encrypt{{end}}</a></li>
|
||||||
<li class="pure-menu-item"><a href="#" class="pure-menu-link" id="lockPage">{{ if .IsLocked }}Unlock{{ else }}Lock{{end}}</a></li>
|
<li class="pure-menu-item"><a href="#" class="pure-menu-link" id="lockPage">{{ if .IsLocked }}Unlock{{ else }}Lock{{end}}</a></li>
|
||||||
@ -401,9 +412,11 @@
|
|||||||
<li class="pure-menu-item {{ with .ViewPage }}pure-menu-selected{{ end }}"><a href="/{{ .Page }}/view" class="pure-menu-link">View</a></li>
|
<li class="pure-menu-item {{ with .ViewPage }}pure-menu-selected{{ end }}"><a href="/{{ .Page }}/view" class="pure-menu-link">View</a></li>
|
||||||
{{ if (or (.IsLocked) (.IsEncrypted) )}}
|
{{ if (or (.IsLocked) (.IsEncrypted) )}}
|
||||||
{{ if .IsLocked }}
|
{{ if .IsLocked }}
|
||||||
<li class="pure-menu-item"><span id="saveEditButton">Locked</span></li>
|
<li class="pure-menu-item"><a href="#" class="pure-menu-link" id="lockPage">{{ if .IsLocked }}Unlock{{ else }}Lock{{end}}</a></li>
|
||||||
|
<li class="pure-menu-item" class="pure-menu-link"><a href="#"><span id="saveEditButton">Locked</span></a></li>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<li class="pure-menu-item"><span id="saveEditButton">Encrypted</span></li>
|
<li class="pure-menu-item"><a href="#" class="pure-menu-link" id="encryptPage">{{ if .IsEncrypted }}Decrypt{{ else }}Encrypt{{end}}</a></li>
|
||||||
|
<li class="pure-menu-item" class="pure-menu-link"><a href="#"><span id="saveEditButton">Encrypted</span></a></li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{ if .ListPage }}
|
{{ if .ListPage }}
|
||||||
|
Loading…
Reference in New Issue
Block a user