Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions app/assets/javascripts/oregon_digital/facets/facets_button.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,15 @@ $(function () {

// STRIP: Strip the URL for base URL
const base_url = url.pathname.split('/facet/')[0];
const locale = url.searchParams.get('locale');
window.location.href = base_url + (locale ? '?locale=' + locale : '');

// CLONE: Clone search params
const params = new URLSearchParams(url.search);
// REMOVE: Remove facet-specific params
params.delete('facet.page');

// REDIRECT: Redirect with preserved params
const queryString = params.toString();
window.location.href = base_url + (queryString ? '?' + queryString : '');
}

// ELSE: Do it normally with the Bootstrap
Expand Down