From e1b8ee80ac53a4a1970c6687d32bfc510d320bb0 Mon Sep 17 00:00:00 2001 From: Pat Phongsvirajati Date: Wed, 12 Feb 2020 22:35:11 -0500 Subject: [PATCH 1/3] add version helper text, add report type toggle to raw, only allow current version for regularly filed reports by default. --- .../macros/filters/version-status.jinja | 9 ++++-- .../independent-expenditures-filter.jinja | 4 ++- fec/fec/static/js/modules/tables.js | 32 +++++++++++++++++++ 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/fec/data/templates/macros/filters/version-status.jinja b/fec/data/templates/macros/filters/version-status.jinja index dead914ed5..3bc0fb02d9 100644 --- a/fec/data/templates/macros/filters/version-status.jinja +++ b/fec/data/templates/macros/filters/version-status.jinja @@ -1,10 +1,13 @@ -{% macro version(id_suffix, methodology) %} +{% macro version(id_suffix, methodology, helper_text=False) %}
-
+
Version + {% if helper_text %} + + {% endif %}
  • - +
  • {% if methodology %} diff --git a/fec/data/templates/partials/independent-expenditures-filter.jinja b/fec/data/templates/partials/independent-expenditures-filter.jinja index c909f758eb..d019b154e5 100644 --- a/fec/data/templates/partials/independent-expenditures-filter.jinja +++ b/fec/data/templates/partials/independent-expenditures-filter.jinja @@ -25,6 +25,8 @@ Filter independent expenditures
    {{ typeahead.field('committee_id', 'Spender name or ID', id_suffix='_raw') }} {{ text.field('candidate_search', 'Candidate mentioned', id_suffix='_raw') }} + {{ reports.type(id_suffix='_raw') }} + {{ reports.form(id_suffix='_raw') }} {{ version_status.version(id_suffix='_raw', methodology='True') }}
    {# Removing these filters for now until the filter count bug can be fixed #} @@ -53,7 +55,7 @@ Filter independent expenditures {{ years.cycles('cycle', 'Years', show_tooltip=False) }} {{ reports.type(id_suffix='_processed') }} {{ reports.form(id_suffix='_processed') }} - {{ version_status.version(id_suffix='_processed', methodology='True') }} + {{ version_status.version(id_suffix='_processed', methodology='True', helper_text = 'Insert helper') }}
diff --git a/fec/fec/static/js/modules/tables.js b/fec/fec/static/js/modules/tables.js index 54bea181cc..6a2bb29a72 100644 --- a/fec/fec/static/js/modules/tables.js +++ b/fec/fec/static/js/modules/tables.js @@ -652,6 +652,13 @@ DataTable.prototype.fetch = function(data, callback) { return; } + // Filter by current and unknown versions when current version is checked + // API does not allow for null values for most_recent now + if (self.filters && self.filters.most_recent) { + self.filters.most_recent = 'true'; + self.filters.most_recent = 'null'; + } + // If 24- and 48-Hour report is selected, set the filing form to F24. // Otherwise, it's a regularly scheduled report, keep the filing // form as F3X @@ -661,6 +668,31 @@ DataTable.prototype.fetch = function(data, callback) { self.filters.filing_form[F3X_index] = 'F24'; } } + + // Regularly scheduled reports only have current versions + // Therefore, we need to check current version by default + // and disable changes. + if ( + self.filters && + self.filters.data_type == 'processed' && + self.filters.is_notice == 'false' + ) { + self.filters.most_recent = 'true'; + $('#most_recent_true_processed').prop('checked', true); + $( + '#version_processed legend, #version_processed li, #version_processed label' + ) + .removeClass('is-active-filter') + .addClass('is-disabled-filter'); + } else if ( + self.filters && + self.filters.data_type == 'processed' && + self.filters.is_notice == 'true' + ) { + $( + '#version_processed legend, #version_processed li, #version_processed label' + ).removeClass('is-disabled-filter'); + } } var url = self.buildUrl(data); From 5de32fe19511abb7b4c60473bbc9a92cb821d3b8 Mon Sep 17 00:00:00 2001 From: Pat Phongsvirajati Date: Thu, 13 Feb 2020 15:17:39 -0500 Subject: [PATCH 2/3] removed most_recent function to handle nulls. Decided to handle this in the API --- fec/fec/static/js/modules/tables.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/fec/fec/static/js/modules/tables.js b/fec/fec/static/js/modules/tables.js index 6a2bb29a72..2c335450ac 100644 --- a/fec/fec/static/js/modules/tables.js +++ b/fec/fec/static/js/modules/tables.js @@ -652,13 +652,6 @@ DataTable.prototype.fetch = function(data, callback) { return; } - // Filter by current and unknown versions when current version is checked - // API does not allow for null values for most_recent now - if (self.filters && self.filters.most_recent) { - self.filters.most_recent = 'true'; - self.filters.most_recent = 'null'; - } - // If 24- and 48-Hour report is selected, set the filing form to F24. // Otherwise, it's a regularly scheduled report, keep the filing // form as F3X From 609f0ce3ee3955d7151d2b0920547573b673ed6d Mon Sep 17 00:00:00 2001 From: Pat Phongsvirajati Date: Thu, 13 Feb 2020 15:20:33 -0500 Subject: [PATCH 3/3] removed version helper text for now until we are ready to make that upddate --- .../templates/partials/independent-expenditures-filter.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fec/data/templates/partials/independent-expenditures-filter.jinja b/fec/data/templates/partials/independent-expenditures-filter.jinja index d019b154e5..1a96f839dd 100644 --- a/fec/data/templates/partials/independent-expenditures-filter.jinja +++ b/fec/data/templates/partials/independent-expenditures-filter.jinja @@ -55,7 +55,7 @@ Filter independent expenditures {{ years.cycles('cycle', 'Years', show_tooltip=False) }} {{ reports.type(id_suffix='_processed') }} {{ reports.form(id_suffix='_processed') }} - {{ version_status.version(id_suffix='_processed', methodology='True', helper_text = 'Insert helper') }} + {{ version_status.version(id_suffix='_processed', methodology='True') }}