Bugzilla – Attachment 107451 Details for
Bug 25314
Make OPAC facets collapse
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25314: Add system pref to control expanding/collapsing facets
Bug-25314-Add-system-pref-to-control-expandingcoll.patch (text/plain), 5.18 KB, created by
Lucas Gass (lukeg)
on 2020-07-28 01:40:21 UTC
(
hide
)
Description:
Bug 25314: Add system pref to control expanding/collapsing facets
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2020-07-28 01:40:21 UTC
Size:
5.18 KB
patch
obsolete
>From dff5355aa8f7f7ed955fe87bde7cce196064488b Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Tue, 28 Jul 2020 01:34:45 +0000 >Subject: [PATCH] Bug 25314: Add system pref to control expanding/collapsing > facets > >TO TEST: >1. Apply patch >2. Regenerate CSS (yarn build --view opac), updatedatabase and restart_all >3. DO a search and look at the facets. They should be collapsed. >4. Try mousing over a facet heading and click, that list should appear. >5. Try clicking the heading again to make th facet disappear. >6. Play around with different limiters and make sure eveything works. >7. Check aria labels look correct and you can tab through facets without a keyboard. >8. Find the system pref OPACFacetsCollapseByDefault in OPAC > Features >9. Try toggling different facets and make sure they all expland/collapse correctly >--- > installer/data/mysql/sysprefs.sql | 1 + > .../prog/en/modules/admin/preferences/opac.pref | 16 ++++++++++++++++ > .../opac-tmpl/bootstrap/en/includes/opac-facets.inc | 1 - > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt | 14 ++++++++++++-- > 4 files changed, 29 insertions(+), 3 deletions(-) > >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index dbb13938ae..8d86001776 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -320,6 +320,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('maxItemsInSearchResults','20',NULL,'Specify the maximum number of items to display for each result on a page of results','free'), > ('MaxOpenSuggestions','',NULL,'Limit the number of open suggestions a patron can have at once','Integer'), > ('maxoutstanding','5','','maximum amount withstanding to be able make holds','Integer'), >+('OPACFacetsCollapseByDefault','0','','Collapse/expand OPAC facets','YesNo'), > ('OPACFineNoRenewalsBlockAutoRenew','0','','Block/Allow auto renewals if the patron owe more than OPACFineNoRenewals','YesNo'), > ('maxRecordsForFacets','20',NULL,NULL,'Integer'), > ('maxreserves','50','','Define maximum number of holds a patron can place','Integer'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index 6f6e5499ef..e9cbccf74a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -402,6 +402,22 @@ OPAC: > no: "Don't enable" > - the option to show a QR Code on the OPAC bibliographic detail page. > - >+ - "Define OPAC facets that should collapse by default" >+ - pref: OPACFacetsCollapseByDefault >+ multiple: >+ authors: Authors >+ collections: Collections >+ holding-libraries: Holding libraries >+ home-libraries: Home libraries >+ itemtypes: Itemtypes >+ languages: Languages >+ location: Locations >+ series: Series >+ places: Places >+ topics: Topics >+ titles: Titles >+ - "<br />Note: if none of the above options are selected all facets will expand by default" >+ - > - pref: OPACFinesTab > choices: > yes: Allow >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 8fbda54c14..73bf7d5989 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc >@@ -17,7 +17,6 @@ > </ul> > [% IF ( related ) %] <li>(related searches: [% FOREACH relate IN related %][% relate.related_search | html %][% END %])</li>[% END %] > </li> >- > [% FOREACH facets_loo IN facets_loop %] > [% IF facets_loo.facets.size > 0 %] > <li id="[% facets_loo.type_id | html %]"> >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 1f47cff622..a7d1d03fa0 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >@@ -1016,12 +1016,22 @@ $("input.newtag").on('keydown', function(e){ > }); > > }); >-$('.toggle-facet').click( function() { >+ >+[% IF ( Koha.Preference('OPACFacetsCollapseByDefault') ) %] >+[% SET OPACFacetsCollapsed = Koha.Preference('OPACFacetsCollapseByDefault') %] >+ var OPACFacetsToCollapse = "[% OPACFacetsCollapsed %]"; >+ var OPACFacetsToCollapeArray = OPACFacetsToCollapse.split(","); >+ OPACFacetsToCollapeArray.forEach(function(arr){ >+ $('#facet-'+arr).siblings('.collapsible-list').toggle(); >+ $('#facet-'+arr).toggleClass('facets-list-expanded'); >+ }) >+[% END %] >+$('.toggle-facet').click( function(){ > $(this).siblings('.collapsible-list').toggle(); > $(this).toggleClass('facet-list-expanded'); > $(this).attr('aria-expanded' , function(index, attr) { > return attr == 'true' ? false : true; > }) >-}) >+}); > </script> > [% END %] >-- >2.11.0
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 25314
:
103957
|
103958
|
103997
|
107447
|
107448
|
107450
|
107451
|
107452