Closed mikemitchel closed 2 years ago
From @JessicaFrank on Slack:
I am leaning toward language like "At least one of your templates has a preview option, would you like to view it." That covers people with 1 text template, or people with potentially text + pdf combos that can't all be previewed. We aren't guaranteeing this is the final package, but offering an accessible preview when possible.
I think this can be closed. The PR above implements the majority of the functionality—the remaining can be implemented in https://github.com/CCALI/a2jviewer/issues/176 at a later date.
Whenever a user has text templates to assemble, they should be given an option to preview those templates in an accessible way prior to final assembly.
current plan:
[ ] detect either the 'ASSEMBLE' or 'ASSEMBLE&POST' buttons exist on the current page
[ ] if yes above, detect if any of the available Text templates qualify for assembly (they could be inactive. or wrapped in a boolean condition) --- all templates have a tag on their 'rootNode'
a2j-template
is as text template,a2j-pdf
is a pdf based template --- both template types have anactive
property, onlyactive
templates should be previewed --- see this code for Author defined conditional filtering as it happens in the backend Node DAT app: https://github.com/CCALI/a2jdat/blob/bad6ecb4bde1fac60bf01334a94eafdfc17be379/src/routes/assemble-utils.js#L55-L68[ ] if yes to the two above, then offer a single 'you have preview-able templates available' button in the question text (if the only text templates are
active: false
or conditionally hidden, no button should show)[ ] if they click the button, show a preview modal of the rendered template that satisfies accessibility requirements -
keyboard nav, good color contrast, right sized elements, semantic markdown, etc
normal close options to return to last interview page (X, close button, esc key) - this will allow user to go back and click the 'assemble' buttons to finish up, or they can use any of the nav tooling to go back through the Interview and change any answers
The above preview assembly will require a new
/api/preview
route it the DAT to return the rendered HTML CCALI/a2jdat#94