mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2025-06-14 12:06:06 +00:00
Add general modal functions
The two generic modals are defined in the base template, and are used in various templates. So provide functions and remove duplicate code.
This commit is contained in:
@ -446,9 +446,7 @@
|
||||
|
||||
if(!canSearch)
|
||||
{
|
||||
var modal = $("#modal_error");
|
||||
modal.find('.modal-body p').text("Please fill out the " + main_field + " field.");
|
||||
modal.modal('show');
|
||||
showErrorModal("Please fill out the " + main_field + " field.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -298,6 +298,18 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function showErrorModal(message) {
|
||||
var modal = $('#modal_error');
|
||||
modal.find('.modal-body p').text(message);
|
||||
modal.modal('show');
|
||||
}
|
||||
|
||||
function showSuccessModal(message) {
|
||||
var modal = $("#modal_success");
|
||||
modal.find('.modal-body p').text(message);
|
||||
modal.modal('show');
|
||||
}
|
||||
</script>
|
||||
{% endif %}
|
||||
{%- endassets %}
|
||||
|
@ -251,9 +251,7 @@
|
||||
// handle apply changes button
|
||||
$(document.body).on("click",".button_apply_changes", function() {
|
||||
if (nNew || nEditing) {
|
||||
var modal = $("#modal_error");
|
||||
modal.find('.modal-body p').text("Previous record not saved. Please save it before applying the changes.");
|
||||
modal.modal('show');
|
||||
showErrorModal("Previous record not saved. Please save it before applying the changes.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -277,9 +275,7 @@
|
||||
// handle add record button
|
||||
$(document.body).on("click", ".button_add_record", function (e) {
|
||||
if (nNew || nEditing) {
|
||||
var modal = $("#modal_error");
|
||||
modal.find('.modal-body p').text("Previous record not saved. Please save it before adding more record.");
|
||||
modal.modal('show');
|
||||
showErrorModal("Previous record not saved. Please save it before adding more record.");
|
||||
return;
|
||||
}
|
||||
// clear search first
|
||||
|
@ -73,9 +73,7 @@
|
||||
$(document.body).on("click", ".button_delete", function(e) {
|
||||
e.stopPropagation();
|
||||
if ( $("#domainid").val() == 0 ){
|
||||
var modal = $("#modal_error");
|
||||
modal.find('.modal-body p').text("Please select domain to remove.");
|
||||
modal.modal('show');
|
||||
showErrorModal("Please select domain to remove.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -192,9 +192,7 @@
|
||||
// handle apply changes button
|
||||
$(document.body).on("click",".button_apply_changes", function() {
|
||||
if (nNew || nEditing) {
|
||||
var modal = $("#modal_error");
|
||||
modal.find('.modal-body p').text("Previous record not saved. Please save it before applying the changes.");
|
||||
modal.modal('show');
|
||||
showErrorModal("Previous record not saved. Please save it before applying the changes.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -217,9 +215,7 @@
|
||||
// handle add record button
|
||||
$(document.body).on("click", ".button_add_record", function (e) {
|
||||
if (nNew || nEditing) {
|
||||
var modal = $("#modal_error");
|
||||
modal.find('.modal-body p').text("Previous record not saved. Please save it before adding more record.");
|
||||
modal.modal('show');
|
||||
showErrorModal("Previous record not saved. Please save it before adding more record.");
|
||||
return;
|
||||
}
|
||||
// clear search first
|
||||
|
Reference in New Issue
Block a user