Sha256: b21664fe7c54df883907113f7cf927fb24fa5923d187bbebba913f20f4097e3f
Contents?: true
Size: 841 Bytes
Versions: 33
Compression:
Stored size: 841 Bytes
Contents
//= require thredded/core/on_page_load //= require thredded/core/serialize_form // Submit GET forms with turbolinks (() => { const Thredded = window.Thredded; const Turbolinks = window.Turbolinks; Thredded.onPageLoad(() => { if (!Turbolinks || !Turbolinks.supported) return; Array.prototype.forEach.call(document.querySelectorAll('[data-thredded-turboform]'), (form) => { form.addEventListener('submit', handleSubmit); }); }); const handleSubmit = (evt) => { evt.preventDefault(); const form = evt.currentTarget; Turbolinks.visit(form.action + (form.action.indexOf('?') === -1 ? '?' : '&') + Thredded.serializeForm(form)); // On mobile the soft keyboard doesn't won't go away after the submit since we're submitting with // Turbolinks. Hide it: Thredded.hideSoftKeyboard(); }; })();
Version data entries
33 entries across 33 versions & 2 rubygems