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
|
(FormFailure errs) -> forM_ errs $ addMessage Error . toHtml
|
||||||
|
|
||||||
let emailWidget' = [whamlet|
|
let emailWidget' = [whamlet|
|
||||||
<form method=post action=@{AdminTestR} enctype=#{emailEnctype}>
|
<form method=post action=@{AdminTestR} enctype=#{emailEnctype} data-ajax-submit>
|
||||||
^{emailWidget}
|
^{emailWidget}
|
||||||
|]
|
|]
|
||||||
|
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
var OVERLAY_CLASS = 'modal__overlay';
|
var OVERLAY_CLASS = 'modal__overlay';
|
||||||
var OVERLAY_OPEN_CLASS = 'modal__overlay--open';
|
var OVERLAY_OPEN_CLASS = 'modal__overlay--open';
|
||||||
var CLOSER_CLASS = 'modal__closer';
|
var CLOSER_CLASS = 'modal__closer';
|
||||||
|
var AJAX_SUBMIT_FLAG = 'ajaxSubmit'
|
||||||
|
|
||||||
window.utils.modal = function(modalElement, options) {
|
window.utils.modal = function(modalElement, options) {
|
||||||
|
|
||||||
@ -40,7 +41,7 @@
|
|||||||
document.body.insertBefore(modalElement, null);
|
document.body.insertBefore(modalElement, null);
|
||||||
|
|
||||||
var form = modalElement.querySelector('form');
|
var form = modalElement.querySelector('form');
|
||||||
if (form) {
|
if (form && AJAX_SUBMIT_FLAG in form.dataset) {
|
||||||
setupForm(form);
|
setupForm(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +76,7 @@
|
|||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
// TODO: process json response once backend returns json
|
// TODO: process json response once backend returns json
|
||||||
}).catch(function(error) {
|
}).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 });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user