Bug 11753 - Replace jQuery qTip plugin with Bootstrap tooltip on patron search form
authorOwen Leonard <oleonard@myacpl.org>
Wed, 12 Feb 2014 17:19:02 +0000 (12:19 -0500)
committerGalen Charlton <gmc@esilibrary.com>
Tue, 18 Feb 2014 21:08:43 +0000 (21:08 +0000)
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.

Revision: Removed inclusion of qTip plugin from global header include.
The other instance of qTip usage occurs on a page which loads the plugin
separately.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc
koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc

index e702aa5..11f6f38 100644 (file)
@@ -13,7 +13,6 @@
 <script type="text/javascript" src="[% interface %]/lib/shortcut/shortcut.js"></script>
 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.cookie.min.js"></script>
 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.highlight-3.js"></script>
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.qtip.js"></script>
 <script type="text/javascript" src="[% interface %]/lib/bootstrap/bootstrap.min.js"></script>
 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.validate.min.js"></script>
 
index ac581ee..bccd39c 100644 (file)
@@ -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>
 
                 $("#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>