# HG changeset patch # User Thierry Florac # Date 1510763147 -3600 # Node ID c31da1985a3b907af5888b36915cd45a03f156c4 # Parent f78a3411bf62b0b3d32aeb7325430e7863af2b3c Added interface and adapter for dashboard search header diff -r f78a3411bf62 -r c31da1985a3b src/pyams_content/shared/common/interfaces/zmi.py --- a/src/pyams_content/shared/common/interfaces/zmi.py Wed Nov 15 17:05:38 2017 +0100 +++ b/src/pyams_content/shared/common/interfaces/zmi.py Wed Nov 15 17:25:47 2017 +0100 @@ -17,17 +17,21 @@ # import interfaces from pyams_skin.interfaces.container import ITable -from pyams_skin.layer import IPyAMSLayer # import packages -from pyams_template.template import layout_config -from zope.interface import Interface +from zope.interface import Interface, Attribute class IDashboardTable(ITable): """Base dashboard table marker interface""" +class IDashboardSearchHeader(Interface): + """Dashboard search header adapter""" + + title = Attribute("Header title") + + class ISharedToolDashboardTable(IDashboardTable): """Shared tool dashboard table marker interface""" diff -r f78a3411bf62 -r c31da1985a3b src/pyams_content/shared/common/zmi/dashboard.py --- a/src/pyams_content/shared/common/zmi/dashboard.py Wed Nov 15 17:05:38 2017 +0100 +++ b/src/pyams_content/shared/common/zmi/dashboard.py Wed Nov 15 17:25:47 2017 +0100 @@ -20,7 +20,8 @@ from pyams_content.interfaces import MANAGE_SITE_ROOT_PERMISSION, PUBLISH_CONTENT_PERMISSION from pyams_content.profile.interfaces import IAdminProfile from pyams_content.shared.common.interfaces import IBaseSharedTool, IWfSharedContent, IManagerRestrictions -from pyams_content.shared.common.interfaces.zmi import IDashboardTable, ISharedToolDashboardTable +from pyams_content.shared.common.interfaces.zmi import IDashboardTable, ISharedToolDashboardTable, \ + IDashboardSearchHeader from pyams_content.zmi.interfaces import IDashboardMenu, IMyDashboardMenu, IAllContentsMenu from pyams_i18n.interfaces import II18n from pyams_security.interfaces import ISecurityManager @@ -284,6 +285,18 @@ super(SharedToolDashboardView, self).update() [table.update() for table in self.tables] + @property + def header_title(self): + registry = self.request.registry + adapter = registry.queryMultiAdapter((self.context, self.request, self), IDashboardSearchHeader) + if adapter is not None: + return adapter.title + else: + translate = self.request.localizer.translate + return translate(_("SEARCH - Between all contents of type « {type} »")).format( + type=II18n(self.context).query_attribute('title', request=self.request) + ) + @adapter_config(context=(IBaseSharedTool, IPyAMSLayer, SharedToolDashboardView), provides=IPageHeader) class SharedToolDashboardHeaderAdapter(DefaultPageHeaderAdapter): diff -r f78a3411bf62 -r c31da1985a3b src/pyams_content/shared/common/zmi/templates/dashboard.pt --- a/src/pyams_content/shared/common/zmi/templates/dashboard.pt Wed Nov 15 17:05:38 2017 +0100 +++ b/src/pyams_content/shared/common/zmi/templates/dashboard.pt Wed Nov 15 17:25:47 2017 +0100 @@ -15,8 +15,7 @@
-

SEARCH - Between all contents of type « type »

+

SEARCH - Between all contents of type