Koha/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-box.inc
Owen Leonard ef0cf7b9a6 Bug 7747 - Replace YUI autocomplete with jQueryUI
In order to facilitate a more painless process for converting
to jQueryUI I will submit separate patches for various "widgets,"
starting with Autocomplete.

This patch replaces all instances of YUI autocomplete with
a jQueryUI version. The patch includes an up-to-date version
of jQuery and jQueryUI libraries.

The patch also moves some markup in instances where it should
have been removed in favor of a different include.

To test, find the various autocomplete instances and confirm
that they are working:

 - Circulation search header autocomplete
 - Overdues patron attribute authorized value filter (must
   have patron attributes enabled, and a patron attribute
   defined which uses authorized values.
 - Authorities search plugin. Edit a MARC record and use
   an authorities plugin link to do a search for authority
   records.

Incomplete: There is a YUI autocomplete instance in a UNIMARC
plugin (unimarc_field_210c_bis.tt) which I couldn't figure out
how to test, even on a sandbox set up with UNIMARC. I could use
help with a follow-up.

http://bugs.koha-community.org/show_bug.cgi?id=7447
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Passes all tests outlined, is quite pretty.

Passes t xt

Signed-off-by: Ian Walls <koha.sekjal@gmail.com>
2012-05-31 18:07:55 +02:00

50 lines
2.3 KiB
HTML

[% IF ( CAN_user_circulate ) %][% IF ( CircAutocompl ) %]<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
$( "#findborrower" ).autocomplete({
source: "/cgi-bin/koha/circ/ysearch.pl",
minLength: 3,
select: function( event, ui ) {
$( "#findborrower" ).val( ui.item.cardnumber );
$("#patronsearch").submit();
return false;
}
})
.data( "autocomplete" )._renderItem = function( ul, item ) {
return $( "<li></li>" )
.data( "item.autocomplete", item )
.append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" )
.appendTo( ul );
};
});
//]]>
</script>[% END %]
<div id="circ_search" class="residentsearch">
<p class="tip">Enter patron card number or partial name:</p>
<form action="/cgi-bin/koha/circ/circulation.pl" id="patronsearch" method="post">
[% IF ( CircAutocompl ) %]
<div class="autocomplete">
<div id="borrowerautocomplete" class="autocomplete">
<input autocomplete="off" id="findborrower" name="findborrower" size="40" class="focus" type="text" /> <input id="autocsubmit" type="submit" class="submit" value="Submit" />
<input name="branch" value="[% branch %]" type="hidden" />
<input name="printer" value="" type="hidden" />
[% IF ( stickyduedate ) %]
<input type="hidden" name="duedatespec" value="[% duedatespec %]" />
<input type="hidden" name="stickyduedate" value="[% stickyduedate %]" />
[% END %]
</div>
</div>
[% ELSE %]
<input id="findborrower" name="findborrower" size="40" class="focus" type="text" />
<input name="branch" value="[% branch %]" type="hidden" />
<input name="printer" value="" type="hidden" />
[% IF ( stickyduedate ) %]
<input type="hidden" name="duedatespec" value="[% duedatespec %]" />
<input type="hidden" name="stickyduedate" value="[% stickyduedate %]" />
[% END %]
<input value="Submit" class="submit" type="submit" />
[% END %]
</form>
</div>
[% END %]