--- a/src/pyams_default_theme/component/paragraph/contact.py Tue Jan 22 14:27:31 2019 +0100
+++ b/src/pyams_default_theme/component/paragraph/contact.py Tue Jan 22 14:55:36 2019 +0100
@@ -9,6 +9,8 @@
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
+from pyramid.encode import url_quote
+
__docformat__ = 'restructuredtext'
@@ -95,3 +97,14 @@
if not label:
label = self.request.localizer.translate(_("contact-button-label", default="Contact"))
return label
+
+ @property
+ def contact_url(self):
+ if self.name:
+ return 'mailto:{}'.format(url_quote('{} <{}>'.format(self.name, self.contact_email)))
+ else:
+ return 'mailto:{}'.format(self.contact_email)
+
+ @property
+ def contact_subject(self):
+ return url_quote(self.title)
--- a/src/pyams_default_theme/component/paragraph/templates/contact-default.pt Tue Jan 22 14:27:31 2019 +0100
+++ b/src/pyams_default_theme/component/paragraph/templates/contact-default.pt Tue Jan 22 14:55:36 2019 +0100
@@ -25,7 +25,7 @@
<tal:if condition="view.contact_email">
<span i18n:translate="">Contact email:</span>
<a tal:define="button_label view.button_label"
- href="mailto:${view.contact_email}?subject=${view.title}">
+ href="${view.contact_url}?subject=${view.contact_subject}">
${button_label}
</a><br />
</tal:if>