Improve Template Previews
Opened this issue · 2 comments
#193 Introduced template previews.
Now you can navigate to a URL like https://tn-spa-bootstrapper-staging.herokuapp.com/api/template_preview/?template=registration/password_reset.html and see a preview of what that email would look like without having to trigger and receive an email.
This is great, but there could be some improvements:
- If you don't pass it a template name, it should return a list of URLs with all templates it was able to self discover
- The logic for this should probably be in
common
orutils
instead ofcore
Could you please offer further elaboration? I'm seeking a more in-depth explanation.
For example, one of the arguments passed to most email templates is support_email
, which displays at the bottom of the email. But because of how the template preview feature was built, there was no example support_email
to pass. So nothing is displayed in the preview. Thus, the template preview isn't a complete preview of what that email would actually look like.
Example of a template preview in staging here: https://tn-spa-bootstrapper-staging.herokuapp.com/api/template_preview/?template=registration/password_reset.html
This is generated using this template: https://github.com/thinknimble/tn-spa-bootstrapper/blob/main/%7B%7Bcookiecutter.project_slug%7D%7D/server/%7B%7Bcookiecutter.project_slug%7D%7D/core/templates/registration/password_reset.html
Which extends this template where the support_email
html code is rendered: https://github.com/thinknimble/tn-spa-bootstrapper/blob/main/%7B%7Bcookiecutter.project_slug%7D%7D/server/%7B%7Bcookiecutter.project_slug%7D%7D/core/templates/_action-email-base.html#L214