diff --git a/koha-tmpl/opac-tmpl/bootstrap/css/src/_responsive.scss b/koha-tmpl/opac-tmpl/bootstrap/css/src/_responsive.scss index ad2013e717..0e5f462fbf 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/css/src/_responsive.scss +++ b/koha-tmpl/opac-tmpl/bootstrap/css/src/_responsive.scss @@ -381,39 +381,6 @@ display: none; } - #search-facets { - margin-bottom: .5em; - - h4 { - display: block; - margin: 0; - padding: 0; - - a { - border-bottom: 0; - font-weight: normal; - padding: .7em .2em; - } - } - - li { - padding: .4em; - } - - h5 { - margin: .2em; - } - - ul { - padding: 0; - } - } - - #menu h4 a.menu-open, - #search-facets h4 a.menu-open { - border-bottom: 1px solid #D8D8D8; - } - #wrapper { padding: 0; } @@ -443,6 +410,55 @@ } } +@media only screen and ( max-width: 991px ) { + #search-facets { + margin-bottom: .5em; + + h2 { + display: block; + margin: 0; + padding: 0; + + a { + border-bottom: 0; + font-weight: normal; + padding: .7em .2em; + + &::before { + content: "\f0da"; + display: inline-block; + font-family: FontAwesome; + width: 1em; + } + } + } + + li { + padding: .4em; + } + + h3 { + margin: .2em; + } + + ul { + padding: 0; + } + } + + #menu h2 a.menu-open, + #search-facets h2 a.menu-open { + border-bottom: 1px solid #D8D8D8; + + &::before { + content: "\f0d7"; + display: inline-block; + font-family: FontAwesome; + width: 1em; + } + } +} + @media only screen and ( min-width: 992px ) { /* Screens above 768 pixels wide */ #menu { diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt index b2d144d8d6..2e91a04d45 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt @@ -102,18 +102,10 @@ [% END %] - [% IF ( total ) %] - [% IF ( opacfacets ) %] -
- [% ELSE %] -
- [% END %] + [% IF ( opacfacets ) %] +
[% ELSE %] - [% IF ( opacfacets ) %] -
- [% ELSE %] -
- [% END %] +
[% END %] [% IF ( searchdesc ) %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/global.js b/koha-tmpl/opac-tmpl/bootstrap/js/global.js index 27f2874502..17d2447abb 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/global.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/global.js @@ -151,13 +151,79 @@ function confirmModal(message, title, yes_label, no_label, callback) { }); })(jQuery); -$("#scrolltocontent").click(function() { - var content = $(".maincontent"); - if (content.length > 0) { - $('html,body').animate({ - scrollTop: content.first().offset().top - }, - 'slow'); - content.first().find(':focusable').eq(0).focus(); +enquire.register("screen and (max-width:608px)", { + match : function() { + if($("body.scrollto").length > 0){ + window.scrollTo( 0, $(".maincontent").offset().top ); + } } }); + +enquire.register("screen and (min-width:992px)", { + match : function() { + facetMenu( "show" ); + }, + unmatch : function() { + facetMenu( "hide" ); + } +}); + +function facetMenu( action ){ + if( action == "show" ){ + $(".menu-collapse-toggle").off("click", facetHandler ); + $(".menu-collapse").show(); + } else { + $(".menu-collapse-toggle").on("click", facetHandler ).removeClass("menu-open"); + $(".menu-collapse").hide(); + } +} + +var facetHandler = function(e){ + e.preventDefault(); + $(this).toggleClass("menu-open"); + $(".menu-collapse").toggle(); +}; + +$(document).ready(function(){ + $("html").removeClass("no-js").addClass("js"); + $(".close").click(function(){ + window.close(); + }); + $(".focus").focus(); + $(".js-show").show(); + $(".js-hide").hide(); + + if( $(window).width() < 991 ){ + facetMenu("hide"); + } + + // clear the basket when user logs out + $("#logout").click(function(){ + var nameCookie = "bib_list"; + var valCookie = readCookie(nameCookie); + if (valCookie) { // basket has contents + updateBasket(0,null); + delCookie(nameCookie); + return true; + } else { + return true; + } + }); + + $(".loginModal-trigger").on("click",function(e){ + e.preventDefault(); + $("#loginModal").modal("show"); + }); + $("#loginModal").on("shown.bs.modal", function(){ + $("#muserid").focus(); + }); + + $("#scrolltocontent").click(function() { + var content = $(".maincontent"); + if (content.length > 0) { + $('html,body').animate({ scrollTop: content.first().offset().top }, + 'slow'); + content.first().find(':focusable').eq(0).focus(); + } + }); +});