Bugzilla – Attachment 76215 Details for
Bug 20931
JS error "ReferenceError: $ is not defined" when CircSidebar is turned on
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20931: JS error "ReferenceError: $ is not defined" when CircSidebar is turned on
Bug-20931-JS-error-ReferenceError--is-not-defined-.patch (text/plain), 9.32 KB, created by
Owen Leonard
on 2018-06-20 17:33:05 UTC
(
hide
)
Description:
Bug 20931: JS error "ReferenceError: $ is not defined" when CircSidebar is turned on
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2018-06-20 17:33:05 UTC
Size:
9.32 KB
patch
obsolete
>From fb3e9f8fa046b0ba7c92554da0eef90d1a48a2dd Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 20 Jun 2018 17:16:16 +0000 >Subject: [PATCH] Bug 20931: JS error "ReferenceError: $ is not defined" when > CircSidebar is turned on > >This patch reorganizes the way sidebar menus get highlighted based on >the current page. A global function is added to handle most cases. >Individual menu-handling scripts have been modified to handle only the >edge cases which aren't covered by the global one. > >A new class is added to the global CSS file so that highlighted menu >links can be custom-styled. > >To test, apply the patch and clear your cache if necessary. > >View various pages to confirm that current-page-highlighting in the >sidebar menu is working correctly and that there are no JS errors in the >browser console. For example: > > - Administration -> Currencies and exchange rates. > - Acquisitions -> Invoices > - Tools -> Patron lists > - Tools -> Export > >And with CircSidebar turned on test various circulation pages, e.g. > > - Circulation -> Set library >--- > koha-tmpl/intranet-tmpl/prog/css/staff-global.css | 6 +++++- > koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc | 13 ------------- > koha-tmpl/intranet-tmpl/prog/js/acq.js | 5 ----- > koha-tmpl/intranet-tmpl/prog/js/acquisitions-menu.js | 4 +--- > koha-tmpl/intranet-tmpl/prog/js/admin-menu.js | 12 +++++------- > koha-tmpl/intranet-tmpl/prog/js/staff-global.js | 12 ++++++++++++ > koha-tmpl/intranet-tmpl/prog/js/tools-menu.js | 18 ++++++++---------- > 7 files changed, 31 insertions(+), 39 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/css/staff-global.css >index c68bff6..db075c0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/css/staff-global.css >+++ b/koha-tmpl/intranet-tmpl/prog/css/staff-global.css >@@ -163,7 +163,11 @@ label input[type="radio"], > } > > #navmenulist li a { >- text-decoration : none; >+ text-decoration : none; >+} >+ >+#navmenulist li a.current { >+ font-weight: bold; > } > > #doc, #doc1, #doc2, #doc3 { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc >index 844926c..b6dc7fb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc >@@ -1,17 +1,4 @@ > [% USE Branches %] >-<script type="text/javascript">//<![CDATA[ >- $(document).ready(function() { >- var path = location.pathname.substring(1); >- var url = window.location.toString(); >- var params = ''; >- if ( url.match(/\?(.+)$/) ) { >- params = "?" + RegExp.$1; >- } >- $('#navmenulist a[href$="/' + path + params + '"]').css('font-weight','bold'); >- }); >-//]]> >-</script> >- > <div id="navmenu"> > <div id="navmenulist"> > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/acq.js b/koha-tmpl/intranet-tmpl/prog/js/acq.js >index 63575b3..9d3983c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/acq.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/acq.js >@@ -374,8 +374,3 @@ function hideAllColumns(){ > $("#plan td:nth-child(2),#plan th:nth-child(2)").nextUntil("th:nth-child("+(allCols-1)+"),td:nth-child("+(allCols-1)+")").hide(); // hide all but the last two columns > $("#hideall").prop("checked", true).parent().addClass("selected"); > } >- >-$(document).ready(function() { >- var path = location.pathname.substring(1); >- $('#navmenulist a[href$="/' + path + '"]').css('font-weight','bold'); >-}); >diff --git a/koha-tmpl/intranet-tmpl/prog/js/acquisitions-menu.js b/koha-tmpl/intranet-tmpl/prog/js/acquisitions-menu.js >index 08bcc85..30c0567 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/acquisitions-menu.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/acquisitions-menu.js >@@ -1,8 +1,6 @@ > $(document).ready(function() { > var path = location.pathname.substring(1); > if (path.indexOf("invoice") >= 0) { >- $('#navmenulist a[href$="/cgi-bin/koha/acqui/invoices.pl"]').css('font-weight','bold'); >- } else { >- $('#navmenulist a[href$="/' + path + '"]').css('font-weight','bold'); >+ $('#navmenulist a[href$="/cgi-bin/koha/acqui/invoices.pl"]').addClass("current"); > } > }); >diff --git a/koha-tmpl/intranet-tmpl/prog/js/admin-menu.js b/koha-tmpl/intranet-tmpl/prog/js/admin-menu.js >index d0557fe..f7b69c7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/admin-menu.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/admin-menu.js >@@ -1,16 +1,14 @@ > $(document).ready(function() { > var path = location.pathname.substring(1); > if (path == "cgi-bin/koha/admin/marctagstructure.pl" || path == "cgi-bin/koha/admin/marc_subfields_structure.pl") { >- $('#navmenulist a[href$="/cgi-bin/koha/admin/biblio_framework.pl"]').css('font-weight','bold'); >+ $('#navmenulist a[href$="/cgi-bin/koha/admin/biblio_framework.pl"]').addClass("current"); > } else if (path == "cgi-bin/koha/admin/auth_tag_structure.pl" || path == "cgi-bin/koha/admin/auth_subfields_structure.pl") { >- $('#navmenulist a[href$="/cgi-bin/koha/admin/authtypes.pl"]').css('font-weight','bold'); >+ $('#navmenulist a[href$="/cgi-bin/koha/admin/authtypes.pl"]').addClass("current"); > } else if (path == "cgi-bin/koha/admin/oai_set_mappings.pl") { >- $('#navmenulist a[href$="/cgi-bin/koha/admin/oai_sets.pl"]').css('font-weight','bold'); >+ $('#navmenulist a[href$="/cgi-bin/koha/admin/oai_sets.pl"]').addClass("current"); > } else if (path == "cgi-bin/koha/admin/items_search_field.pl") { >- $('#navmenulist a[href$="/cgi-bin/koha/admin/items_search_fields.pl"]').css('font-weight','bold'); >+ $('#navmenulist a[href$="/cgi-bin/koha/admin/items_search_fields.pl"]').addClass("current"); > } else if (path == "cgi-bin/koha/admin/clone-rules.pl") { >- $('#navmenulist a[href$="/cgi-bin/koha/admin/smart-rules.pl"]').css('font-weight','bold'); >- } else { >- $('#navmenulist a[href$="/' + path + '"]').css('font-weight','bold'); >+ $('#navmenulist a[href$="/cgi-bin/koha/admin/smart-rules.pl"]').addClass("current"); > } > }); >diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js >index cd586da..db5539a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js >@@ -62,6 +62,18 @@ $.fn.selectTabByID = function (tabID) { > e.preventDefault(); > $( $(this).data("element") ).toggle(); > }); >+ >+ var navmenulist = $("#navmenulist"); >+ if( navmenulist.length > 0 ){ >+ var path = location.pathname.substring(1); >+ var url = window.location.toString(); >+ var params = ''; >+ if ( url.match(/\?(.+)$/) ) { >+ params = "?" + RegExp.$1; >+ } >+ $("a[href$=\"/" + path + params + "\"]", navmenulist).addClass("current"); >+ } >+ > }); > > // http://jennifermadden.com/javascript/stringEnterKeyDetector.html >diff --git a/koha-tmpl/intranet-tmpl/prog/js/tools-menu.js b/koha-tmpl/intranet-tmpl/prog/js/tools-menu.js >index 9751f76..4b6e4a0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/tools-menu.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/tools-menu.js >@@ -1,22 +1,20 @@ > $(document).ready(function() { > var path = location.pathname.substring(1); > if (path.indexOf("labels") >= 0 && path.indexOf("spine") < 0 ) { >- $('#navmenulist a[href$="/cgi-bin/koha/labels/label-home.pl"]').css('font-weight','bold'); >+ $('#navmenulist a[href$="/cgi-bin/koha/labels/label-home.pl"]').addClass("current"); > } else if (path.indexOf("patroncards") >= 0 ) { >- $('#navmenulist a[href$="/cgi-bin/koha/patroncards/home.pl"]').css('font-weight','bold'); >+ $('#navmenulist a[href$="/cgi-bin/koha/patroncards/home.pl"]').addClass("current"); > } else if (path.indexOf("clubs") >= 0 ) { >- $('#navmenulist a[href$="/cgi-bin/koha/clubs/clubs.pl"]').css('font-weight','bold'); >+ $('#navmenulist a[href$="/cgi-bin/koha/clubs/clubs.pl"]').addClass("current"); > } else if (path.indexOf("patron_lists") >= 0 ) { >- $('#navmenulist a[href$="/cgi-bin/koha/patron_lists/lists.pl"]').css('font-weight','bold'); >+ $('#navmenulist a[href$="/cgi-bin/koha/patron_lists/lists.pl"]').addClass("current"); > } else if (path.indexOf("rotating_collections") >= 0 ){ >- $('#navmenulist a[href$="/cgi-bin/koha/rotating_collections/rotatingCollections.pl"]').css('font-weight','bold'); >+ $('#navmenulist a[href$="/cgi-bin/koha/rotating_collections/rotatingCollections.pl"]').addClass("current"); > } else if ((path+location.search).indexOf("batchMod.pl?del=1") >= 0 ) { >- $('#navmenulist a[href$="/cgi-bin/koha/tools/batchMod.pl?del=1"]').css('font-weight','bold'); >+ $('#navmenulist a[href$="/cgi-bin/koha/tools/batchMod.pl?del=1"]').addClass("current"); > } else if (path.indexOf("quotes-upload.pl") >= 0 ){ >- $('#navmenulist a[href$="/cgi-bin/koha/tools/quotes.pl"]').css('font-weight','bold'); >+ $('#navmenulist a[href$="/cgi-bin/koha/tools/quotes.pl"]').addClass("current"); > } else if (path.indexOf("plugins") >= 0 ) { >- $('#navmenulist a[href$="/cgi-bin/koha/plugins/plugins-home.pl?method=tool"]').css('font-weight','bold'); >- } else { >- $('#navmenulist a[href$="/' + path + '"]').css('font-weight','bold'); >+ $('#navmenulist a[href$="/cgi-bin/koha/plugins/plugins-home.pl?method=tool"]').addClass("current"); > } > }); >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20931
:
76215
|
76312
|
76416