Bugzilla – Attachment 191289 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.89 KB, created by
Owen Leonard
on 2026-01-12 16:35:39 UTC
(
hide
)
Description:
Bug 41562: Introduce "stores" for regular javascript
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2026-01-12 16:35:39 UTC
Size:
6.89 KB
patch
obsolete
>From 101cd54aebb4fefe799c59d2188a7295332528b2 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> >--- > .../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 098313f0402..14661a44eb0 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 >@@ -72,6 +72,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"> > [% INCLUDE 'masthead-sci.inc' %] >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 b930c847e08..b84857aa8b0 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/help.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/help.tt >@@ -43,6 +43,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 3228f8d1c70..e8f81f8fefa 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/printslip.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/printslip.tt >@@ -24,6 +24,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 ad3dc1ab1bf..4ecf10e38cc 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 >@@ -55,6 +55,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