Bug 20731: Move template JavaScript to the footer: Call number browser MARC plugin
authorOwen Leonard <oleonard@myacpl.org>
Wed, 3 Jan 2018 17:41:09 +0000 (17:41 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 6 Jul 2018 13:05:37 +0000 (13:05 +0000)
This patch modifies the call number browser plugin so that JavaScript is
in the footer instead of the header.

This patch also makes some unrelated changes: The page title has been
corrected; DataTables code has been removed as it was unused.

To test, apply the patch and configure a MARC framework to use
cn_browser.pl as the plugin for tag 952 subfield o.

Open an item for editing. The "Full call number" field should have an
active "..." link next to it. Clicking this should trigger a popup
window with the Call number browser. Confirm that submitting a new
search from this window works correctly.

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/cn_browser.tt

index 122da19..0f242ec 100644 (file)
@@ -1,32 +1,20 @@
 [% USE Asset %]
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; Tools</title>
-[% Asset.css("css/datatables.css") %]
+<title>Koha &rsaquo; Cataloging &rsaquo; Call number browser</title>
 [% INCLUDE 'doc-head-close.inc' %]
-[% INCLUDE 'datatables.inc' %]
 </head>
+
 <body id="cat_cn_browser" class="cat">
+    <div class="main container-fluid">
 [% UNLESS ( popup ) %]
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'cat-search.inc' %]
 [% END %]
 
-<script language="JavaScript">
-$(document).ready(function()
-{
-    $("#cn_browser_table").DataTable({"paging":   false, "bFilter": false, "info": false, "bSort": false});
-    $("#cn_browser_submit").click(function(){
-        window.location.href='/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=cn_browser.pl&popup&q='+$("#cn_browser_input").val();
-        return false;
-    });
-}
-
-);
-</script>
-
-<h1 style="text-align:center">Call numbers browser</h1>
+<h1>Call number browser</h1>
 
-<div style="margin:auto;text-align:center;">
+<div>
     <form method="get" action="cn_browser.pl">
     <label for="searchcn">Search call number:</label>
     <input type="text" id="cn_browser_input" name="q" value="[% q %]" />
@@ -59,4 +47,15 @@ $(document).ready(function()
     </tbody>
 </table>
 
-<br />
+[% MACRO jsinclude BLOCK %]
+    <script>
+        $(document).ready(function(){
+            $("#cn_browser_submit").click(function(){
+                window.location.href='/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=cn_browser.pl&popup&q='+$("#cn_browser_input").val();
+                return false;
+            });
+        });
+    </script>
+[% END %]
+
+[% INCLUDE 'intranet-bottom.inc' popup_window=1 %]