Bugzilla – Attachment 192747 Details for
Bug 41562
Introduce the concept of "stores" for regular javascript
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41562: Introduce "stores" for regular javascript
Bug-41562-Introduce-stores-for-regular-javascript.patch (text/plain), 6.93 KB, created by
Paul Derscheid
on 2026-02-09 12:06:51 UTC
(
hide
)
Description:
Bug 41562: Introduce "stores" for regular javascript
Filename:
MIME Type:
Creator:
Paul Derscheid
Created:
2026-02-09 12:06:51 UTC
Size:
6.93 KB
patch
obsolete
>From c6e045b99e14c2d56a764fa65488b13165ad47b2 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 9 Jan 2026 11:21:18 +0100 >Subject: [PATCH] Bug 41562: Introduce "stores" for regular javascript > >We already have "Stores" in Vue, here we are going to use a shared >object to store permissions and sysrepfs > >For follow-up bug reports we will have the need to store syspref's >values and permissions. > >It seems a good idea to have a "store" to share the permissions and >system preferences' values we need for the current page. Several >"script" tag can coexist and define their own permissions or sysprefs. > >Added on its own bug for reusability purpose. > >Test plan: >Test follow-up bug reports ;) > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> >--- > .../prog/en/includes/doc-head-close.inc | 1 + > .../en/includes/installer-doc-head-close.inc | 1 + > koha-tmpl/intranet-tmpl/prog/js/stores.js | 23 +++++++++++++++++++ > .../bootstrap/en/includes/doc-head-close.inc | 1 + > .../bootstrap/en/modules/sci/sci-main.tt | 1 + > .../bootstrap/en/modules/sco/help.tt | 1 + > .../bootstrap/en/modules/sco/printslip.tt | 1 + > .../bootstrap/en/modules/sco/sco-main.tt | 1 + > koha-tmpl/opac-tmpl/bootstrap/js/stores.js | 23 +++++++++++++++++++ > 9 files changed, 53 insertions(+) > create mode 100644 koha-tmpl/intranet-tmpl/prog/js/stores.js > create mode 100644 koha-tmpl/opac-tmpl/bootstrap/js/stores.js > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc >index 7b934facc7e..44d74f97e52 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc >@@ -47,6 +47,7 @@ > [% END %] > [% Asset.js('js/Gettext.js') | $raw %] > [% Asset.js('js/i18n.js') | $raw %] >+[% Asset.js('js/stores.js') | $raw %] > > [% IF ( login ) %] > [% Asset.css("css/login.css") | $raw %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/installer-doc-head-close.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/installer-doc-head-close.inc >index 688b2b10900..0a3cec07946 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/installer-doc-head-close.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/installer-doc-head-close.inc >@@ -18,6 +18,7 @@ > [% END %] > [% Asset.js('js/Gettext.js') | $raw %] > [% Asset.js('js/i18n.js') | $raw %] >+[% Asset.js('js/stores.js') | $raw %] > <style id="antiClickjack"> > body { > display: none !important; >diff --git a/koha-tmpl/intranet-tmpl/prog/js/stores.js b/koha-tmpl/intranet-tmpl/prog/js/stores.js >new file mode 100644 >index 00000000000..77f53e556df >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/js/stores.js >@@ -0,0 +1,23 @@ >+(function () { >+ const permissions = (window.permissions = window.permissions || {}); >+ >+ window.addPermissions = function (perms) { >+ for (const key in perms) { >+ if (Object.prototype.hasOwnProperty.call(perms, key)) { >+ permissions[key] = perms[key]; >+ } >+ } >+ }; >+})(); >+ >+(function () { >+ const prefs = (window.prefs = window.prefs || {}); >+ >+ window.addPrefs = function (sysprefs) { >+ for (const key in sysprefs) { >+ if (Object.prototype.hasOwnProperty.call(sysprefs, key)) { >+ prefs[key] = sysprefs[key]; >+ } >+ } >+ }; >+})(); >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc >index f63e4f08d70..38ed441b4a0 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc >@@ -83,6 +83,7 @@ > [% END %] > [% Asset.js('js/Gettext.js') | $raw %] > [% Asset.js('js/i18n.js') | $raw %] >+[% Asset.js('js/stores.js') | $raw %] > > [% Asset.css("lib/fontawesome/css/fontawesome.min.css") | $raw %] > [% Asset.css("lib/fontawesome/css/brands.min.css") | $raw %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt >index 12542451b60..f1946f43a1b 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt >@@ -79,6 +79,7 @@ > [% END %] > [% Asset.js('js/Gettext.js') | $raw %] > [% Asset.js('js/i18n.js') | $raw %] >+[% Asset.js('js/stores.js') | $raw %] > </head> > <body id="sci_main" class="sci"> > <div id="wrapper"> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/help.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/help.tt >index 4f91aa0d2ba..f1aaf98a79a 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/help.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/help.tt >@@ -49,6 +49,7 @@ > [% END %] > [% Asset.js('js/Gettext.js') | $raw %] > [% Asset.js('js/i18n.js') | $raw %] >+[% Asset.js('js/stores.js') | $raw %] > </head> > <body id="sco_help" class="sco"> > <div id="wrapper"> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/printslip.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/printslip.tt >index 8882cc72e33..ff542c5dc13 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/printslip.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/printslip.tt >@@ -31,6 +31,7 @@ > [% END %] > [% Asset.js('js/Gettext.js') | $raw %] > [% Asset.js('js/i18n.js') | $raw %] >+[% Asset.js('js/stores.js') | $raw %] > [% Asset.js("lib/jquery/jquery-3.6.0.min.js") | $raw %] > [% Asset.js("lib/jquery/jquery-migrate-3.3.2.min.js") | $raw %] > [% Asset.js("lib/fontfaceobserver/fontfaceobserver.min.js") | $raw %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt >index f7f52f0d0e5..6a7f5d00a23 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt >@@ -60,6 +60,7 @@ > [% END %] > [% Asset.js('js/Gettext.js') | $raw %] > [% Asset.js('js/i18n.js') | $raw %] >+[% Asset.js('js/stores.js') | $raw %] > </head> > <body id="sco_main" class="sco"> > <div id="wrapper"> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/stores.js b/koha-tmpl/opac-tmpl/bootstrap/js/stores.js >new file mode 100644 >index 00000000000..77f53e556df >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/stores.js >@@ -0,0 +1,23 @@ >+(function () { >+ const permissions = (window.permissions = window.permissions || {}); >+ >+ window.addPermissions = function (perms) { >+ for (const key in perms) { >+ if (Object.prototype.hasOwnProperty.call(perms, key)) { >+ permissions[key] = perms[key]; >+ } >+ } >+ }; >+})(); >+ >+(function () { >+ const prefs = (window.prefs = window.prefs || {}); >+ >+ window.addPrefs = function (sysprefs) { >+ for (const key in sysprefs) { >+ if (Object.prototype.hasOwnProperty.call(sysprefs, key)) { >+ prefs[key] = sysprefs[key]; >+ } >+ } >+ }; >+})(); >-- >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 41562
:
191062
|
191289
| 192747