# HG changeset patch # User Thierry Florac # Date 1505812272 -7200 # Node ID 483b0f16e9a6631eaa1fe6b4369a6b45a8b505ba # Parent 0d80c3c49bab3358821579f8f94996d1b8535e13 Use new 'ContainerAdminView' base class diff -r 0d80c3c49bab -r 483b0f16e9a6 src/pyams_content/component/paragraph/zmi/container.py --- a/src/pyams_content/component/paragraph/zmi/container.py Tue Sep 19 11:10:46 2017 +0200 +++ b/src/pyams_content/component/paragraph/zmi/container.py Tue Sep 19 11:11:12 2017 +0200 @@ -9,7 +9,6 @@ # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # -from pyams_content.component.association.zmi import AssociationsContainerView __docformat__ = 'restructuredtext' @@ -35,6 +34,7 @@ from zope.contentprovider.interfaces import IContentProvider # import packages +from pyams_content.component.association.zmi import AssociationsContainerView from pyams_content.shared.common.zmi import WfModifiedContentColumnMixin from pyams_form.security import ProtectedFormObjectMixin from pyams_pagelet.pagelet import pagelet_config @@ -48,7 +48,7 @@ from pyramid.exceptions import NotFound from pyramid.view import view_config from pyams_viewlet.viewlet import viewlet_config, Viewlet -from pyams_zmi.view import AdminView +from pyams_zmi.view import AdminView, ContainerAdminView from pyramid.decorator import reify from z3c.table.column import GetAttrColumn from zope.interface import implementer @@ -70,24 +70,6 @@ # Paragraphs container view # -@pagelet_config(name='paragraphs.html', context=IParagraphContainerTarget, layer=IPyAMSLayer, - permission=VIEW_SYSTEM_PERMISSION) -@template_config(template='templates/container.pt', layer=IPyAMSLayer) -@implementer(IInnerPage) -class ParagraphContainerView(AdminView): - """Paragraphs container view""" - - title = _("Paragraphs list") - - def __init__(self, context, request): - super(ParagraphContainerView, self).__init__(context, request) - self.table = ParagraphContainerTable(context, request, self) - - def update(self): - super(ParagraphContainerView, self).update() - self.table.update() - - class ParagraphContainerTable(ProtectedFormObjectMixin, BaseTable): """Paragraphs container table""" @@ -95,10 +77,6 @@ hide_header = True sortOn = None - def __init__(self, context, request, view): - super(ParagraphContainerTable, self).__init__(context, request) - self.view = view - @property def cssClasses(self): classes = ['table', 'table-bordered', 'table-striped', 'table-hover', 'table-tight'] @@ -179,6 +157,15 @@ return self.request.localizer.translate(item.icon_hint) +@pagelet_config(name='paragraphs.html', context=IParagraphContainerTarget, layer=IPyAMSLayer, + permission=VIEW_SYSTEM_PERMISSION) +class ParagraphContainerView(ContainerAdminView): + """Paragraphs container view""" + + title = _("Paragraphs list") + table_class = ParagraphContainerTable + + @adapter_config(context=ParagraphContainerShowHideColumn, provides=IFormSecurityContext) def ShowHideColumnSecurityContextFactory(column): """Show/hide column security context factory""" diff -r 0d80c3c49bab -r 483b0f16e9a6 src/pyams_content/component/paragraph/zmi/templates/container.pt --- a/src/pyams_content/component/paragraph/zmi/templates/container.pt Tue Sep 19 11:10:46 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -
-
- - -

- - -
-
- -
-