Bug 19356: Move staff client cart JavaScript to the footer
authorOwen Leonard <oleonard@myacpl.org>
Mon, 9 Jan 2017 16:31:19 +0000 (16:31 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 20 Oct 2017 19:54:29 +0000 (16:54 -0300)
This patch modifies the staff client cart template so that
JavaScript is included in the footer instead of the header.

To test, apply the patch and test the JavaScript-driven features of the
cart: All button controls, DataTables functionality.

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Correction for QA: Removed contditional around footer JS (from
copy-paste) because it will always be true.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt

index 30f276c..428e5d4 100644 (file)
@@ -1,3 +1,4 @@
+[% SET footerjs = 1 %]
 [% BLOCK controls %]
     <p style="padding: 7px 0; border-top : 1px solid #E8E8E8;">
         <a id="CheckAll" href="#"><i class="fa fa-check"></i> Select all</a> <a id="CheckNone" href="#"><i class="fa fa-remove"></i> Clear all</a>
     @import url([% interface %]/[% theme %]/css/print.css);
 </style>
     [% ELSE %][% INCLUDE 'doc-head-close.inc' %]
-<script type="text/javascript" src="[% interface %]/[% theme %]/js/cart.js"></script>
-<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
-[% INCLUDE 'datatables.inc' %]
        [% END %]
 </head>
 [% IF ( print_basket ) %]<body id="cart_basket" class="cart" onload="print();history.back();">[% ELSE %]<body id="cart_basket" class="cart">[% END %]
 
 </div>
 </div>
-</body>
+            [% INCLUDE js_includes.inc %]
+            [% UNLESS ( print_basket ) %]
+                [% INCLUDE 'datatables.inc' %]
+                <script type="text/javascript" src="[% interface %]/[% theme %]/js/cart.js"></script>
+                <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
+            [% END %]
+    </body>
 </html>