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

Configurable header and footer #52

Merged
merged 10 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Changelog
3.0.3 (unreleased)
------------------

- Nothing changed yet.
- Configurable header and footer for email message.
[folix-01]


3.0.2 (2024-05-05)
Expand Down
19 changes: 15 additions & 4 deletions src/collective/volto/formsupport/browser/send_mail_template.pt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
i18n:domain="collective.volto.formsupport"
define="parameters python:options.get('parameters', {});
url python:options.get('url', '');
title python:options.get('title', '');">
title python:options.get('title', '');
mail_header python:options.get('mail_header', '');
mail_footer python:options.get('mail_footer', '');
">
<header>
<tal:element tal:replace="structure mail_header"></tal:element>
</header>
<ul>
<tal:field repeat="field parameters">
<li tal:define="value field/value|nothing;
Expand All @@ -11,7 +17,12 @@
</li>
</tal:field>
</ul>
<p i18n:translate="send_mail_text">
A new form has been submitted from <a href="${url}"><strong i18n:name="url">${url}</strong></a>
</p>
<footer>
<tal:element tal:replace="structure mail_footer"></tal:element>
<tal:element tal:condition="python:not mail_footer ">
<p i18n:translate="send_mail_text">
A new form has been submitted from <a href="${url}"><strong i18n:name="url">${url}</strong></a>
</p>
</tal:element>
</footer>
</tal:root>
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@
i18n:domain="collective.volto.formsupport"
define="parameters python:options.get('parameters', {});
url python:options.get('url', '');
title python:options.get('title', '');">
title python:options.get('title', '');
mail_header python:options.get('mail_header', '');
mail_footer python:options.get('mail_footer', '');
">
<style>
th {
text-align: start;
}
</style>
<header>
<tal:element tal:replace="structure mail_header"></tal:element>
<tal:element tal:condition="python:not mail_footer">
mamico marked this conversation as resolved.
Show resolved Hide resolved
<caption i18n:translate="send_mail_text_table">Form submission data for ${title}</caption>
<tal:element>
</header>
<table border="1">
<caption i18n:translate="send_mail_text_table">Form submission data for ${title}</caption>
<thead>
<tr role="row">
<th align="left"
Expand All @@ -33,6 +41,9 @@
</tal:field>
</tbody>
</table>
<footer>
<tal:element tal:replace="structure mail_footer"></tal:element>
</footer>
</tal:root>


Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,8 @@ def prepare_message(self):
"parameters": self.filter_parameters(),
"url": self.context.absolute_url(),
"title": self.context.Title(),
"mail_header": self.block.get("mail_header", None),
"mail_footer": self.block.get("mail_footer", None),
}
return message_template(**parameters)

Expand Down