CCALI / a2jviewer

This is the repo for the A2J Viewer
https://www.a2jauthor.org
Other
5 stars 8 forks source link

Only show the preview button when there’s a text template that meets all the conditions #176

Closed chasenlehara closed 2 years ago

chasenlehara commented 2 years ago

Currently, the document preview button appears when there assemble or save buttons:

https://github.com/CCALI/a2jviewer/blob/dc1d980349beed6dcfd774c0008099a3b1f006a0/src/models/tests/page-test.js#L32-L63

https://github.com/CCALI/a2jviewer/blob/8e04c349c94f6f33ac73d0420a463fb57314e3e9/src/mobile/pages/pages.stache#L83-L91

This does not take into account whether there are:

DAT handles this by returning HTML for these conditions:

https://github.com/CCALI/a2jdat/blob/6f598245364941ac387620864f5858d79ae8ec7d/src/routes/preview.js#L47-L67

https://github.com/CCALI/a2jdat/blob/6f598245364941ac387620864f5858d79ae8ec7d/src/routes/assemble-utils.js#L238

In the future, it would be good if the document preview button was only shown if a preview could be generated; that is, at least one active text template that does not have conditional logic.

JessicaFrank commented 2 years ago

To be released June 29