Bug 6419: (follow-up) Use Select2 with optgroups

This patch divides the OPAC and staff options into separate optgroups
and adds Select2 for styling and filtering.

THe patch also corrects a few missed instances of "Intranet" in the list
of location options on the entry form.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Owen Leonard 2023-08-16 08:20:35 +00:00 committed by Tomas Cohen Arazi
parent d617fa4d81
commit f596a47417
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 21 additions and 8 deletions

View File

@ -523,19 +523,32 @@
[% END %]
[% END %]
[% ELSE %]
[% SET available_options = [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches', 'OpacMySummaryNote', 'OpacLibraryInfo', 'CatalogConcernHelp', 'CatalogConcernTemplate', 'CookieConsentBar', 'CookieConsentPopup', 'StaffAcquisitionsHome', 'StaffAuthoritiesHome', 'StaffCataloguingHome', 'StaffListsHome', 'StaffPatronsHome', 'StaffPOSHome', 'StaffSerialsHome' ] %]
[% FOREACH l IN available_options.sort %]
[% IF l == location %]
<option value="[% l | html %]" selected="selected">[% l | html %]</option>
[% ELSE %]
<option value="[% l | html %]">[% l | html %]</option>
[% SET opac_available_options = [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches', 'OpacMySummaryNote', 'OpacLibraryInfo', ] %]
<optgroup label="OPAC">
[% FOREACH l IN opac_available_options.sort %]
[% IF l == location %]
<option value="[% l | html %]" selected="selected">[% l | html %]</option>
[% ELSE %]
<option value="[% l | html %]">[% l | html %]</option>
[% END %]
[% END %]
[% END %]
</optgroup>
[% SET staff_available_options = [ 'CatalogConcernHelp', 'CatalogConcernTemplate', 'CookieConsentBar', 'CookieConsentPopup', 'StaffAcquisitionsHome', 'StaffAuthoritiesHome', 'StaffCataloguingHome', 'StaffListsHome', 'StaffPatronsHome', 'StaffPOSHome', 'StaffSerialsHome' ] %]
<optgroup label="Staff">
[% FOREACH l IN staff_available_options.sort %]
[% IF l == location %]
<option value="[% l | html %]" selected="selected">[% l | html %]</option>
[% ELSE %]
<option value="[% l | html %]">[% l | html %]</option>
[% END %]
[% END %]
</optgroup>
[% END %]
[% END %]
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'calendar.inc' %]
[% INCLUDE 'select2.inc' %]
[% Asset.js("js/tools-menu.js") | $raw %]
[% Asset.js("lib/hc-sticky.js") | $raw %]
<script>
@ -694,7 +707,7 @@
stickTo: ".main",
stickyClass: "floating"
});
$("#location").select2({ width: '50%' });
});
</script>
[% END %]