diff --git a/fec/fec/static/js/modules/typeahead.js b/fec/fec/static/js/modules/typeahead.js index 1dc2e3f5c..d9bc4d6e0 100644 --- a/fec/fec/static/js/modules/typeahead.js +++ b/fec/fec/static/js/modules/typeahead.js @@ -342,6 +342,42 @@ const aoStatutoryCitationDataset = { } }; +const caseRegulatoryCitationDataset = { + name: 'caseRegulatoryCitation', + display: 'name', + limit: 10, + source: citationRegulationEngine, + templates: { + header: 'Select a citation:', + pending: + 'Loading citations…', + notFound: compileHBS(''), // This has to be empty to not show anything + suggestion: function(datum) { + return ( + '' + datum.name + '' + ); + } + } +}; + +const caseStatutoryCitationDataset = { + name: 'caseStatutoryCitation', + display: 'name', + limit: 10, + source: citationStatuteEngine, + templates: { + header: 'Select a citation:', + pending: + 'Loading citations…', + notFound: compileHBS(''), // This has to be empty to not show anything + suggestion: function(datum) { + return ( + '' + datum.name + '' + ); + } + } +}; + export const datasets = { candidates: candidateDataset, committees: committeeDataset, @@ -350,6 +386,8 @@ export const datasets = { regulations: regulationDataset, aoRegulatoryCitations: aoRegulatoryCitationDataset, aoStatutoryCitations: aoStatutoryCitationDataset, + caseRegulatoryCitations: caseRegulatoryCitationDataset, + caseStatutoryCitations: caseStatutoryCitationDataset, allData: [candidateDataset, committeeDataset], all: [candidateDataset, committeeDataset, individualDataset, siteDataset, legalDataset] }; diff --git a/fec/legal/templates/layouts/legal-doc-search-results.jinja b/fec/legal/templates/layouts/legal-doc-search-results.jinja index 9e315f138..1ea8e6c00 100644 --- a/fec/legal/templates/layouts/legal-doc-search-results.jinja +++ b/fec/legal/templates/layouts/legal-doc-search-results.jinja @@ -100,7 +100,8 @@ const tag = this.getAttribute('data-tag'); const url = new URL(window.location); - // Remove tags logic + // "Remove tags" logic + // Assigns a URL to each remove/"⤫" button that removes its own value from the URL if (tag === 'query') { url.searchParams.delete('search'); url.searchParams.delete('search_exclude'); @@ -135,6 +136,32 @@ } else if (tag && tag == 'secondary_subject_id') { // Check if tag is not null or undefined // Remove 'secondary_subject_id' from the URL url.searchParams.delete('secondary_subject_id'); + } else if (tag && tag == 'case_citation_require_all') { + url.searchParams.delete('case_citation_require_all'); + } else if (tag && tag.startsWith('case_regulatory_citation')) { + // Get the 0-indexed position of this item + const index = tag.split('_').at(-1); + // Hold all the case_regulatory_citation from the URL + const citations = url.searchParams.getAll('case_regulatory_citation'); + // Remove all of the case_regulatory_citation from the URL + url.searchParams.delete('case_regulatory_citation'); + // For all of the held citations, + citations.forEach((cite, i) => { + // Add all but this element back to the URL + if (i != index) url.searchParams.append('case_regulatory_citation', cite); + }); + } else if (tag && tag.startsWith('case_statutory_citation')) { + // Get the 0-indexed position of this item + const index = tag.split('_').at(-1); + // Hold all the case_statutory_citation from the URL + const citations = url.searchParams.getAll('case_statutory_citation'); + // Remove all of the case_statutory_citation from the URL + url.searchParams.delete('case_statutory_citation'); + // For all of the held citations, + citations.forEach((cite, i) => { + // Add all but this element back to the URL + if (i != index) url.searchParams.append('case_statutory_citation', cite); + }); } else { url.searchParams.delete(tag); } diff --git a/fec/legal/templates/legal-search-results-murs.jinja b/fec/legal/templates/legal-search-results-murs.jinja index 3cdb89742..e9772cc8b 100644 --- a/fec/legal/templates/legal-search-results-murs.jinja +++ b/fec/legal/templates/legal-search-results-murs.jinja @@ -2,6 +2,7 @@ {% import 'macros/legal.jinja' as legal %} {% import 'macros/filters/checkbox.jinja' as checkbox %} {% import 'macros/filters/dropdown-json.jinja' as dropdown %} +{% import 'macros/filters/typeahead-filter.jinja' as typeahead %} {% set document_type_display_name = 'Closed Matters Under Review' %} {% block header %} @@ -13,7 +14,7 @@ {% block filters %}
Document date range does not search archived cases
+