Add "Are you sure?"-dialog to dirty forms (#1506)

* Add "Are you sure?"-dialog to dirty forms

* Better form detection
This commit is contained in:
Martin Gross
2019-12-04 13:59:08 +01:00
committed by Raphael Michel
parent 4e8bda0c96
commit 22eb9d3493
3 changed files with 199 additions and 0 deletions

View File

@@ -742,3 +742,9 @@ $(function () {
$("#ajaxerr").on("click", ".ajaxerr-close", ajaxErrDialog.hide);
moment.locale($("body").attr("data-datetimelocale"));
});
$(document).ready(function () {
$('form[method=post]').filter(function () {
return $(this).find("button:not([type=button]), input[type=submit]").length > 0;
}).areYouSure( {'message': gettext('You have unsaved changes!')});
});