Added custom label to contact card link button
authorThierry Florac <thierry.florac@onf.fr>
Tue, 20 Nov 2018 15:40:17 +0100
changeset 239 a6429e91f091
parent 236 829f481fe2a6 (diff)
parent 238 df8da54d790a (current diff)
child 240 00334308efd4
Added custom label to contact card link button
docs/HISTORY.txt
src/pyams_default_theme/component/paragraph/interfaces/contact.py
src/pyams_default_theme/component/paragraph/templates/contact-default.pt
--- a/docs/HISTORY.txt	Tue Nov 20 15:19:28 2018 +0100
+++ b/docs/HISTORY.txt	Tue Nov 20 15:40:17 2018 +0100
@@ -1,6 +1,10 @@
 History
 =======
 
+0.1.17
+------
+ - added customizable label to contact button
+
 0.1.16
 ------
  - added results internal OID into view's preview
--- a/src/pyams_default_theme/component/paragraph/interfaces/contact.py	Tue Nov 20 15:19:28 2018 +0100
+++ b/src/pyams_default_theme/component/paragraph/interfaces/contact.py	Tue Nov 20 15:40:17 2018 +0100
@@ -12,17 +12,12 @@
 
 __docformat__ = 'restructuredtext'
 
-
-# import standard library
-
-# import interfaces
-
-# import packages
-from zope.interface import Interface, Attribute
+from zope.interface import Attribute, Interface
 from zope.schema import Bool, Choice
-from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
+from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
 
 from pyams_i18n.schema import I18nTextLineField
+
 from pyams_default_theme import _
 
 
@@ -62,7 +57,7 @@
 
     can_display_map = Attribute("Check if location map can be displayed")
 
-    button_label = I18nTextLineField(title=_("Button label"),
-                                     description=_("Label of the navigation button displayed by "
+    button_label = I18nTextLineField(title=_("Contact button label"),
+                                     description=_("Custom label of the contact button displayed by "
                                                    "front-office template"),
                                      required=False)
--- a/src/pyams_default_theme/component/paragraph/templates/contact-default.pt	Tue Nov 20 15:19:28 2018 +0100
+++ b/src/pyams_default_theme/component/paragraph/templates/contact-default.pt	Tue Nov 20 15:40:17 2018 +0100
@@ -23,8 +23,9 @@
 		</div>
 		<tal:if condition="view.contact_email">
 			<span i18n:translate="">Contact email:</span>
-			<a href="mailto:${view.contact_email}">
-				${view.contact_email}
+			<a tal:define="buttom_label i18n:settings.button_label"
+			   href="mailto:${view.contact_email}?subject=${view.title}">
+				${button_label or view.contact_email}
 			</a><br />
 		</tal:if>
 		<tal:if condition="view.phone_number">