--- a/src/pyams_content/component/gallery/zmi/__init__.py Fri Dec 14 14:44:31 2018 +0100
+++ b/src/pyams_content/component/gallery/zmi/__init__.py Fri Dec 14 18:11:21 2018 +0100
@@ -9,10 +9,6 @@
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
-from pyams_content.component.gallery.zmi.paragraph import ParagraphContainerGalleryMarker, GalleryInnerEditForm
-from pyams_content.component.paragraph import IBaseParagraph
-from pyams_content.component.paragraph.zmi import get_json_paragraph_markers_refresh_event
-
__docformat__ = 'restructuredtext'
@@ -28,9 +24,10 @@
from z3c.form import field
from zope.interface import Interface, implementer
-from pyams_content import _
from pyams_content.component.gallery.interfaces import IBaseGallery, IGallery
from pyams_content.component.gallery.zmi.interfaces import IGalleryContentsView
+from pyams_content.component.paragraph import IBaseParagraph
+from pyams_content.component.paragraph.zmi import get_json_paragraph_markers_refresh_event
from pyams_content.features.renderer.zmi.widget import RendererFieldWidget
from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
from pyams_content.shared.common.zmi import WfSharedContentPermissionMixin
@@ -46,6 +43,8 @@
from pyams_viewlet.viewlet import Viewlet, viewlet_config
from pyams_zmi.form import AdminDialogDisplayForm, AdminDialogEditForm
+from pyams_content import _
+
#
# Gallery properties
@@ -146,6 +145,8 @@
media.visible = not media.visible
result = {'visible': media.visible}
if IBaseParagraph.providedBy(gallery):
+ from pyams_content.component.gallery.zmi.paragraph import \
+ GalleryInnerEditForm, ParagraphContainerGalleryMarker
form = GalleryInnerEditForm(gallery, request)
form.update()
result.update({
--- a/src/pyams_content/component/gallery/zmi/paragraph.py Fri Dec 14 14:44:31 2018 +0100
+++ b/src/pyams_content/component/gallery/zmi/paragraph.py Fri Dec 14 18:11:21 2018 +0100
@@ -23,6 +23,7 @@
from pyams_content.component.gallery import IBaseGallery
from pyams_content.component.gallery.interfaces import GALLERY_PARAGRAPH_TYPE, IGalleryParagraph
from pyams_content.component.gallery.paragraph import Gallery
+from pyams_content.component.gallery.zmi import GalleryMediasView
from pyams_content.component.gallery.zmi.file import GalleryMediaAddForm
from pyams_content.component.gallery.zmi.interfaces import IGalleryContentsView
from pyams_content.component.paragraph.interfaces import IParagraphContainer, IParagraphContainerTarget
@@ -185,9 +186,10 @@
def get_ajax_output(self, changes):
ITransactionManager(self.context).commit()
medias = []
+ view = GalleryMediasView(self.context, self.request)
for media in changes:
medias.append(render('templates/gallery-media.pt',
- {'media': media}, request=self.request))
+ {'media': media, 'view': view}, request=self.request))
output = {
'status': 'success',
'message': self.request.localizer.translate(_("Media(s) successfully added")),
--- a/src/pyams_content/component/gallery/zmi/templates/gallery-media.pt Fri Dec 14 14:44:31 2018 +0100
+++ b/src/pyams_content/component/gallery/zmi/templates/gallery-media.pt Fri Dec 14 18:11:21 2018 +0100
@@ -19,10 +19,10 @@
margin_top 64 - image_size[1] / 2;
title i18n:media.title;
src tales:absolute_url(thumbnail);"
- tal:attributes="src string:${src}?_=${tales:timestamp(thumbnail)};
- id 'media_{0}_{1}'.format(context.__name__, media.__name__);
- original-title title or '--';
- style string:margin-left: ${margin_left}px;; margin-right: ${margin_left}px;; margin-top: ${margin_top}px;; margin-bottom: ${margin_top}px;;" />
+ src="${src}?_=${tales:timestamp(thumbnail)}"
+ id="${'media_{0}_{1}'.format(context.__name__, media.__name__)}"
+ original-title="${title or '--'}"
+ style="margin: ${margin_top}px ${margin_left}px ${margin_top}px ${margin_left}px;" />
</a>
</tal:if>
<tal:if condition="not:media.data.content_type.startswith('image/')">
@@ -36,10 +36,10 @@
tal:attributes="href target" data-toggle="modal">
<img class="thumbnail no-border"
data-ams-hint-gravity="s"
- tal:attributes="src tales:absolute_url(thumbnail);
- id 'media_{0}_{1}'.format(context.__name__, media.__name__);
- original-title title or '--';
- style string:margin-left: ${margin_left}px;; margin-right: ${margin_left}px;; margin-top: ${margin_top}px;; margin-bottom: ${margin_top}px;;" />
+ src="${tales:absolute_url(thumbnail)}"
+ id="${'media_{0}_{1}'.format(context.__name__, media.__name__)}"
+ original-title="${title or '--'}"
+ style="margin: ${margin_top}px ${margin_left}px ${margin_top}px ${margin_left}px;" />
</a>
</tal:if>
</tal:if>