From f01a8cc5a831b48ff4185d87c012401f7d0e103f Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 18 Jun 2015 18:05:42 -0400 Subject: [PATCH] Bug 14419 - Expanding facets (Show more) performs a new search This is a proof of concept patch, it is for discussion/demonstration and only affects the OPAC. To test: 1 - Perform an OPAC search that returns more than 5 of any given facet type 2 - Click the "Show more" link on the facets and see that the search is reloaded 3 - Apply patch 4 - Repeat search 5 - Note that you can click "Show more" without reloading page 6 - Test that page load is not greatly affected 7 - Ensure that all facet links function normally 8 - Ensure that facets are the same a prior to patch 9 - Tell me to make this a valid patch or do so yourself :-) --- C4/Search.pm | 2 +- .../opac-tmpl/bootstrap/en/includes/opac-facets.inc | 15 +++++++++------ .../opac-tmpl/bootstrap/en/modules/opac-results.tt | 7 +++++++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 990ed39..d632ca3 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -525,7 +525,7 @@ sub getRecords { $number_of_facets++; if ( ( $number_of_facets <= 5 ) || ( $expanded_facet eq $link_value ) - || ( $facets_info->{$link_value}->{'expanded'} ) + || ( $facets_info->{$link_value}->{'expanded'} ) || 1 ) { diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc index 958d571..f05ec04 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc @@ -30,8 +30,12 @@ [% END %] [% IF facets_loo.type_label_Location %]
Locations
[% END %] [% END # / IF facets_loo.facets.size > 0 %] 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 d905f13..cb65e28 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt @@ -691,13 +691,20 @@ function highlightOn() { $(".highlight_toggle").toggle(); } [% END %] + $(document).ready(function(){ + [% IF ( OpacHighlightedWords ) %] $('a.title').each(function() { $(this).attr("href", $(this).attr("href") + "&query_desc=[% query_desc | uri %]"); }); [% END %] +$(".showmore").click(function(){ + $(this).siblings(".collapsible-facet").toggle(); +}); + + $(".cb").click(function(){ enableCheckboxActions(); }); -- 1.7.10.4