Added SweetAlert2 popups (#6)

This commit is contained in:
Chris Caron 2020-01-11 19:15:51 -05:00 committed by GitHub
parent 948454f4df
commit 96dcaf7758
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 64 additions and 2 deletions

View File

@ -12,6 +12,7 @@
<link rel="stylesheet" href="{% static 'css/base.css' %}" />
<link rel="shortcut icon" type="image/png" href="{% static 'favicon.ico' %}" />
<script src="{% static 'js/materialize.min.js' %}"></script>
<script src="{% static 'js/sweetalert2.all.min.js' %}"></script>
<title>{% block title %}{% trans "Apprise API" %}{% endblock %}</title>
</head>

View File

@ -140,6 +140,18 @@ document.querySelector('#addurl').onsubmit = function(event) {
// reset our form
form.reset();
Swal.fire(
'Save',
'Successfully saved the specified URL(s).',
'success'
);
} else {
Swal.fire(
'Save',
'Failed to save the specified URL(s).',
'error'
);
}
});
return false;
@ -160,6 +172,20 @@ document.querySelector('#addconfig').onsubmit = function(event) {
{
// update our settings
update();
// user notification
Swal.fire(
'Save',
'Successfully saved the specified URL(s).',
'success'
);
} else {
// user notification
Swal.fire(
'Save',
'Failed to save the specified URL(s).',
'error'
);
}
});
return false;
@ -178,8 +204,19 @@ document.querySelector('#donotify').onsubmit = function(event) {
}).then(function(response) {
if(response.status == 200)
{
// update our settings
alert('Notification Sent');
// user notification
Swal.fire(
'Notification',
'Successfully sent the notification(s).',
'success'
);
} else {
// user notification
Swal.fire(
'Notification',
'Failed to send the notification(s).',
'error'
);
}
});
return false;

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2014 Tristan Edwards & Limon Monte
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.