--- a/src/pyams_content/component/association/zmi/__init__.py Wed Jun 13 17:47:03 2018 +0200
+++ b/src/pyams_content/component/association/zmi/__init__.py Thu Jun 14 10:41:32 2018 +0200
@@ -121,13 +121,12 @@
target = get_parent(self.context, IAssociationContainerTarget)
container = registry.getAdapter(target, IAssociationContainer, name=self.associations_name)
attributes = super(AssociationsTable, self).data_attributes
- attributes['table'] = {
- 'id': self.id,
+ attributes.setdefault('table', {}).update({
'data-ams-location': absolute_url(container, self.request),
'data-ams-tablednd-drag-handle': 'td.sorter',
'data-ams-tablednd-drop-target': 'set-associations-order.json',
'data-ams-visibility-switcher': 'switch-association-visibility.json'
- }
+ })
return attributes
@reify
--- a/src/pyams_content/component/keynumber/__init__.py Wed Jun 13 17:47:03 2018 +0200
+++ b/src/pyams_content/component/keynumber/__init__.py Thu Jun 14 10:41:32 2018 +0200
@@ -9,27 +9,7 @@
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
-from pyramid.events import subscriber
-from zope.container.contained import Contained
-from zope.container.ordered import OrderedContainer
-from zope.lifecycleevent import ObjectModifiedEvent
-from zope.lifecycleevent.interfaces import IObjectAddedEvent, IObjectModifiedEvent, IObjectRemovedEvent
-from zope.location.interfaces import ISublocations
-from zope.location.location import locate
-from zope.schema.fieldproperty import FieldProperty
-from zope.traversing.interfaces import ITraversable
-from pyams_catalog.utils import index_object
-from pyams_content.component.keynumber.interfaces import IKeyNumber, IKeyNumberContainerTarget, IKeyNumberContainer, \
- KEYNUMBER_CONTAINER_KEY
-from pyams_content.features.checker import BaseContentChecker
-from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE
-from pyams_form.interfaces.form import IFormContextPermissionChecker
-from pyams_i18n.interfaces import II18n, II18nManager, INegotiator
-from pyams_utils.adapter import adapter_config, ContextAdapter, get_annotation_adapter
-from pyams_utils.registry import get_current_registry, get_utility
-from pyams_utils.request import check_request
-from pyams_utils.traversing import get_parent
__docformat__ = 'restructuredtext'
@@ -37,10 +17,30 @@
# import standard library
# import interfaces
+from pyams_content.component.keynumber.interfaces import IKeyNumber, IKeyNumberContainerTarget, IKeyNumberContainer, \
+ KEYNUMBER_CONTAINER_KEY
+from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE
+from pyams_form.interfaces.form import IFormContextPermissionChecker
+from pyams_i18n.interfaces import II18n, II18nManager, INegotiator
+from zope.lifecycleevent.interfaces import IObjectAddedEvent, IObjectModifiedEvent, IObjectRemovedEvent
+from zope.location.interfaces import ISublocations
+from zope.traversing.interfaces import ITraversable
# import packages
+from pyams_catalog.utils import index_object
+from pyams_content.features.checker import BaseContentChecker
+from pyams_utils.adapter import adapter_config, ContextAdapter, get_annotation_adapter
+from pyams_utils.registry import get_current_registry, get_utility
+from pyams_utils.request import check_request
+from pyams_utils.traversing import get_parent
from persistent import Persistent
+from pyramid.events import subscriber
+from zope.container.contained import Contained
+from zope.container.ordered import OrderedContainer
from zope.interface import implementer
+from zope.lifecycleevent import ObjectModifiedEvent
+from zope.location.location import locate
+from zope.schema.fieldproperty import FieldProperty
from pyams_content import _
--- a/src/pyams_content/component/keynumber/zmi/__init__.py Wed Jun 13 17:47:03 2018 +0200
+++ b/src/pyams_content/component/keynumber/zmi/__init__.py Thu Jun 14 10:41:32 2018 +0200
@@ -9,23 +9,29 @@
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
-from pyramid.decorator import reify
-from pyramid.view import view_config
-from z3c.table.column import GetAttrColumn
+
+__docformat__ = 'restructuredtext'
+
+
+# import standard library
+import json
+
+# import interfaces
+from pyams_content.component.keynumber.interfaces import IKeyNumberContainer, IKeyNumberContainerTarget, IKeyNumber
+from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
+from pyams_form.interfaces.form import IInnerSubForm
+from pyams_skin.interfaces.viewlet import IWidgetTitleViewletManager
+from pyams_skin.layer import IPyAMSLayer
from z3c.table.interfaces import IValues, IColumn
-from pyams_content.component.keynumber import IKeyNumberContainer, IKeyNumberContainerTarget, IKeyNumber, KeyNumber
-from pyams_content.component.paragraph import IParagraphContainerTarget
-from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
+# import packages
+from pyams_content.component.keynumber import KeyNumber
from pyams_form.form import ajax_config, AJAXAddForm
-from pyams_form.interfaces.form import IInnerSubForm
from pyams_form.security import ProtectedFormObjectMixin
from pyams_i18n.column import I18nAttrColumn
from pyams_pagelet.pagelet import pagelet_config
from pyams_skin.container import switch_element_visibility
from pyams_skin.event import get_json_table_row_refresh_event, get_json_switched_table_refresh_event
-from pyams_skin.interfaces.viewlet import IWidgetTitleViewletManager
-from pyams_skin.layer import IPyAMSLayer
from pyams_skin.table import BaseTable, SorterColumn, VisibilitySwitcherColumn, I18nColumn, TrashColumn
from pyams_skin.viewlet.toolbar import ToolbarAction
from pyams_utils.adapter import adapter_config, ContextRequestViewAdapter
@@ -34,22 +40,19 @@
from pyams_viewlet.viewlet import viewlet_config
from pyams_zmi.form import AdminDialogAddForm, AdminDialogEditForm
from pyams_zmi.zmi.table import InnerTableView
-
-__docformat__ = 'restructuredtext'
-
-
-# import standard library
-import json
-
-# import interfaces
-
-# import packages
+from pyramid.decorator import reify
+from pyramid.view import view_config
from z3c.form import field
+from z3c.table.column import GetAttrColumn
from zope.interface import implementer, Interface
from pyams_content import _
+#
+# Views marker interfaces
+#
+
class IKeyNumbersView(Interface):
"""Key numbers view marker interface"""
@@ -68,9 +71,14 @@
prefix = 'keynumbers'
hide_header = True
+ hide_body_toolbar = True
sortOn = None
- @property
+ @classmethod
+ def get_context(cls, context):
+ return IKeyNumberContainer(context)
+
+ @reify
def cssClasses(self):
classes = ['table', 'table-bordered', 'table-striped', 'table-hover', 'table-tight']
permission = self.permission
@@ -78,15 +86,16 @@
classes.append('table-dnd')
return {'table': ' '.join(classes)}
- @property
+ @reify
def data_attributes(self):
+ container = IKeyNumberContainer(self.context)
attributes = super(KeyNumbersTable, self).data_attributes
- attributes['table'] = {
- 'data-ams-location': absolute_url(IKeyNumberContainer(self.context), self.request),
+ attributes.setdefault('table', {}).update({
+ 'data-ams-location': absolute_url(container, self.request),
'data-ams-tablednd-drag-handle': 'td.sorter',
'data-ams-tablednd-drop-target': 'set-keynumbers-order.json',
'data-ams-visibility-switcher': 'switch-keynumber-visibility.json'
- }
+ })
return attributes
@reify
@@ -94,7 +103,7 @@
return list(super(KeyNumbersTable, self).values)
-@adapter_config(context=(IKeyNumberContainerTarget, IPyAMSLayer, KeyNumbersTable), provides=IValues)
+@adapter_config(context=(IKeyNumberContainer, IPyAMSLayer, KeyNumbersTable), provides=IValues)
class KeyNumbersTableValuesAdapter(ContextRequestViewAdapter):
"""Key numbers table values adapter"""
@@ -103,7 +112,7 @@
return IKeyNumberContainer(self.context).values()
-@adapter_config(name='sorter', context=(IKeyNumberContainerTarget, IPyAMSLayer, KeyNumbersTable), provides=IColumn)
+@adapter_config(name='sorter', context=(IKeyNumberContainer, IPyAMSLayer, KeyNumbersTable), provides=IColumn)
class KeyNumbersTableSorterColumn(ProtectedFormObjectMixin, SorterColumn):
"""Key numbers table sorter column"""
@@ -117,7 +126,7 @@
return {'status': 'success'}
-@adapter_config(name='show-hide', context=(IKeyNumberContainerTarget, IPyAMSLayer, KeyNumbersTable),
+@adapter_config(name='show-hide', context=(IKeyNumberContainer, IPyAMSLayer, KeyNumbersTable),
provides=IColumn)
class KeyNumbersTableShowHideColumn(ProtectedFormObjectMixin, VisibilitySwitcherColumn):
"""Key numbers container visibility switcher column"""
@@ -130,7 +139,7 @@
return switch_element_visibility(request, IKeyNumberContainer)
-@adapter_config(name='label', context=(IKeyNumberContainerTarget, IPyAMSLayer, KeyNumbersTable), provides=IColumn)
+@adapter_config(name='label', context=(IKeyNumberContainer, IPyAMSLayer, KeyNumbersTable), provides=IColumn)
class KeyNumbersTableLabelColumn(I18nColumn, I18nAttrColumn):
"""Key numbers table label column"""
@@ -142,7 +151,7 @@
return super(KeyNumbersTableLabelColumn, self).getValue(obj) or '--'
-@adapter_config(name='name', context=(IKeyNumberContainerTarget, IPyAMSLayer, KeyNumbersTable), provides=IColumn)
+@adapter_config(name='name', context=(IKeyNumberContainer, IPyAMSLayer, KeyNumbersTable), provides=IColumn)
class KeyNumbersTableNameColumn(I18nColumn, GetAttrColumn):
"""Key numbers table number column"""
@@ -151,7 +160,7 @@
weight = 20
-@adapter_config(name='unit', context=(IKeyNumberContainerTarget, IPyAMSLayer, KeyNumbersTable), provides=IColumn)
+@adapter_config(name='unit', context=(IKeyNumberContainer, IPyAMSLayer, KeyNumbersTable), provides=IColumn)
class KeyNumbersTableUnitColumn(I18nColumn, I18nAttrColumn):
"""Key numbers table unit column"""
@@ -163,7 +172,7 @@
return super(KeyNumbersTableUnitColumn, self).getValue(obj) or '--'
-@adapter_config(name='text', context=(IKeyNumberContainerTarget, IPyAMSLayer, KeyNumbersTable), provides=IColumn)
+@adapter_config(name='text', context=(IKeyNumberContainer, IPyAMSLayer, KeyNumbersTable), provides=IColumn)
class KeyNumbersTableTextColumn(I18nColumn, I18nAttrColumn):
"""Key numbers table text column"""
@@ -175,7 +184,7 @@
return super(KeyNumbersTableTextColumn, self).getValue(obj) or '--'
-@adapter_config(name='trash', context=(IKeyNumberContainerTarget, IPyAMSLayer, KeyNumbersTable), provides=IColumn)
+@adapter_config(name='trash', context=(IKeyNumberContainer, IPyAMSLayer, KeyNumbersTable), provides=IColumn)
class KeyNumbersTableTrashColumn(ProtectedFormObjectMixin, TrashColumn):
"""Key numbers table trash column"""
@@ -191,6 +200,10 @@
table_class = KeyNumbersTable
weight = 110
+ @property
+ def actions_context(self): # define context for internal actions
+ return IKeyNumberContainer(self.context)
+
#
# Key numbers forms
@@ -207,9 +220,9 @@
modal_target = True
-@pagelet_config(name='add-keynumber.html', context=IKeyNumberContainerTarget, layer=IPyAMSLayer,
+@pagelet_config(name='add-keynumber.html', context=IKeyNumberContainer, layer=IPyAMSLayer,
permission=MANAGE_CONTENT_PERMISSION)
-@ajax_config(name='add-keynumber.json', context=IParagraphContainerTarget, layer=IPyAMSLayer,
+@ajax_config(name='add-keynumber.json', context=IKeyNumberContainer, layer=IPyAMSLayer,
base=AJAXAddForm)
class KeyNumberAddForm(AdminDialogAddForm):
"""Key number add form"""
@@ -230,7 +243,9 @@
return {
'status': 'success',
'message': self.request.localizer.translate(_("Key number was correctly added")),
- 'events': [get_json_switched_table_refresh_event(self.context, self.request, KeyNumbersTable), ]
+ 'events': [
+ get_json_switched_table_refresh_event(self.context, self.request, KeyNumbersTable)
+ ]
}
--- a/src/pyams_content/component/paragraph/zmi/container.py Wed Jun 13 17:47:03 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/container.py Thu Jun 14 10:41:32 2018 +0200
@@ -101,7 +101,6 @@
def data_attributes(self):
attributes = super(ParagraphContainerBaseTable, self).data_attributes
attributes.setdefault('table', {}).update({
- 'id': self.id,
'data-ams-plugins': 'pyams_content',
'data-ams-plugin-pyams_content-src': get_resource_path(pyams_content),
'data-ams-location': absolute_url(IParagraphContainer(self.context), self.request),
--- a/src/pyams_content/component/paragraph/zmi/keynumber.py Wed Jun 13 17:47:03 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/keynumber.py Thu Jun 14 10:41:32 2018 +0200
@@ -82,6 +82,7 @@
permission=MANAGE_CONTENT_PERMISSION)
@ajax_config(name='properties.json', context=IKeyNumberParagraph, layer=IPyAMSLayer,
base=BaseParagraphAJAXEditForm)
+@implementer(IKeyNumbersParentForm)
class KeyNumberParagraphPropertiesEditForm(BaseParagraphPropertiesEditForm):
"""Key number paragraph properties edit form"""
--- a/src/pyams_content/features/alert/zmi/container.py Wed Jun 13 17:47:03 2018 +0200
+++ b/src/pyams_content/features/alert/zmi/container.py Thu Jun 14 10:41:32 2018 +0200
@@ -71,7 +71,6 @@
def data_attributes(self):
attributes = super(AlertContainerTable, self).data_attributes
attributes.setdefault('table', {}).update({
- 'id': self.id,
'data-ams-plugins': 'pyams_content',
'data-ams-plugin-pyams_content-src': get_resource_path(pyams_content),
'data-ams-location': absolute_url(IAlertContainer(self.context), self.request),
--- a/src/pyams_content/features/menu/zmi/__init__.py Wed Jun 13 17:47:03 2018 +0200
+++ b/src/pyams_content/features/menu/zmi/__init__.py Thu Jun 14 10:41:32 2018 +0200
@@ -163,7 +163,6 @@
menus = getattr(self.context, self.associations_name)
attributes = super(MenusTable, self).data_attributes
attributes.setdefault('table', {}).update({
- 'id': self.id,
'data-ams-location': absolute_url(menus, self.request),
'data-ams-tablednd-drag-handle': 'td.sorter',
'data-ams-tablednd-drop-target': 'set-menus-order.json',
--- a/src/pyams_content/portlet/content/interfaces/__init__.py Wed Jun 13 17:47:03 2018 +0200
+++ b/src/pyams_content/portlet/content/interfaces/__init__.py Thu Jun 14 10:41:32 2018 +0200
@@ -16,9 +16,9 @@
# import standard library
# import interfaces
+from pyams_portal.interfaces import IPortletSettings
# import packages
-from pyams_portal.interfaces import IPortletSettings
class ISharedContentPortletSettings(IPortletSettings):
--- a/src/pyams_content/portlet/content/zmi/preview.pt Wed Jun 13 17:47:03 2018 +0200
+++ b/src/pyams_content/portlet/content/zmi/preview.pt Thu Jun 14 10:41:32 2018 +0200
@@ -1,13 +1,3 @@
<tal:var define="settings view.settings" i18n:domain="pyams_content">
- <tal:if condition="settings.visible">
- <span class="padding-5" i18n:translate="">This is where the content will be displayed!!</span>
- </tal:if>
- <tal:if condition="not settings.visible">
- <div class="text-center padding-y-5">
- <span class="fa-stack fa-lg">
- <i class="fa fa-eye fa-stack-1x"></i>
- <i class="fa fa-ban fa-stack-2x text-danger"></i>
- </span>
- </div>
- </tal:if>
+ <span class="padding-5" i18n:translate="">This is where the content will be displayed!!</span>
</tal:var>
--- a/src/pyams_content/shared/imagemap/zmi/container.py Wed Jun 13 17:47:03 2018 +0200
+++ b/src/pyams_content/shared/imagemap/zmi/container.py Thu Jun 14 10:41:32 2018 +0200
@@ -90,7 +90,6 @@
def data_attributes(self):
attributes = super(ImagemapAreasTable, self).data_attributes
attributes.setdefault('table', {}).update({
- 'id': self.id,
'data-ams-location': absolute_url(self.context, self.request),
'data-ams-datatable-sort': 'false',
'data-ams-datatable-pagination': 'false'
--- a/src/pyams_content/shared/view/portlet/zmi/templates/view-items-list-preview.pt Wed Jun 13 17:47:03 2018 +0200
+++ b/src/pyams_content/shared/view/portlet/zmi/templates/view-items-list-preview.pt Thu Jun 14 10:41:32 2018 +0200
@@ -1,22 +1,12 @@
<tal:var define="settings view.settings">
- <tal:if condition="settings.visible">
- <tal:var define="items settings.get_items(context)">
- <tal:if condition="items">
- <div tal:repeat="item items">
- <tal:var content="i18n:item.title" />
- </div>
- </tal:if>
- <tal:if condition="not:items" i18n:translate="">
- No result found
- </tal:if>
- </tal:var>
- </tal:if>
- <tal:if condition="not settings.visible">
- <div class="text-center padding-y-5">
- <span class="fa-stack fa-lg">
- <i class="fa fa-eye fa-stack-1x"></i>
- <i class="fa fa-ban fa-stack-2x text-danger"></i>
- </span>
- </div>
- </tal:if>
+ <tal:var define="items settings.get_items(context)">
+ <tal:if condition="items">
+ <div tal:repeat="item items">
+ <tal:var content="i18n:item.title" />
+ </div>
+ </tal:if>
+ <tal:if condition="not:items" i18n:translate="">
+ No result found
+ </tal:if>
+ </tal:var>
</tal:var>