diff --git a/static/js/alerts.js b/static/js/alerts.js index 085c4d5..09a58c7 100644 --- a/static/js/alerts.js +++ b/static/js/alerts.js @@ -24,7 +24,7 @@ function loadAlerts() { // Build a query string for the API, based on the filters that the user has selected. function buildQueryString() { let str = "?"; - ["dx_continent", "source"].forEach(fn => { + ["dx_continent", "source", "sig"].forEach(fn => { if (!allFilterOptionsSelected(fn)) { str = str + getQueryStringFor(fn) + "&"; } @@ -332,6 +332,7 @@ function loadOptions() { // Populate the filters panel generateMultiToggleFilterCard("#dx_continent_options", "dx_continent", options["continents"]); generateMultiToggleFilterCard("#source-options", "source", options["alert_providers"]); + generateActivitiesMultiToggleFilterCard(options["sigs"]); // Load URL params. These may select things from the various filter & display options, so the function needs // to be called after these are set up, but if the URL params ask for "embedded mode", this will suppress diff --git a/static/js/common.js b/static/js/common.js index d68c0b8..b5d50c6 100644 --- a/static/js/common.js +++ b/static/js/common.js @@ -135,6 +135,63 @@ function generateMultiToggleFilterCard(elementID, filterQuery, options) { $(elementID).append(`
All   None
`); } +// Generate a collapsable section for the activities filter card, and append it to the given list. The section is +// expanded by default if isExpanded is true. +function appendActivityFilterSection($list, sectionId, heading, isExapanded, buildBody) { + const collapseId = `activity-options-${sectionId}-collapse`; + const $li = $('
  • '); + $li.append(``); + const $body = $(`
    `); + buildBody($body); + $li.append($body); + $list.append($li); +} + +// Generate activities filter card. This one is also a special case. +function generateActivitiesMultiToggleFilterCard(activity_options) { + const $list = $('