# HG changeset patch # User Thierry Florac # Date 1519297205 -3600 # Node ID 5527bc086216c4d3eeaf36d6045a46873649594c # Parent 9c147733c02eb70c57e53629b8063ae7c7f4c4b5 Renamed "summary" views to "preview" diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/component/association/zmi/paragraph.py --- a/src/pyams_content/component/association/zmi/paragraph.py Thu Feb 22 10:15:00 2018 +0100 +++ b/src/pyams_content/component/association/zmi/paragraph.py Thu Feb 22 12:00:05 2018 +0100 @@ -20,7 +20,7 @@ IAssociationInfo from pyams_content.component.association.zmi.interfaces import IAssociationsParentForm from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \ - IParagraphSummary + IParagraphPreview from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor, IParagraphContainerView from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION from pyams_content.shared.common.interfaces import IWfSharedContent @@ -123,13 +123,13 @@ # -# Association paragraph summary +# Association paragraph preview # -@adapter_config(context=(IAssociationParagraph, IPyAMSLayer), provides=IParagraphSummary) -@template_config(template='templates/paragraph-summary.pt', layer=IPyAMSLayer) -class AssociationParagraphSummary(BaseContentProvider): - """Association paragraph renderer""" +@adapter_config(context=(IAssociationParagraph, IPyAMSLayer), provides=IParagraphPreview) +@template_config(template='templates/paragraph-preview.pt', layer=IPyAMSLayer) +class AssociationParagraphPreview(BaseContentProvider): + """Association paragraph preview""" language = None associations = None diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/component/association/zmi/templates/paragraph-preview.pt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_content/component/association/zmi/templates/paragraph-preview.pt Thu Feb 22 12:00:05 2018 +0100 @@ -0,0 +1,9 @@ + +

§ title

+ +
diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/component/association/zmi/templates/paragraph-summary.pt --- a/src/pyams_content/component/association/zmi/templates/paragraph-summary.pt Thu Feb 22 10:15:00 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ - -

§ title

- -
diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/component/gallery/zmi/paragraph.py --- a/src/pyams_content/component/gallery/zmi/paragraph.py Thu Feb 22 10:15:00 2018 +0100 +++ b/src/pyams_content/component/gallery/zmi/paragraph.py Thu Feb 22 12:00:05 2018 +0100 @@ -19,7 +19,7 @@ from pyams_content.component.gallery.interfaces import IGalleryParagraph, IBaseGallery from pyams_content.component.gallery.zmi.interfaces import IGalleryContentsView from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \ - IParagraphSummary + IParagraphPreview from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor, IParagraphContainerView from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION from pyams_form.interfaces.form import IInnerForm, IEditFormButtons, IInnerSubForm @@ -187,12 +187,12 @@ # Gallery paragraph summary # -@adapter_config(context=(IGalleryParagraph, IPyAMSLayer), provides=IParagraphSummary) -class GalleryParagraphSummary(BaseContentProvider): - """Gallery summary""" +@adapter_config(context=(IGalleryParagraph, IPyAMSLayer), provides=IParagraphPreview) +class GalleryParagraphPreview(BaseContentProvider): + """Gallery preview""" def __init__(self, context, request): - super(GalleryParagraphSummary, self).__init__(context, request) + super(GalleryParagraphPreview, self).__init__(context, request) self.renderer = self.context.get_renderer(request) language = None diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/component/illustration/zmi/paragraph.py --- a/src/pyams_content/component/illustration/zmi/paragraph.py Thu Feb 22 10:15:00 2018 +0100 +++ b/src/pyams_content/component/illustration/zmi/paragraph.py Thu Feb 22 12:00:05 2018 +0100 @@ -17,7 +17,7 @@ # import interfaces from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, \ - IParagraphContainer, IParagraphSummary + IParagraphContainer, IParagraphPreview from pyams_content.component.illustration.interfaces import IIllustration, IIllustrationParagraph from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor, IParagraphContainerView from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION @@ -188,12 +188,12 @@ # Illustration summary # -@adapter_config(context=(IIllustrationParagraph, IPyAMSLayer), provides=IParagraphSummary) -class IllustrationSummary(BaseContentProvider): - """Illustration renderer""" +@adapter_config(context=(IIllustrationParagraph, IPyAMSLayer), provides=IParagraphPreview) +class IllustrationPreview(BaseContentProvider): + """Illustration preview""" def __init__(self, context, request): - super(IllustrationSummary, self).__init__(context, request) + super(IllustrationPreview, self).__init__(context, request) self.renderer = self.context.get_renderer() language = None diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/component/paragraph/interfaces/__init__.py --- a/src/pyams_content/component/paragraph/interfaces/__init__.py Thu Feb 22 10:15:00 2018 +0100 +++ b/src/pyams_content/component/paragraph/interfaces/__init__.py Thu Feb 22 12:00:05 2018 +0100 @@ -87,7 +87,7 @@ value_type=Choice(vocabulary='PyAMS paragraph factories')) -class IParagraphSummary(IContentProvider): - """Paragraph summary renderer""" +class IParagraphPreview(IContentProvider): + """Paragraph preview renderer""" - language = Attribute("Summary language") + language = Attribute("Preview language") diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/component/paragraph/zmi/header.py --- a/src/pyams_content/component/paragraph/zmi/header.py Thu Feb 22 10:15:00 2018 +0100 +++ b/src/pyams_content/component/paragraph/zmi/header.py Thu Feb 22 12:00:05 2018 +0100 @@ -17,7 +17,7 @@ # import interfaces from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \ - IParagraphSummary + IParagraphPreview from pyams_content.component.paragraph.interfaces.header import IHeaderParagraph from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor, IParagraphContainerView from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION @@ -140,13 +140,13 @@ # -# HTML paragraph summary +# HTML paragraph preview # -@adapter_config(context=(IHeaderParagraph, IPyAMSLayer), provides=IParagraphSummary) -@template_config(template='templates/header-summary.pt', layer=IPyAMSLayer) -class HeaderParagraphSummary(BaseContentProvider): - """Header paragraph renderer""" +@adapter_config(context=(IHeaderParagraph, IPyAMSLayer), provides=IParagraphPreview) +@template_config(template='templates/header-preview.pt', layer=IPyAMSLayer) +class HeaderParagraphPreview(BaseContentProvider): + """Header paragraph preview""" language = None diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/component/paragraph/zmi/html.py --- a/src/pyams_content/component/paragraph/zmi/html.py Thu Feb 22 10:15:00 2018 +0100 +++ b/src/pyams_content/component/paragraph/zmi/html.py Thu Feb 22 12:00:05 2018 +0100 @@ -20,7 +20,7 @@ from pyams_content.component.association.zmi.interfaces import IAssociationsParentForm from pyams_content.component.illustration.interfaces import IIllustration from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \ - IParagraphSummary + IParagraphPreview from pyams_content.component.paragraph.interfaces.html import IHTMLParagraph, IRawParagraph from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor, IParagraphContainerView from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION @@ -146,13 +146,13 @@ # -# Raw HTML paragraph summary +# Raw HTML paragraph preview # -@adapter_config(context=(IRawParagraph, IPyAMSLayer), provides=IParagraphSummary) -@template_config(template='templates/raw-summary.pt', layer=IPyAMSLayer) -class RawParagraphSummary(BaseContentProvider): - """Raw HTML paragraph summary""" +@adapter_config(context=(IRawParagraph, IPyAMSLayer), provides=IParagraphPreview) +@template_config(template='templates/raw-preview.pt', layer=IPyAMSLayer) +class RawParagraphPreview(BaseContentProvider): + """Raw HTML paragraph preview""" language = None @@ -330,13 +330,13 @@ # -# Rich text paragraph summary +# Rich text paragraph preview # -@adapter_config(context=(IHTMLParagraph, IPyAMSLayer), provides=IParagraphSummary) -@template_config(template='templates/html-summary.pt', layer=IPyAMSLayer) -class HTMLParagraphSummary(BaseContentProvider): - """Rich text paragraph summary""" +@adapter_config(context=(IHTMLParagraph, IPyAMSLayer), provides=IParagraphPreview) +@template_config(template='templates/html-preview.pt', layer=IPyAMSLayer) +class HTMLParagraphPreview(BaseContentProvider): + """Rich text paragraph preview""" illustration = None illustration_renderer = None diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/component/paragraph/zmi/preview.py --- a/src/pyams_content/component/paragraph/zmi/preview.py Thu Feb 22 10:15:00 2018 +0100 +++ b/src/pyams_content/component/paragraph/zmi/preview.py Thu Feb 22 12:00:05 2018 +0100 @@ -17,16 +17,20 @@ # import interfaces from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \ - IParagraphSummary + IParagraphPreview from pyams_content.features.preview.zmi.interfaces import IPreviewForm from pyams_form.interfaces.form import IWidgetsSuffixViewletsManager from pyams_i18n.interfaces import II18nManager +from pyams_skin.interfaces import IUserSkinnable from pyams_skin.layer import IPyAMSLayer +from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION # import packages +from pyams_skin.skin import apply_skin from pyams_template.template import template_config -from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION +from pyams_utils.request import copy_request from pyams_viewlet.viewlet import viewlet_config, Viewlet +from pyramid.decorator import reify @viewlet_config(name='paragraphs-preview', context=IParagraphContainerTarget, layer=IPyAMSLayer, @@ -42,8 +46,17 @@ if para.visible] self.languages = II18nManager(self.context).get_languages() + @reify + def render_request(self): + request = copy_request(self.request) + root = self.request.root + skin = IUserSkinnable(root).get_skin() + if skin is not None: + apply_skin(request, skin) + return request + def render_paragraph(self, paragraph, language=None): - renderer = self.request.registry.queryMultiAdapter((paragraph, self.request), IParagraphSummary) + renderer = self.request.registry.queryMultiAdapter((paragraph, self.render_request), IParagraphPreview) if renderer is not None: renderer.language = language renderer.update() diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/component/paragraph/zmi/templates/header-preview.pt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_content/component/paragraph/zmi/templates/header-preview.pt Thu Feb 22 12:00:05 2018 +0100 @@ -0,0 +1,1 @@ +
header
diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/component/paragraph/zmi/templates/header-summary.pt --- a/src/pyams_content/component/paragraph/zmi/templates/header-summary.pt Thu Feb 22 10:15:00 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -
header
diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/component/paragraph/zmi/templates/html-preview.pt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_content/component/paragraph/zmi/templates/html-preview.pt Thu Feb 22 12:00:05 2018 +0100 @@ -0,0 +1,3 @@ +

title

+
body
+Illustration diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/component/paragraph/zmi/templates/html-summary.pt --- a/src/pyams_content/component/paragraph/zmi/templates/html-summary.pt Thu Feb 22 10:15:00 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -

title

-
body
-Illustration diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/component/paragraph/zmi/templates/raw-preview.pt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_content/component/paragraph/zmi/templates/raw-preview.pt Thu Feb 22 12:00:05 2018 +0100 @@ -0,0 +1,2 @@ +

title

+
body
diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/component/paragraph/zmi/templates/raw-summary.pt --- a/src/pyams_content/component/paragraph/zmi/templates/raw-summary.pt Thu Feb 22 10:15:00 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -

title

-
body
diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/component/paragraph/zmi/templates/video-preview.pt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_content/component/paragraph/zmi/templates/video-preview.pt Thu Feb 22 12:00:05 2018 +0100 @@ -0,0 +1,31 @@ +

title

+
body
+
Description
+
+ +
diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/component/paragraph/zmi/templates/video-summary.pt --- a/src/pyams_content/component/paragraph/zmi/templates/video-summary.pt Thu Feb 22 10:15:00 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -

title

-
body
-
Description
-
- -
diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/component/paragraph/zmi/video.py --- a/src/pyams_content/component/paragraph/zmi/video.py Thu Feb 22 10:15:00 2018 +0100 +++ b/src/pyams_content/component/paragraph/zmi/video.py Thu Feb 22 12:00:05 2018 +0100 @@ -18,7 +18,7 @@ # import interfaces from pyams_content.component.association.zmi.interfaces import IAssociationsParentForm from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \ - IParagraphSummary + IParagraphPreview from pyams_content.component.paragraph.interfaces.video import IVideoParagraph from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor, IParagraphContainerView from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION @@ -200,13 +200,13 @@ # -# Video summary +# Video paragraph preview # -@adapter_config(context=(IVideoParagraph, IPyAMSLayer), provides=IParagraphSummary) -@template_config(template='templates/video-summary.pt', layer=IPyAMSLayer) -class VideoParagraphSummary(BaseContentProvider): - """Video paragraph summary""" +@adapter_config(context=(IVideoParagraph, IPyAMSLayer), provides=IParagraphPreview) +@template_config(template='templates/video-preview.pt', layer=IPyAMSLayer) +class VideoParagraphPreview(BaseContentProvider): + """Video paragraph preview""" language = None diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/component/video/zmi/paragraph.py --- a/src/pyams_content/component/video/zmi/paragraph.py Thu Feb 22 10:15:00 2018 +0100 +++ b/src/pyams_content/component/video/zmi/paragraph.py Thu Feb 22 12:00:05 2018 +0100 @@ -16,8 +16,8 @@ # import standard library # import interfaces -from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, IBaseParagraph, \ - IParagraphSummary +from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \ + IBaseParagraph, IParagraphPreview from pyams_content.component.paragraph.zmi.interfaces import IParagraphContainerView, IParagraphInnerEditor from pyams_content.component.video.interfaces import IExternalVideoProvider, IExternalVideoSettings, \ IExternalVideoParagraph, IExternalVideoRenderer @@ -256,18 +256,18 @@ # -# Video paragraph summary +# Video paragraph preview # -@adapter_config(context=(IExternalVideoParagraph, IPyAMSLayer), provides=IParagraphSummary) -@template_config(template='templates/video-summary.pt', layer=IPyAMSLayer) -class ExternalVideoParagraphSummary(BaseContentProvider): - """External video paragraph summary""" +@adapter_config(context=(IExternalVideoParagraph, IPyAMSLayer), provides=IParagraphPreview) +@template_config(template='templates/video-preview.pt', layer=IPyAMSLayer) +class ExternalVideoParagraphPreview(BaseContentProvider): + """External video paragraph preview""" video_renderer = None def __init__(self, context, request): - super(ExternalVideoParagraphSummary, self).__init__(context, request) + super(ExternalVideoParagraphPreview, self).__init__(context, request) provider = context.get_provider() if provider is not None: registry = get_current_registry() diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/component/video/zmi/templates/video-preview.pt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_content/component/video/zmi/templates/video-preview.pt Thu Feb 22 12:00:05 2018 +0100 @@ -0,0 +1,7 @@ +

title

+
body
+
Description
+ diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/component/video/zmi/templates/video-summary.pt --- a/src/pyams_content/component/video/zmi/templates/video-summary.pt Thu Feb 22 10:15:00 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -

title

-
body
-
Description
- diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/shared/imagemap/zmi/paragraph.py --- a/src/pyams_content/shared/imagemap/zmi/paragraph.py Thu Feb 22 10:15:00 2018 +0100 +++ b/src/pyams_content/shared/imagemap/zmi/paragraph.py Thu Feb 22 12:00:05 2018 +0100 @@ -18,7 +18,7 @@ # import interfaces from pyams_content.component.association.interfaces import IAssociationInfo from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \ - IParagraphSummary + IParagraphPreview from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor, IParagraphContainerView from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION from pyams_content.shared.common.interfaces import IWfSharedContent @@ -154,13 +154,13 @@ # -# Image map paragraph summary +# Image map paragraph preview # -@adapter_config(context=(IImageMapParagraph, IPyAMSLayer), provides=IParagraphSummary) -@template_config(template='templates/paragraph-summary.pt', layer=IPyAMSLayer) -class ImagemapParagraphSummary(BaseContentProvider): - """Image map paragraph summary""" +@adapter_config(context=(IImageMapParagraph, IPyAMSLayer), provides=IParagraphPreview) +@template_config(template='templates/paragraph-preview.pt', layer=IPyAMSLayer) +class ImagemapParagraphPreview(BaseContentProvider): + """Image map paragraph preview""" language = None diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/shared/imagemap/zmi/templates/paragraph-preview.pt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_content/shared/imagemap/zmi/templates/paragraph-preview.pt Thu Feb 22 12:00:05 2018 +0100 @@ -0,0 +1,27 @@ +

title

+
+ + + + + + + + +
diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/shared/imagemap/zmi/templates/paragraph-summary.pt --- a/src/pyams_content/shared/imagemap/zmi/templates/paragraph-summary.pt Thu Feb 22 10:15:00 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -

title

-
- - - - - - - - -
diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/shared/logo/zmi/paragraph.py --- a/src/pyams_content/shared/logo/zmi/paragraph.py Thu Feb 22 10:15:00 2018 +0100 +++ b/src/pyams_content/shared/logo/zmi/paragraph.py Thu Feb 22 12:00:05 2018 +0100 @@ -17,7 +17,7 @@ # import interfaces from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \ - IParagraphSummary + IParagraphPreview from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION from pyams_content.shared.common import IWfSharedContent @@ -146,13 +146,13 @@ # -# Logos paragraph summary +# Logos paragraph preview # -@adapter_config(context=(ILogosParagraph, IPyAMSLayer), provides=IParagraphSummary) -@template_config(template='templates/paragraph-summary.pt', layer=IPyAMSLayer) -class LogosParagraphSummary(BaseContentProvider): - """Logos paragraph summary""" +@adapter_config(context=(ILogosParagraph, IPyAMSLayer), provides=IParagraphPreview) +@template_config(template='templates/paragraph-preview.pt', layer=IPyAMSLayer) +class LogosParagraphPreview(BaseContentProvider): + """Logos paragraph preview""" language = None diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/shared/logo/zmi/templates/paragraph-preview.pt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_content/shared/logo/zmi/templates/paragraph-preview.pt Thu Feb 22 12:00:05 2018 +0100 @@ -0,0 +1,14 @@ +

title

+
+ + + + + + + +
diff -r 9c147733c02e -r 5527bc086216 src/pyams_content/shared/logo/zmi/templates/paragraph-summary.pt --- a/src/pyams_content/shared/logo/zmi/templates/paragraph-summary.pt Thu Feb 22 10:15:00 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -

title

-
- - - - - - - -