Merge pull request #1410 from bookwyrm-social/safari-support
Supports Safari in form submission event
This commit is contained in:
commit
357e111411
|
@ -13,7 +13,7 @@ VERSION = "0.0.1"
|
||||||
PAGE_LENGTH = env("PAGE_LENGTH", 15)
|
PAGE_LENGTH = env("PAGE_LENGTH", 15)
|
||||||
DEFAULT_LANGUAGE = env("DEFAULT_LANGUAGE", "English")
|
DEFAULT_LANGUAGE = env("DEFAULT_LANGUAGE", "English")
|
||||||
|
|
||||||
JS_CACHE = "19447742"
|
JS_CACHE = "e5832a26"
|
||||||
|
|
||||||
# email
|
# email
|
||||||
EMAIL_BACKEND = env("EMAIL_BACKEND", "django.core.mail.backends.smtp.EmailBackend")
|
EMAIL_BACKEND = env("EMAIL_BACKEND", "django.core.mail.backends.smtp.EmailBackend")
|
||||||
|
|
|
@ -64,9 +64,21 @@ let StatusCache = new class {
|
||||||
* @return {undefined}
|
* @return {undefined}
|
||||||
*/
|
*/
|
||||||
submitStatus(event) {
|
submitStatus(event) {
|
||||||
event.preventDefault();
|
|
||||||
const form = event.currentTarget;
|
const form = event.currentTarget;
|
||||||
const trigger = event.submitter;
|
let trigger = event.submitter;
|
||||||
|
|
||||||
|
// Safari doesn't understand "submitter"
|
||||||
|
if (!trigger) {
|
||||||
|
trigger = event.currentTarget.querySelector("button[type=submit]");
|
||||||
|
}
|
||||||
|
|
||||||
|
// This allows the form to submit in the old fashioned way if there's a problem
|
||||||
|
|
||||||
|
if (!trigger || !form) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
BookWyrm.addRemoveClass(form, 'is-processing', true);
|
BookWyrm.addRemoveClass(form, 'is-processing', true);
|
||||||
trigger.setAttribute('disabled', null);
|
trigger.setAttribute('disabled', null);
|
||||||
|
|
Loading…
Reference in New Issue