--- a/src/pyams_content/component/gallery/interfaces/__init__.py Mon Oct 01 10:13:07 2018 +0200
+++ b/src/pyams_content/component/gallery/interfaces/__init__.py Mon Oct 01 10:13:54 2018 +0200
@@ -18,12 +18,13 @@
from zope.interface import Interface
from zope.schema import Bool, Choice, TextLine
-from pyams_content import _
from pyams_content.component.paragraph.interfaces import IBaseParagraph
from pyams_content.features.renderer.interfaces import IRenderedContent
from pyams_file.schema import AudioField, MediaField
from pyams_i18n.schema import I18nTextField, I18nTextLineField
+from pyams_content import _
+
GALLERY_CONTAINER_KEY = 'pyams_content.gallery'
GALLERY_RENDERERS = 'PyAMS.gallery.renderers'
--- a/src/pyams_content/component/gallery/zmi/file.py Mon Oct 01 10:13:07 2018 +0200
+++ b/src/pyams_content/component/gallery/zmi/file.py Mon Oct 01 10:13:54 2018 +0200
@@ -20,9 +20,8 @@
from zope.location import locate
from zope.schema.interfaces import WrongType
-from pyams_content import _
from pyams_content.component.gallery.file import GalleryFile
-from pyams_content.component.gallery.interfaces import GALLERY_FILE_HIDDEN_FIELDS, IGallery, IGalleryFile, \
+from pyams_content.component.gallery.interfaces import GALLERY_FILE_HIDDEN_FIELDS, IBaseGallery, IGalleryFile, \
IGalleryParagraph
from pyams_content.component.gallery.zmi.interfaces import IGalleryContentsView, IGalleryMediasAddFields
from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
@@ -47,8 +46,11 @@
from pyams_viewlet.viewlet import viewlet_config
from pyams_zmi.form import AdminDialogAddForm, AdminDialogEditForm
+from pyams_content import _
-@viewlet_config(name='add-media.menu', context=IGallery, view=IGalleryContentsView, manager=IWidgetTitleViewletManager)
+
+@viewlet_config(name='add-media.menu', context=IBaseGallery, view=IGalleryContentsView,
+ manager=IWidgetTitleViewletManager)
class GalleryMediaAddMenu(WfSharedContentPermissionMixin, ToolbarAction):
"""Gallery media add menu"""
@@ -59,8 +61,8 @@
stop_propagation = True
-@pagelet_config(name='add-media.html', context=IGallery, layer=IPyAMSLayer, permission=MANAGE_CONTENT_PERMISSION)
-@ajax_config(name='add-media.json', context=IGallery, layer=IPyAMSLayer, base=AJAXAddForm)
+@pagelet_config(name='add-media.html', context=IBaseGallery, layer=IPyAMSLayer, permission=MANAGE_CONTENT_PERMISSION)
+@ajax_config(name='add-media.json', context=IBaseGallery, layer=IPyAMSLayer, base=AJAXAddForm)
class GalleryMediaAddForm(AdminDialogAddForm):
"""Gallery media add form"""
@@ -182,7 +184,7 @@
@property
def title(self):
- gallery = get_parent(self.context, IGallery)
+ gallery = get_parent(self.context, IBaseGallery)
return II18n(gallery).query_attribute('title', request=self.request)
def updateGroups(self):
@@ -198,7 +200,7 @@
def get_ajax_output(self, changes):
output = super(self.__class__, self).get_ajax_output(changes)
if 'title' in changes.get(IGalleryFile, ()):
- gallery = get_parent(self.context, IGallery)
+ gallery = get_parent(self.context, IBaseGallery)
if gallery is not None:
output.setdefault('events', []).append({
'event': 'myams.refresh',
--- a/src/pyams_content/component/gallery/zmi/paragraph.py Mon Oct 01 10:13:07 2018 +0200
+++ b/src/pyams_content/component/gallery/zmi/paragraph.py Mon Oct 01 10:13:54 2018 +0200
@@ -20,7 +20,6 @@
from z3c.form.interfaces import INPUT_MODE
from zope.interface import Interface, implementer
-from pyams_content import _
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.file import GalleryMediaAddForm
@@ -50,6 +49,8 @@
from pyams_viewlet.viewlet import viewlet_config
from pyams_zmi.form import AdminDialogAddForm, InnerAdminDisplayForm
+from pyams_content import _
+
@viewlet_config(name='add-gallery.menu', context=IParagraphContainerTarget, view=IParagraphContainerView,
layer=IPyAMSLayer, manager=IToolbarAddingMenu, weight=65)