From aa9f610d9d9f497463fd147cc8e9660ce2e3501e Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 14 Jul 2014 09:05:05 -0400 Subject: [PATCH] Bug 9667 - Inventory scrolling to top with every click An "onclick" attribute on inventory results links causes the page to scroll to the top each time. This patch updates the click handling to use a progressive-enhancement method. Unrelated changes: I added use of the Branches T:T plugin to output library name instead of branchcode, and put a check around call number to prevent output of empty [] in results. To test, use the inventory tool to check a batch of items. On the results page: - Confirm that branch name is shown instead of code. - Confirm that no [] shows for items without call numbers - Confirm that clicking a title opens a pop-up window showing details for that title. - Confirm that clicking a title opens a pop-up window whether you're on the first page of results or any subsequent page. Signed-off-by: Ian Beardslee Tested in Firefox and Chromium. Signed-off-by: Jonathan Druart --- .../intranet-tmpl/prog/en/modules/tools/inventory.tt | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt index c2d9a8c..c6832fc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt @@ -1,4 +1,5 @@ [% USE KohaDates %] +[% USE Branches %] [% INCLUDE 'doc-head-open.inc' %] Koha › Tools › Inventory [% INCLUDE 'doc-head-close.inc' %] @@ -32,10 +33,17 @@ $(document).ready(function(){ inventorydt = $('#inventoryt').dataTable($.extend(true, {}, dataTablesDefaults, { 'sPaginationType': 'full_numbers', [% IF compareinv2barcd %] - "aoColumnDefs": [ { "bSortable": false, "aTargets": [ 1 ] } ] + "aoColumnDefs": [ { "bSortable": false, "aTargets": [ 1 ] } ], [% ELSE %] - "aoColumnDefs": [ { "bSortable": false, "aTargets": [ 0 ] } ] + "aoColumnDefs": [ { "bSortable": false, "aTargets": [ 0 ] } ], [% END %] + 'fnDrawCallback': function() { + //bind the click handler script to the newly created elements held in the table + $('.openWin').bind('click',function(e){ + e.preventDefault(); + openWindow(this.href,'marcview',800,600); + }); + } } )); @@ -78,7 +86,7 @@ $(document).ready(function(){ $(".checkboxed").unCheckCheckboxes(); return false; }); - }); +}); //]]> @@ -249,10 +257,11 @@ $(document).ready(function(){ [% result.barcode | html %] - [% result.homebranch | html %] [% result.location | html %] [[% result.itemcallnumber | html %]] + [% Branches.GetName( result.homebranch ) %] + [% result.location | html %] [% IF ( result.itemcallnumber ) %][[% result.itemcallnumber | html %]][% ELSE %][% END %] -

[% result.title | html %]

[% result.author | html %]

+

[% result.title | html %]

[% result.author | html %]

[% result.notforloan | html %] -- 2.0.0.rc2