From ee9ea26e68f6b39233ef1dff7bac72dfbaf234ea Mon Sep 17 00:00:00 2001 From: Robert Date: Thu, 18 Jun 2026 11:26:21 -0400 Subject: [PATCH] Bulk downloads - remote trigger tabpanels and accordions --- .../partials/browse-data/candidates.jinja | 6 +++--- .../browse-data/filings-reports.jinja | 4 ++-- .../partials/browse-data/raising.jinja | 2 +- .../partials/browse-data/spending.jinja | 6 +++--- fec/fec/static/js/pages/data-browse-data.js | 20 +++++++++++++++++++ tasks.py | 1 - 6 files changed, 29 insertions(+), 10 deletions(-) diff --git a/fec/data/templates/partials/browse-data/candidates.jinja b/fec/data/templates/partials/browse-data/candidates.jinja index 778ab20751..a2612369c9 100644 --- a/fec/data/templates/partials/browse-data/candidates.jinja +++ b/fec/data/templates/partials/browse-data/candidates.jinja @@ -9,7 +9,7 @@

All candidates

Search candidates for president, Senate and House for all years by location, party and more.

- Download this data as .CSV to use on your own + Download this data as .CSV to use on your own
  • @@ -57,7 +57,7 @@ - Presidential candidate map exports + Presidential candidate map exports
  • @@ -112,7 +112,7 @@

    Most recent Statements of Candidacy (Form 2)

    Statements of Candidacy (Form 2) contain basic information about individuals running for federal office, including their names, addresses and authorized campaign committees.

    - Download this data as .CSV to use on your own + Download this data as .CSV to use on your own
  • diff --git a/fec/data/templates/partials/browse-data/filings-reports.jinja b/fec/data/templates/partials/browse-data/filings-reports.jinja index f5ad08a609..f34627f3de 100644 --- a/fec/data/templates/partials/browse-data/filings-reports.jinja +++ b/fec/data/templates/partials/browse-data/filings-reports.jinja @@ -38,7 +38,7 @@

    House and Senate committee reports

    Search financial disclosure reports filed by House and Senate committees on the Form 3. Search by committee name, candidate, amount of financial activity and report name.

    - Download this data as .CSV to use on your own + Download this data as .CSV to use on your own
  • @@ -51,7 +51,7 @@
  • diff --git a/fec/data/templates/partials/browse-data/raising.jinja b/fec/data/templates/partials/browse-data/raising.jinja index 4cd1e49eab..2d381ffec6 100644 --- a/fec/data/templates/partials/browse-data/raising.jinja +++ b/fec/data/templates/partials/browse-data/raising.jinja @@ -33,7 +33,7 @@

    Lobbyist bundled contributions

    diff --git a/fec/data/templates/partials/browse-data/spending.jinja b/fec/data/templates/partials/browse-data/spending.jinja index 420353054a..af9770c891 100644 --- a/fec/data/templates/partials/browse-data/spending.jinja +++ b/fec/data/templates/partials/browse-data/spending.jinja @@ -18,7 +18,7 @@

    Independent expenditures

    Search independent expenditures to find specific spenders, candidates mentioned and transaction information.

    - Download this data as .CSV to use on your own + Download this data as .CSV to use on your own
  • @@ -51,7 +51,7 @@

    Electioneering communications

    Search electioneering communications by the spender, candidate mentioned, date, or amount spent.

    - Download this data as .CSV to use on your own + Download this data as .CSV to use on your own
  • @@ -59,7 +59,7 @@

    Communication costs

    Search communication costs for communications that support or oppose specific candidates. Search by date and amount spent.

    - Download this data as .CSV to use on your own + Download this data as .CSV to use on your own
  • diff --git a/fec/fec/static/js/pages/data-browse-data.js b/fec/fec/static/js/pages/data-browse-data.js index 557ad79d04..2ab3b1fbcf 100644 --- a/fec/fec/static/js/pages/data-browse-data.js +++ b/fec/fec/static/js/pages/data-browse-data.js @@ -32,3 +32,23 @@ $(function() { new PlotChart('.js-spent-overview', 'spent', 2).init(); }); }); + +/** + * Add event listeners for buttons that want to remote trigger tabs and/or accordions + */ +const remoteEls = document.querySelectorAll('.js-remote-tabpanel, .js-remote-accordion'); +remoteEls.forEach((el) => { + el.addEventListener('click', handleRemoteClick.bind(this)); +}); + +function handleRemoteClick(e) { + e.preventDefault(); + + const targetHref = new URL(e.target.getAttribute('href')); + const targetTabId = targetHref.searchParams.get('tab'); + const targetAccordionId = targetHref.hash.substring(1); // (.hash also returns the #, so remove it) + + $(`[role="tab"][data-name="${targetTabId}"]`).trigger('click'); // trigger the tab click + $(`[aria-controls="${targetAccordionId}"][aria-expanded="false"]`).trigger('click'); // trigger the accordion click + if (targetAccordionId) location.hash = `#${targetAccordionId}`; // Jump to the accordion +} diff --git a/tasks.py b/tasks.py index b47d95abca..d6cc61ea65 100644 --- a/tasks.py +++ b/tasks.py @@ -76,7 +76,6 @@ def _detect_space(repo, branch=None, yes=False): ('dev', lambda _, branch: branch == 'develop'), # Uncomment below and adjust branch name to deploy desired feature branch to the feature space # ('feature', lambda _, branch: branch == '[BRANCH NAME]'), - ('feature', lambda _, branch: branch == 'feature/6338-7097-bulk-downloads'), )