Refined feedback

This commit is contained in:
Andy Dixon
2024-10-03 08:07:54 +01:00
committed by Andy Dixon
parent b9db592be2
commit cb0a8a3a62
+8 -2
View File
@@ -116,14 +116,15 @@ $(document).ready(function () {
}, },
success: function (response) { success: function (response) {
if (typeof response.error != "undefined") { if (typeof response.error != "undefined") {
alert(response.error); showMessage(response.error,"error");
} else { } else {
showMessage("New page Created","success");
$('#frameContainer').contents().get(0).location.href = response.url; $('#frameContainer').contents().get(0).location.href = response.url;
$("#newPageForm").dialog("close"); // Close the modal on success $("#newPageForm").dialog("close"); // Close the modal on success
} }
}, },
error: function () { error: function () {
alert('Failed to create the new page.'); showMessage("Failed to create the new page (API error)","error");
} }
}); });
}); });
@@ -195,6 +196,11 @@ $(document).ready(function () {
}); });
/**
* Show A message bar across the top of the screen for a few seconds
* @param message - string - message to be shown
* @param type - string "success" or "error"
*/
function showMessage(message, type) { function showMessage(message, type) {
var messageBar = $('#message-bar'); var messageBar = $('#message-bar');