2022-04-05 16:04:26 +00:00
|
|
|
$(document).ready(function() {
|
2022-04-07 16:18:23 +00:00
|
|
|
|
|
|
|
$('#add-email-helper').click(function (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
email = prompt("Destination email");
|
|
|
|
if(email) {
|
2022-04-22 08:51:52 +00:00
|
|
|
var n = $(".notification-urls");
|
2022-04-07 16:18:23 +00:00
|
|
|
var p=email_notification_prefix;
|
|
|
|
$(n).val( $.trim( $(n).val() )+"\n"+email_notification_prefix+email );
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-04-05 16:04:26 +00:00
|
|
|
$('#send-test-notification').click(function (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
data = {
|
2024-01-04 16:02:31 +00:00
|
|
|
notification_body: $('#notification_body').val(),
|
|
|
|
notification_format: $('#notification_format').val(),
|
|
|
|
notification_title: $('#notification_title').val(),
|
|
|
|
notification_urls: $('.notification-urls').val(),
|
2024-04-03 13:18:21 +00:00
|
|
|
tags: $('#tags').val(),
|
2024-01-04 16:02:31 +00:00
|
|
|
window_url: window.location.href,
|
2022-04-05 16:04:26 +00:00
|
|
|
}
|
2024-01-04 16:02:31 +00:00
|
|
|
|
|
|
|
|
2022-04-05 16:04:26 +00:00
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: notification_base_url,
|
2022-06-12 08:47:00 +00:00
|
|
|
data : data,
|
|
|
|
statusCode: {
|
|
|
|
400: function() {
|
|
|
|
// More than likely the CSRF token was lost when the server restarted
|
|
|
|
alert("There was a problem processing the request, please reload the page.");
|
|
|
|
}
|
|
|
|
}
|
2022-04-05 16:04:26 +00:00
|
|
|
}).done(function(data){
|
|
|
|
console.log(data);
|
2024-04-03 14:52:42 +00:00
|
|
|
alert(data);
|
2022-04-05 16:04:26 +00:00
|
|
|
}).fail(function(data){
|
|
|
|
console.log(data);
|
2022-06-12 08:47:00 +00:00
|
|
|
alert('There was an error communicating with the server.');
|
2022-04-05 16:04:26 +00:00
|
|
|
})
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|