diff --git a/fec/fec/static/css/customize-editor.css b/fec/fec/static/css/customize-editor.css index 42c5b5668d..2647107cc8 100644 --- a/fec/fec/static/css/customize-editor.css +++ b/fec/fec/static/css/customize-editor.css @@ -80,3 +80,36 @@ li.sequence-member .sequence-member-inner .sequence-type-list .sequence-containe .richtext ol ol ol li { list-style-type: lower-roman; } + + + +div[data-contentpath="reporting_dates_table"] div.widget-checkbox_input { + display: none !important; +} + + +div[data-contentpath="reporting_dates_table"] label[for*="-handsontable-col-caption"] { + display: none; +} + +div[data-contentpath="reporting_dates_table"] label[for*="-handsontable-col-caption"] + div.field-content{ + display: none; +} + + +div[data-contentpath="reporting_dates_table"] div[id*="-value-table-handsontable-container"] { + height:auto !important; +} + +div[data-contentpath="reporting_dates_table"] div.wtHolder { + height:auto !important; +} + +div[data-contentpath="reporting_dates_table"] .fieldname-table .help table td { + background: #357b7d; + color:#fff; + font-weight: bold; + border-width: 2px; + +} + diff --git a/fec/fec/static/js/pages/reporting-dates-tables.js b/fec/fec/static/js/pages/reporting-dates-tables.js index 9f1c3d4492..614cc8d77e 100644 --- a/fec/fec/static/js/pages/reporting-dates-tables.js +++ b/fec/fec/static/js/pages/reporting-dates-tables.js @@ -13,7 +13,7 @@ const states_dropdown_template = ` - + @@ -72,10 +72,10 @@ const header_notes_modal_partial = `
`; +/* eslint-disable no-console */ + function ReportingDates() { - //Declare globals (scoped to this function) to get past linter error/tests. For header_notes and footnotes objects declared in CMS field, CSS.escape, Set() - /* global header_notes, footnotes */ this.dates_table = document.getElementsByClassName('election-dates-table')[0]; /* @@ -88,24 +88,42 @@ function ReportingDates() { or in blocks.py. I think the former makes sense. */ - //only run this logic if the page has an `.election-dates-table` onn it - if (this.dates_table) { - //get all acnhor links in TDs) - this.anchors = this.dates_table.querySelectorAll('td a[href^=\'#\']'); + this.buildStaticElements(); - //disable default jump behavior for anchor links(#) but keep links for accessibility - for (const anchor of this.anchors) { - anchor.addEventListener('click', e => { - e.preventDefault(); - }); - } + this.convertFootnotes(); //converts number or symbol following "+" to footnote html, in-place - this.buildStaticElements(); + this.addStateClass(); - this.addFootnotes(); + this.addFootnotes(); //adds hidden Footnote rows this.stripeByState(); + ///TODO REMEMER THAT PUTTING THIS BELOW `this.addFootnotes()` DISABLES THE `e.preventDefault();` ON FOOTNNOTES sups ALREADY ON PAGE ON THIS TEST VERSION + + //it only runs this logic if the page has an `.election-dates-table` on it, TODO: might not e necessary for this trmplate + if (this.dates_table) { + //get all acnhor links in TDs) + this.anchors = this.dates_table.querySelectorAll('td a[href^=\'#\']'); + + //disable default jump behavior for anchor links(#) but keep links for accessibility + for (const anchor of this.anchors) { + anchor.addEventListener('click', e => { + e.preventDefault(); + }); + } + + const header_sups = document.querySelectorAll( + 'tr:first-child th a[href^="#"]' + ); + + //add data attribute to the header sups to open AY11 dialog and disable default jump behavior for anchor links(#) but keep links for accessibility + for (const header_sup of header_sups) { + header_sup.setAttribute('data-a11y-dialog-show', 'header_notes_modal'); + header_sup.addEventListener('click', e => { + e.preventDefault(); + }); + } + //Define media query const mql = window.matchMedia('screen and (max-width: 650px)'); @@ -167,31 +185,32 @@ ReportingDates.prototype.buildStaticElements = function() { table_parent.insertBefore(dropdown_wrapper, this.dates_table); //Create static footnote/header note list - - let hdr_str = ''; - //build static list from header notes object if it exists - if (typeof header_notes == 'object') { + let hdr_str = ''; + const header_notes_json = JSON.parse(document.getElementById('header_notes').textContent); +// WORKS-- //build static list from footnotes object (`const footnotes`, which is added in teemplate riht now) --if it exists + if (typeof header_notes_json == 'object') { hdr_str = `