From 8f2122943e3315ac7ab01ce3a2dad5047b454a87 Mon Sep 17 00:00:00 2001 From: David Cook Date: Thu, 14 Nov 2024 02:05:34 +0000 Subject: [PATCH] Bug 35716: (alternate) Javascript proof of concept --- Koha/Template/Plugin/Asset.pm | 15 +++++++++++---- .../prog/en/includes/intranet-bottom.inc | 1 + .../bootstrap/en/includes/opac-bottom.inc | 1 + public/shared/js/debug.js | 3 +++ 4 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 public/shared/js/debug.js diff --git a/Koha/Template/Plugin/Asset.pm b/Koha/Template/Plugin/Asset.pm index 0afe209805..b1a6cced7f 100644 --- a/Koha/Template/Plugin/Asset.pm +++ b/Koha/Template/Plugin/Asset.pm @@ -124,7 +124,7 @@ Returns the URL for the given file =cut sub url { - my ( $self, $filename ) = @_; + my ( $self, $filename, $args ) = @_; my $stash = $self->{_CONTEXT}->stash(); my $interface = $stash->get('interface'); @@ -136,13 +136,20 @@ sub url { my ($basename, $dirname, $suffix) = fileparse($filename, qr/\.[^.]*/); my $type = substr $suffix, 1; + + my $version = Koha::version; + $version =~ s/([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/$1.$2$3$4/; + + my $shared = $args->{shared}; + if ($shared){ + my $url = File::Spec->catfile('/shared',$dirname, "${basename}_${version}${suffix}"); + return $url; + } + my @dirs = ( "$theme", ".", ); - - my $version = Koha::version; - $version =~ s/([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/$1.$2$3$4/; foreach my $dir (@dirs) { my $abspath = File::Spec->catfile($root, $dir, $filename); if (-e $abspath) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc index cb6b50ae30..fd9e436c38 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc @@ -169,6 +169,7 @@ [% jsinclude | $raw # Parse the page template's JavaScript block if necessary %] [% END %] [% KohaPlugins.get_plugins_intranet_js | $raw %] + 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 50d78ea97b..859e79abd2 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc @@ -203,5 +203,6 @@ $(document).ready(function() { [% Asset.js("js/cookieconsent.js") | $raw %] [% END %] [% KohaPlugins.get_plugins_opac_js | $raw %] + diff --git a/public/shared/js/debug.js b/public/shared/js/debug.js new file mode 100644 index 0000000000..453e3f70c3 --- /dev/null +++ b/public/shared/js/debug.js @@ -0,0 +1,3 @@ +function debug_shared_js (){ + console.log("You successfully ran this function!"); +} -- 2.39.5