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 <ian@catalyst.net.nz>

Tested in Firefox and Chromium.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Owen Leonard 2014-07-14 09:05:05 -04:00 committed by Tomas Cohen Arazi
parent e86387eee2
commit 564018291e

View file

@ -1,4 +1,5 @@
[% USE KohaDates %]
[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Tools &rsaquo; Inventory</title>
[% 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;
});
});
});
//]]>
</script>
</head>
@ -249,10 +257,11 @@ $(document).ready(function(){
[% result.barcode | html %]
</td>
<td>
[% result.homebranch | html %] [% result.location | html %] [[% result.itemcallnumber | html %]]
[% Branches.GetName( result.homebranch ) %]
[% result.location | html %] [% IF ( result.itemcallnumber ) %][[% result.itemcallnumber | html %]][% ELSE %][% END %]
</td>
<td>
<p><a href="#" onclick="window.open('/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=[% result.biblionumber %]','marcview','width=800,height=600,toolbar=0,scrollbars=1');">[% result.title | html %]</a></p><p>[% result.author | html %]</p>
<p><a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=[% result.biblionumber %]" class="openWin">[% result.title | html %]</a></p><p>[% result.author | html %]</p>
</td>
<td>
[% result.notforloan | html %]