Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only add JS to pages when needed #5153

Closed
7 tasks
Tracked by #164
johnnyporkchops opened this issue Apr 7, 2022 · 1 comment
Closed
7 tasks
Tracked by #164

Only add JS to pages when needed #5153

johnnyporkchops opened this issue Apr 7, 2022 · 1 comment

Comments

@johnnyporkchops
Copy link
Contributor

johnnyporkchops commented Apr 7, 2022

Summary

What we're after:
Remove the hardcoded reference to reporting-dates-tables.js in the full_width_page template. This is not necessary if an editor uses this template for something other than reporting dates table. We do not want to load unnecessary JS to optimize performance reduce potential attack surface.

We can include a reference to the JS file via a Wagtail choice field like we do on custom_page template by adding a conditiona_je field to settings tab.

Related issues/PRs

#5145
https://github.com/fecgov/fec-cms/pull/4330/files (See how current conditional_js was done on CustomPage)

Completion criteria

  • conditional_js is now a field available in the Wagtail settings tab on FullWidthPage template
  • reporting-dates-tables.js is added to constants.py
  • full_width_page.html template as been altered like custom_page.html to reference conditional_js value if it exists instead of hardcoding a reference to reporting-dates-tables.js
  • Reporting dates pages that use FullWidthPage have the reporting-dates-tables.js chosen in conditional_js dropdown.

Tech steps or considerations (optional)

  • Work with @djgarr to determine best way to eliminate or reduce downtime of the Reporting dates tables' footnote, filtering and modal window functionality during this transition.
  • Ask @djgarr for inventory of pages using FullWidthPage template that require the script to work. How far back didi we start using the FullWidthPage template for these tables?

Future work

  • Coordinate the switchover with content team and @djgarr , to minimize downtime of reporting dates tables that rely on the script
@johnnyporkchops
Copy link
Contributor Author

Closing as it will be resolved by #6491

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

No branches or pull requests

1 participant