# HG changeset patch # User Thierry Florac # Date 1547030408 -3600 # Node ID 16bcd95b1e01d34c6b0b0992854e093514f50bd5 # Parent 91b2ec075f2b1044c2729e92c30ac14e5f66fc3c Updated verbatim renderer interface diff -r 91b2ec075f2b -r 16bcd95b1e01 src/pyams_default_theme/component/paragraph/interfaces/verbatim.py --- a/src/pyams_default_theme/component/paragraph/interfaces/verbatim.py Wed Jan 09 10:24:17 2019 +0100 +++ b/src/pyams_default_theme/component/paragraph/interfaces/verbatim.py Wed Jan 09 11:40:08 2019 +0100 @@ -13,11 +13,12 @@ __docformat__ = 'restructuredtext' from zope.interface import Interface -from zope.schema import Choice -from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm +from zope.schema import Bool, Choice +from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary from pyams_default_theme import _ + FRAME_POSITIONS = ( {'id': 'left', 'title': _("Left")}, {'id': 'right', 'title': _("Right")}, @@ -28,7 +29,16 @@ for item in FRAME_POSITIONS]) -class ILateralVerbatimParagraphRendererSettings(Interface): +class IVerbatimParagraphRendererSettings(Interface): + """Verbatim paragraph renderer settings""" + + zoom_on_click = Bool(title=_("Zoom on image click?"), + description=_("If 'yes', a click on illustration thumbnail is required to zoom"), + required=True, + default=True) + + +class ILateralVerbatimParagraphRendererSettings(IVerbatimParagraphRendererSettings): """Verbatim paragraph lateral renderer settings interface""" relative_width = Choice(title=_("Relative width"), diff -r 91b2ec075f2b -r 16bcd95b1e01 src/pyams_default_theme/component/paragraph/templates/verbatim-default.pt --- a/src/pyams_default_theme/component/paragraph/templates/verbatim-default.pt Wed Jan 09 10:24:17 2019 +0100 +++ b/src/pyams_default_theme/component/paragraph/templates/verbatim-default.pt Wed Jan 09 11:40:08 2019 +0100 @@ -14,8 +14,17 @@ tal:define="photo i18n:illustration.data; alt i18n:illustration.alt_title;" tal:condition="photo"> - ${structure:tales:picture(photo, lg_thumb='portrait', md_thumb='portrait', - sm_thumb='portrait', xs_thumb='portrait', alt=alt)} + + ${structure:tales:picture(photo, lg_thumb='portrait', md_thumb='portrait', + sm_thumb='portrait', xs_thumb='portrait', alt=alt)} +
- + \ No newline at end of file diff -r 91b2ec075f2b -r 16bcd95b1e01 src/pyams_default_theme/component/paragraph/templates/verbatim-left.pt --- a/src/pyams_default_theme/component/paragraph/templates/verbatim-left.pt Wed Jan 09 10:24:17 2019 +0100 +++ b/src/pyams_default_theme/component/paragraph/templates/verbatim-left.pt Wed Jan 09 11:40:08 2019 +0100 @@ -1,31 +1,41 @@ -
-

${view.title}

- -
- ${structure:tales:picture(photo, lg_thumb='portrait', md_thumb='portrait', - sm_thumb='portrait', xs_thumb='portrait', alt=alt)} -
-
- Author
- Charge + class="bordered verbatim padding-20 pull-left col-md-${settings.relative_width}"> +
+
+

${title}

-
Quote
- - -
Quote
-
- ${view.author}, - ${view.charge} +
+ + + +
+
${structure:tales:html(view.quote)}
+
+ ${view.author}, + ${view.charge} +
+
- +
diff -r 91b2ec075f2b -r 16bcd95b1e01 src/pyams_default_theme/component/paragraph/templates/verbatim-right.pt --- a/src/pyams_default_theme/component/paragraph/templates/verbatim-right.pt Wed Jan 09 10:24:17 2019 +0100 +++ b/src/pyams_default_theme/component/paragraph/templates/verbatim-right.pt Wed Jan 09 11:40:08 2019 +0100 @@ -1,31 +1,41 @@ -
-

${view.title}

- -
- ${structure:tales:picture(photo, lg_thumb='portrait', md_thumb='portrait', - sm_thumb='portrait', xs_thumb='portrait', alt=alt)} -
-
- Author
- Charge + class="bordered verbatim padding-20 pull-right col-md-${settings.relative_width}"> +
+
+

${title}

-
Quote
- - -
Quote
-
- ${view.author}, - ${view.charge} +
+ + + +
+
${structure:tales:html(view.quote)}
+
+ ${view.author}, + ${view.charge} +
+
- +
diff -r 91b2ec075f2b -r 16bcd95b1e01 src/pyams_default_theme/component/paragraph/verbatim.py --- a/src/pyams_default_theme/component/paragraph/verbatim.py Wed Jan 09 10:24:17 2019 +0100 +++ b/src/pyams_default_theme/component/paragraph/verbatim.py Wed Jan 09 11:40:08 2019 +0100 @@ -20,30 +20,51 @@ from pyams_content.component.illustration.interfaces import IIllustration from pyams_content.component.paragraph.interfaces.verbatim import IVerbatimParagraph from pyams_content.features.renderer.interfaces import IContentRenderer -from pyams_default_theme.component.paragraph.interfaces.verbatim import ILateralVerbatimParagraphRendererSettings +from pyams_default_theme import _ +from pyams_default_theme.component.paragraph.interfaces.verbatim import ILateralVerbatimParagraphRendererSettings, \ + IVerbatimParagraphRendererSettings from pyams_default_theme.features.renderer import BaseContentRenderer from pyams_i18n.interfaces import II18n from pyams_skin.layer import IPyAMSLayer from pyams_template.template import template_config from pyams_utils.adapter import adapter_config, get_annotation_adapter -from pyams_default_theme import _ + +# +# Verbatim paragraph renderer settings +# + +VERBATIM_PARAGRAPH_RENDERER_SETTINGS_KEY = 'pyams_content.verbatim.renderer' + + +@implementer(IVerbatimParagraphRendererSettings) +class VerbatimParagraphRendererSettings(Persistent, Location): + """Verbatim paragraph renderer settings""" + + zoom_on_click = FieldProperty(IVerbatimParagraphRendererSettings['zoom_on_click']) + + +@adapter_config(context=IVerbatimParagraph, provides=IVerbatimParagraphRendererSettings) +def verbatim_paragraph_renderer_settings_factory(context): + """Frame text paragraph renderer settings factory""" + return get_annotation_adapter(context, VERBATIM_PARAGRAPH_RENDERER_SETTINGS_KEY, + VerbatimParagraphRendererSettings) # # Verbatim paragraph lateral renderer settings # +LATERAL_VERBATIM_PARAGRAPH_RENDERER_SETTINGS_KEY = 'pyams_content.verbatim.renderer:lateral' + + @implementer(ILateralVerbatimParagraphRendererSettings) -class LateralVerbatimParagraphRendererSettings(Persistent, Location): +class LateralVerbatimParagraphRendererSettings(VerbatimParagraphRendererSettings): """Verbatim paragraph lateral renderer settings""" relative_width = FieldProperty(ILateralVerbatimParagraphRendererSettings['relative_width']) -LATERAL_VERBATIM_PARAGRAPH_RENDERER_SETTINGS_KEY = 'pyams_content.verbatim.renderer:lateral' - - @adapter_config(context=IVerbatimParagraph, provides=ILateralVerbatimParagraphRendererSettings) def lateral_verbatim_paragraph_renderer_settings_factory(context): """Frame text paragraph lateral renderer settings factory""" @@ -75,6 +96,8 @@ label = _("Default verbatim renderer") weight = 1 + settings_interface = IVerbatimParagraphRendererSettings + @adapter_config(name='left', context=(IVerbatimParagraph, IPyAMSLayer), provides=IContentRenderer) @template_config(template='templates/verbatim-left.pt', layer=IPyAMSLayer)