1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00

Update frontend for locking page

Former-commit-id: e7a41b6d0ef9fc0814b4f6fa378370a2dc94749b [formerly 54b793d738e5deb2ebf2e8316a1f43e3450900aa] [formerly 842e120f0f69713229f4227bd90f8c33ce2932b3 [formerly 9c95fd350104dd20055c7564fc5e167e21409c38 [formerly b9860a5d2f]]]
Former-commit-id: 3d6c223179053689aa785e50ba1a6d7affd075aa [formerly 61ab106b098ea088e70597cb1a5a19e3a71eced9]
Former-commit-id: ab5ef985f31336a09d0a6d9dd7291967ea4da3f0
Former-commit-id: a7f6cd8a0e
This commit is contained in:
Zack Scholl 2017-03-23 09:57:25 -06:00
parent 4709654c4c
commit 3fd886e625

View File

@ -41,6 +41,10 @@
background: #fff; background: #fff;
} }
.success {
color: #5cb85c;
}
.pure-menu a { .pure-menu a {
color: #777; color: #777;
} }
@ -100,6 +104,7 @@
function debounce(func, wait, immediate) { function debounce(func, wait, immediate) {
var timeout; var timeout;
return function() { return function() {
$('#saveEditButton').removeClass()
$('#saveEditButton').text("Editing"); $('#saveEditButton').text("Editing");
var context = this, var context = this,
args = arguments; args = arguments;
@ -118,6 +123,7 @@
// And it only fires 500ms or half a second after the user stopped typing // And it only fires 500ms or half a second after the user stopped typing
$('#userInput').on('keyup', debounce(function() { $('#userInput').on('keyup', debounce(function() {
console.log('typing occurred'); console.log('typing occurred');
$('#saveEditButton').removeClass()
$('#saveEditButton').text("Saving") $('#saveEditButton').text("Saving")
upload(); upload();
}, 500)); }, 500));
@ -131,6 +137,12 @@
page: "{{ .Page }}" page: "{{ .Page }}"
}), }),
success: function(data) { success: function(data) {
$('#saveEditButton').removeClass()
if (data.success == true) {
$('#saveEditButton').addClass("success");
} else {
$('#saveEditButton').addClass("failure");
}
$('#saveEditButton').text(data.message); $('#saveEditButton').text(data.message);
}, },
error: function(xhr, error) { error: function(xhr, error) {
@ -149,6 +161,12 @@
page: "{{ .Page }}" page: "{{ .Page }}"
}), }),
success: function(data) { success: function(data) {
$('#saveEditButton').removeClass()
if (data.success == true) {
$('#saveEditButton').addClass("success");
} else {
$('#saveEditButton').addClass("failure");
}
$('#saveEditButton').text(data.message); $('#saveEditButton').text(data.message);
}, },
error: function(xhr, error) { error: function(xhr, error) {
@ -168,9 +186,22 @@
passphrase: passphrase passphrase: passphrase
}), }),
success: function(data) { success: function(data) {
$('#saveEditButton').removeClass()
if (data.success == true) {
$('#saveEditButton').addClass("success");
} else {
$('#saveEditButton').addClass("failure");
}
$('#saveEditButton').text(data.message); $('#saveEditButton').text(data.message);
if ($('#lockPage').val() == "Lock") {
$('#lockPage').text("Unlock");
} else {
$('#lockPage').text("Lock");
}
}, },
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",