Skip to content
Snippets Groups Projects
Commit 8210d2af authored by Piotr Gawron's avatar Piotr Gawron
Browse files

when there is an error during saving daily planning there is popup with info

parent dd0a5200
No related branches found
No related tags found
1 merge request!76Resolve "sometimes saving daily planning doesn't work"
Pipeline #
......@@ -217,6 +217,8 @@ $(document).ready(function () {
console.log(data);
saveButton.css('border-color', 'red');
showErrorInfo("There was an unexpected problem with saving data. " +
"Please contact administrators.");
setTimeout(function () {
saveButton.delay(200).css('border-color', currentBorder);
}, 200);
......
......@@ -24,6 +24,7 @@ $(document).ready(function () {
return true;
}
})
});
$.ajaxSetup({
......@@ -49,4 +50,24 @@ $.ajaxSetup({
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
}
}
});
\ No newline at end of file
});
function showErrorInfo(content) {
var errorDialogDiv = document.createElement("div");
document.body.appendChild(errorDialogDiv);
errorDialogDiv.innerHTML = '<div class="modal-dialog" role="document">' +
'<div class="modal-content">' +
'<div class="modal-header">ERROR' +
'<button type="button" class="close" data-dismiss="modal" aria-label="Close">' +
'<span aria-hidden="true">&times;</span></button>' +
'</div>' +
'<div name="error-content" class="modal-body">' + content + '</div>' +
'<div class="modal-footer">' +
'<button type="button" class="btn btn-outline pull-right" data-dismiss="modal">Close</button>' +
'</div>' +
'</div>' +
'</div>';
$(errorDialogDiv).attr("role", "dialog");
$(errorDialogDiv).addClass("modal modal-danger fade");
$(errorDialogDiv).modal("show");
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment