diff --git a/static/js/patterns-browser-v2.js b/static/js/patterns-browser-v2.js
index 0b1cd3c77..4b39383a0 100644
--- a/static/js/patterns-browser-v2.js
+++ b/static/js/patterns-browser-v2.js
@@ -109,6 +109,23 @@ async function getData() {
}
}
+function getParams() {
+ // Get the params from the current URL
+ const url = window.location.search;
+ const urlParams = new URLSearchParams(url);
+ var enabledParams = {'categories': {}, 'filters': {}};
+ enabledParams.categories.tier = urlParams.getAll("tier");
+ // Tier is always "and" since each pattern can only have one tier
+ enabledParams.filters.tier = "and";
+ enabledParams.categories.industries = urlParams.getAll("industries");
+ enabledParams.filters.industries = urlParams.get("industries_filter");
+ enabledParams.categories.rh_products = urlParams.getAll("rh_products");
+ enabledParams.filters.rh_products = urlParams.get("rh_products_filter");
+ enabledParams.categories.other_products = urlParams.getAll("other_products");
+ enabledParams.filters.other_products = urlParams.get("other_products_filter");
+ return enabledParams;
+}
+
function cleanString(string) {
// Provide a string that can be used as a HTML id i.e. no spaces.
return string.replace(/ /g, "-")
@@ -190,25 +207,32 @@ function renderSpinner() {
'';
}
-function renderFilterItem(type, name, linkTitle) {
+function renderFilterItem(type, name, linkTitle, enabledItem) {
// HTML for each checkbox item in the filters
+ if (enabledItem) {
+ checkedProp = "checked";
+ } else {
+ checkedProp = ""
+ }
var filterItemHtml = '';
return filterItemHtml;
}
-function renderFilterButtons(filterButtonTypes, name) {
+function renderFilterButtons(filterButtonTypes, name, enabledFilters) {
// HTML for the AND / OR operator buttons
if (filterButtonTypes.length > 1) {
var filterButtonsHtml = '