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 Signed-off-by: Charles Farmer <charles.farmer@inLibro.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
parent
3e3cf93bff
commit
0254b4e87d
7 changed files with 31 additions and 39 deletions
|
@ -163,7 +163,11 @@ label input[type="radio"],
|
||||||
}
|
}
|
||||||
|
|
||||||
#navmenulist li a {
|
#navmenulist li a {
|
||||||
text-decoration : none;
|
text-decoration : none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#navmenulist li a.current {
|
||||||
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
#doc, #doc1, #doc2, #doc3 {
|
#doc, #doc1, #doc2, #doc3 {
|
||||||
|
|
|
@ -1,17 +1,4 @@
|
||||||
[% USE Branches %]
|
[% 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="navmenu">
|
||||||
<div id="navmenulist">
|
<div id="navmenulist">
|
||||||
|
|
||||||
|
|
|
@ -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
|
$("#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");
|
$("#hideall").prop("checked", true).parent().addClass("selected");
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
|
||||||
var path = location.pathname.substring(1);
|
|
||||||
$('#navmenulist a[href$="/' + path + '"]').css('font-weight','bold');
|
|
||||||
});
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var path = location.pathname.substring(1);
|
var path = location.pathname.substring(1);
|
||||||
if (path.indexOf("invoice") >= 0) {
|
if (path.indexOf("invoice") >= 0) {
|
||||||
$('#navmenulist a[href$="/cgi-bin/koha/acqui/invoices.pl"]').css('font-weight','bold');
|
$('#navmenulist a[href$="/cgi-bin/koha/acqui/invoices.pl"]').addClass("current");
|
||||||
} else {
|
|
||||||
$('#navmenulist a[href$="/' + path + '"]').css('font-weight','bold');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var path = location.pathname.substring(1);
|
var path = location.pathname.substring(1);
|
||||||
if (path == "cgi-bin/koha/admin/marctagstructure.pl" || path == "cgi-bin/koha/admin/marc_subfields_structure.pl") {
|
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") {
|
} 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") {
|
} 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") {
|
} 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") {
|
} else if (path == "cgi-bin/koha/admin/clone-rules.pl") {
|
||||||
$('#navmenulist a[href$="/cgi-bin/koha/admin/smart-rules.pl"]').css('font-weight','bold');
|
$('#navmenulist a[href$="/cgi-bin/koha/admin/smart-rules.pl"]').addClass("current");
|
||||||
} else {
|
|
||||||
$('#navmenulist a[href$="/' + path + '"]').css('font-weight','bold');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -62,6 +62,18 @@ $.fn.selectTabByID = function (tabID) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$( $(this).data("element") ).toggle();
|
$( $(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
|
// http://jennifermadden.com/javascript/stringEnterKeyDetector.html
|
||||||
|
|
|
@ -1,22 +1,20 @@
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var path = location.pathname.substring(1);
|
var path = location.pathname.substring(1);
|
||||||
if (path.indexOf("labels") >= 0 && path.indexOf("spine") < 0 ) {
|
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 ) {
|
} 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 ) {
|
} 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 ) {
|
} 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 ){
|
} 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 ) {
|
} 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 ){
|
} 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 ) {
|
} else if (path.indexOf("plugins") >= 0 ) {
|
||||||
$('#navmenulist a[href$="/cgi-bin/koha/plugins/plugins-home.pl?method=tool"]').css('font-weight','bold');
|
$('#navmenulist a[href$="/cgi-bin/koha/plugins/plugins-home.pl?method=tool"]').addClass("current");
|
||||||
} else {
|
|
||||||
$('#navmenulist a[href$="/' + path + '"]').css('font-weight','bold');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue