[Koha-patches] [PATCH] Bug 11753 - Replace jQuery qTip plugin with Bootstrap tooltip on patron search form

Owen Leonard oleonard at myacpl.org
Wed Feb 12 18:24:36 CET 2014


The qTip plugin is out of date and incompatible with recent versions of
jQuery. This patch replaces use of qTip on the patron search form with a
Bootstrap tooltip implementation.

To test, apply the patch and view /cgi-bin/koha/members/members-home.pl

- Expand the patron search form by clicking the [+]
- Change 'search fields' from 'Standard' to 'Date of birth'
- A tooltip should appear giving details about the date format required
- Change the 'search fields' to something else. The tooltip should not
  appear.
---
 .../prog/en/includes/patron-search.inc             |   20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc
index ac581ee..c490522 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc
@@ -5,7 +5,7 @@
 	<div id="patron_search" class="residentsearch">
 	<p class="tip">Enter patron card number or partial name:</p>
 	<form action="/cgi-bin/koha/members/member.pl" method="post">
-    <input id="searchmember" size="25" class="focus" name="member" type="text" value="[% member %]"/>
+    <input id="searchmember" data-toggle="tooltip" size="25" class="focus" name="member" type="text" value="[% member %]"/>
 	<span class="filteraction" id="filteraction_off"> <a href="#" onclick="$('#filters').toggle();$('.filteraction').toggle();">[-]</a></span>
 	<span class="filteraction" id="filteraction_on"> <a href="#" onclick="$('#filters').toggle();$('.filteraction').toggle();">[+]</a></span>
 
@@ -22,27 +22,21 @@
                 <option value='dateofbirth'>Date of birth</option>
                 <option value='sort1'>Sort field 1</option>
                 <option value='sort2'>Sort field 2</option>
-            </select>
+            </select> 
             <script type="text/javascript">
                 [% SET dateformat = Koha.Preference('dateformat') %]
                 $("#searchfields").change(function() {
                     if ( $(this).val() == 'dateofbirth' ) {
                         [% IF dateformat == 'us' %]
-                            [% SET format = 'MM/DD/YYYY' %]
+                            var MSG_DATE_FORMAT = _("Dates of birth should be entered in the format 'MM/DD/YYYY'");
                         [% ELSIF dateformat == 'iso' %]
-                            [% SET format = 'YYYY-MM-DD' %]
+                            var MSG_DATE_FORMAT = _("Dates of birth should be entered in the format 'YYYY-MM-DD'");
                         [% ELSIF dateformat == 'metric' %]
-                            [% SET format = 'DD/MM/YYYY' %]
+                            var MSG_DATE_FORMAT = _("Dates of birth should be entered in the format 'DD/MM/YYYY'");
                         [% END %]
-
-                        $('#searchmember').qtip({
-                            content: 'Dates of birth should be entered in the format "[% format %]"',
-                            style: {
-                                tip: 'topLeft'
-                            }
-                        })
+                        $('#searchmember').attr("title",MSG_DATE_FORMAT).tooltip('show');
                     } else {
-                        $('#searchmember').qtip('destroy');
+                        $('#searchmember').tooltip('destroy');
                     }
                 });
             </script>
-- 
1.7.9.5


More information about the Koha-patches mailing list