Bugzilla – Attachment 167869 Details for
Bug 37111
OPAC renewal - CSRF "op must be set"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37111: Add submit-form asset to OPAC assets
Bug-37111-Add-submit-form-asset-to-OPAC-assets.patch (text/plain), 1.80 KB, created by
David Nind
on 2024-06-18 20:00:41 UTC
(
hide
)
Description:
Bug 37111: Add submit-form asset to OPAC assets
Filename:
MIME Type:
Creator:
David Nind
Created:
2024-06-18 20:00:41 UTC
Size:
1.80 KB
patch
obsolete
>From 99e103074dab8735c75cfe9791267dd5932dbeda Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Tue, 18 Jun 2024 19:34:24 +0000 >Subject: [PATCH] Bug 37111: Add submit-form asset to OPAC assets > >Signed-off-by: David Nind <david@davidnind.com> >--- > .../opac-tmpl/bootstrap/js/form-submit.js | 36 +++++++++++++++++++ > 1 file changed, 36 insertions(+) > create mode 100644 koha-tmpl/opac-tmpl/bootstrap/js/form-submit.js > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/form-submit.js b/koha-tmpl/opac-tmpl/bootstrap/js/form-submit.js >new file mode 100644 >index 0000000000..d7b8222cbe >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/form-submit.js >@@ -0,0 +1,36 @@ >+/* keep tidy */ >+$(document).ready(function () { >+ $(".submit-form-link").click(function (e) { >+ e.preventDefault(); >+ let form_data = $(this).data(); >+ >+ let confirm_msg = form_data.confirmationMsg; >+ if (confirm_msg) { >+ let confirmation = confirm(confirm_msg); >+ if (!confirmation) { >+ return false; >+ } >+ delete form_data.confirmationMsg; >+ } >+ >+ let the_form = $("<form/>"); >+ if (form_data.method === "post") { >+ form_data.csrf_token = $('meta[name="csrf-token"]').attr("content"); >+ } >+ the_form.attr("method", form_data.method); >+ the_form.attr("action", form_data.action); >+ delete form_data.method; >+ delete form_data.action; >+ $.each(form_data, function (key, value) { >+ the_form.append( >+ $("<input/>", { >+ type: "hidden", >+ name: key, >+ value: value, >+ }) >+ ); >+ }); >+ $("body").append(the_form); >+ the_form.submit(); >+ }); >+}); >-- >2.39.2
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 37111
:
167860
|
167866
|
167867
|
167869
|
167870
|
167921
|
167922
|
168103
|
169157
|
169158