add data-ajax-submit to email-test-modal
This commit is contained in:
parent
a91bc3388f
commit
b8eb78d11a
@ -77,7 +77,7 @@ postAdminTestR = do
|
||||
(FormFailure errs) -> forM_ errs $ addMessage Error . toHtml
|
||||
|
||||
let emailWidget' = [whamlet|
|
||||
<form method=post action=@{AdminTestR} enctype=#{emailEnctype}>
|
||||
<form method=post action=@{AdminTestR} enctype=#{emailEnctype} data-ajax-submit>
|
||||
^{emailWidget}
|
||||
|]
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
var OVERLAY_CLASS = 'modal__overlay';
|
||||
var OVERLAY_OPEN_CLASS = 'modal__overlay--open';
|
||||
var CLOSER_CLASS = 'modal__closer';
|
||||
var AJAX_SUBMIT_FLAG = 'ajaxSubmit'
|
||||
|
||||
window.utils.modal = function(modalElement, options) {
|
||||
|
||||
@ -40,7 +41,7 @@
|
||||
document.body.insertBefore(modalElement, null);
|
||||
|
||||
var form = modalElement.querySelector('form');
|
||||
if (form) {
|
||||
if (form && AJAX_SUBMIT_FLAG in form.dataset) {
|
||||
setupForm(form);
|
||||
}
|
||||
|
||||
@ -75,7 +76,7 @@
|
||||
}).then(function(response) {
|
||||
// TODO: process json response once backend returns json
|
||||
}).catch(function(error) {
|
||||
console.error('could not fetch or process response from ' + url, error);
|
||||
console.error('could not fetch or process response from ' + url, { error });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user