Bugzilla – Attachment 181235 Details for
Bug 39567
Move form-submit js into js includes files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39567: Run JS change in separate file ESM as per JS1
Bug-39567-Run-JS-change-in-separate-file-ESM-as-pe.patch (text/plain), 3.64 KB, created by
David Cook
on 2025-04-22 01:28:59 UTC
(
hide
)
Description:
Bug 39567: Run JS change in separate file ESM as per JS1
Filename:
MIME Type:
Creator:
David Cook
Created:
2025-04-22 01:28:59 UTC
Size:
3.64 KB
patch
obsolete
>From d0436919e397138eeec17bd22628db63992e6c58 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Tue, 22 Apr 2025 01:27:15 +0000 >Subject: [PATCH] Bug 39567: Run JS change in separate file ESM as per JS1 > >As per JS1 in the coding guidelines, I've moved the inline JS from >the template into a separate file. >--- > koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc | 8 +------- > koha-tmpl/intranet-tmpl/prog/js/form-submit.js | 7 ++++++- > koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc | 8 +------- > koha-tmpl/opac-tmpl/bootstrap/js/form-submit.js | 7 ++++++- > 4 files changed, 14 insertions(+), 16 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >index d60d163ede..d968eb8286 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >@@ -26,13 +26,7 @@ > [% Asset.js("lib/jquery/plugins/jquery.validate.min.js") | $raw %] > <!-- koha core js --> > [% Asset.js("js/staff-global.js") | $raw %] >-<script type="module"> >- import { submit_form } from "/intranet-tmpl/prog/js/form-submit.js"; >- $("body").on("click", ".submit-form-link", function (e) { >- e.preventDefault(); >- submit_form(this); >- }); >-</script> >+[% Asset.js("js/form-submit.js",{'type' => 'module'}) | $raw %] > [% INCLUDE 'js-date-format.inc' %] > [% INCLUDE 'js-patron-get-age.inc' %] > [% INCLUDE 'js-patron-format-address.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/form-submit.js b/koha-tmpl/intranet-tmpl/prog/js/form-submit.js >index 30855ff297..bcaaaa72ca 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/form-submit.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/form-submit.js >@@ -1,4 +1,4 @@ >-export function submit_form(form) { >+function submit_form(form) { > let form_data = $(form).data(); > > let confirm_msg = form_data.confirmationMsg; >@@ -33,3 +33,8 @@ export function submit_form(form) { > $("body").append(the_form); > the_form.submit(); > } >+ >+$("body").on("click", ".submit-form-link", function (e) { >+ e.preventDefault(); >+ submit_form(this); >+}); >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >index 020557af38..8b2fd7368a 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >@@ -102,13 +102,7 @@ > let logged_in_user_id = "[% logged_in_user.borrowernumber | html %]"; > </script> > [% Asset.js("js/global.js") | $raw %] >-<script type="module"> >- import { submit_form } from "/opac-tmpl/bootstrap/js/form-submit.js"; >- $("body").on("click", ".submit-form-link", function (e) { >- e.preventDefault(); >- submit_form(this); >- }); >-</script> >+[% Asset.js("js/form-submit.js",{'type' => 'module'}) | $raw %] > [% IF ( OPACAmazonCoverImages || SyndeticsCoverImages ) %] > [% Asset.js("js/amazonimages.js") | $raw %] > [% END %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/form-submit.js b/koha-tmpl/opac-tmpl/bootstrap/js/form-submit.js >index 30855ff297..bcaaaa72ca 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/js/form-submit.js >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/form-submit.js >@@ -1,4 +1,4 @@ >-export function submit_form(form) { >+function submit_form(form) { > let form_data = $(form).data(); > > let confirm_msg = form_data.confirmationMsg; >@@ -33,3 +33,8 @@ export function submit_form(form) { > $("body").append(the_form); > the_form.submit(); > } >+ >+$("body").on("click", ".submit-form-link", function (e) { >+ e.preventDefault(); >+ submit_form(this); >+}); >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 39567
:
180669
|
180687
|
180983
|
180984
|
180985
|
180986
|
180987
|
180988
|
181235
|
182168
|
182169
|
182170
|
182171
|
182234
|
182235
|
182236
|
182237