Ensure show all tasks checkbox stays in better sync with the server
This commit is contained in:
parent
a9a4667231
commit
6b16ddfc31
16
js/main.js
16
js/main.js
|
|
@ -113,11 +113,8 @@ function setTaskComplete(incomplete = false) {
|
|||
if ( data.error ) {
|
||||
toastr.error(data.message, "Submission Error");
|
||||
return;
|
||||
if ( data.task.completed ) {
|
||||
toastr.success(data.message, "Task Complete");
|
||||
} else {
|
||||
toastr.success(data.message, "Task Incomplete");
|
||||
}
|
||||
toastr.success(data.message, (data.task.completed) ? "Task Complete" : "Task Incomplete");
|
||||
getTasks();
|
||||
updateImage();
|
||||
resetForm(true);
|
||||
|
|
@ -129,6 +126,7 @@ function setTaskComplete(incomplete = false) {
|
|||
}
|
||||
|
||||
function toggleShowAll() {
|
||||
const previousValue = ! $("#form_showall").prop('checked');
|
||||
$.ajax({
|
||||
url: 'ajax/toggleshowall.php',
|
||||
type: 'POST',
|
||||
|
|
@ -139,14 +137,16 @@ function toggleShowAll() {
|
|||
success: function(data, stat, jqo) {
|
||||
if ( data.error ) {
|
||||
toastr.error(data.message, "Form Data Error");
|
||||
} else {
|
||||
toastr.success(data.message, "Task List");
|
||||
getTasks();
|
||||
$("#form_showall").prop('checked', previousValue);
|
||||
return;
|
||||
}
|
||||
$("#form_showall").prop('checked', data.showall);
|
||||
toastr.success(data.message, "Task List");
|
||||
getTasks();
|
||||
},
|
||||
error: function(jqo, stat, error) {
|
||||
toastr.error("Could not communicate with server!", "Server Error");
|
||||
$("#form_showall").prop('checked', previousValue);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -177,7 +177,7 @@ function submitTask() {
|
|||
error: function(jqo, stat, error) {
|
||||
toastr.error("Could not communicate with server!", "Server Error");
|
||||
},
|
||||
complete function() {
|
||||
complete: function() {
|
||||
$("#form_submit").prop("disabled", false);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user