Bug 17209: Remove use of onclick from masthead
authorAleisha Amohia <aleishaamohia@hotmail.com>
Mon, 29 Aug 2016 04:47:36 +0000 (04:47 +0000)
committerKyle M Hall <kyle@bywatersolutions.com>
Wed, 28 Dec 2016 13:47:15 +0000 (13:47 +0000)
There are two instances which use onclick in the OPAC masthead: clearing
search history, and logging out.

To test:
Confirm that clearing search history using the 'x' in the masthead, and
logging out by clicking 'Log out' in the masthead, work the same before
and after the patch.

Sponsored-by: Catalyst IT
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marc VĂ©ron <veron@veron.ch>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc
koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc

index fdce32c..a778aa9 100644 (file)
                                     [% END %]
                                 [% END %]
                                 [% IF EnableOpacSearchHistory %]
-                                    <li><p class="navbar-text"><a href="/cgi-bin/koha/opac-search-history.pl" title="View your search history">Search history</a> [<a class="logout" href="/cgi-bin/koha/opac-search-history.pl?action=delete" title="Delete your search history" onclick="return confirm(MSG_DELETE_SEARCH_HISTORY);">x</a>]</p></li>
+                                    <li><p class="navbar-text"><a href="/cgi-bin/koha/opac-search-history.pl" title="View your search history">Search history</a> [<a class="logout clearsh" href="/cgi-bin/koha/opac-search-history.pl?action=delete" title="Delete your search history">x</a>]</p></li>
                                     <li class="divider-vertical"></li>
                                 [% END %]
                                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
                                     [% IF ( loggedinusername ) %]
                                         <li><p class="navbar-text">
                                             [% IF persona %]
-                                                <a class="logout" id="logout" href="/cgi-bin/koha/opac-main.pl?logout.x=1" onclick='navigator.id.logout();'>
+                                                <a class="logout" id="logout" href="/cgi-bin/koha/opac-main.pl?logout.x=1">
                                             [% ELSE %]
                                                 <a class="logout" id="logout" href="/cgi-bin/koha/opac-main.pl?logout.x=1">
                                             [% END %]
index 1a13370..497f2f3 100644 (file)
@@ -149,7 +149,6 @@ $.widget.bridge('uitooltip', $.ui.tooltip);
             verify_images();
          });
     [% END %]
-
     $(".print-large").on("click",function(){
         window.print();
         return false;
@@ -166,6 +165,9 @@ $.widget.bridge('uitooltip', $.ui.tooltip);
         delSingleRecord('[% biblionumber %]');
         return false;
     });
+    $(".clearsh").on("click", function(){
+        return confirmDelete(MSG_DELETE_SEARCH_HISTORY);
+    });
     //]]>
 </script>
 
@@ -251,6 +253,10 @@ $.widget.bridge('uitooltip', $.ui.tooltip);
         }
     });
 
+    $(".logout").on("click",function(){
+        navigator.id.logout();
+    });
+
     var signinLink = document.getElementById('browserid');
 
     if (signinLink) {