--- a/src/pyams_thesaurus/zmi/thesaurus.py Mon Sep 11 14:18:46 2017 +0200
+++ b/src/pyams_thesaurus/zmi/thesaurus.py Mon Sep 11 14:23:39 2017 +0200
@@ -20,15 +20,17 @@
# import interfaces
from pyams_form.interfaces.form import IWidgetForm
+from pyams_i18n.interfaces import II18n
from pyams_skin.interfaces import IPageHeader, IInnerPage
from pyams_skin.interfaces.container import ITableElementName, ITableElementEditor
-from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
-from pyams_thesaurus.interfaces import ADMIN_THESAURUS_PERMISSION, MANAGE_THESAURUS_EXTRACT_PERMISSION
+from pyams_skin.interfaces.viewlet import IToolbarAddingMenu, IMenuHeader, IBreadcrumbItem
+from pyams_thesaurus.interfaces import ADMIN_THESAURUS_PERMISSION, MANAGE_THESAURUS_EXTRACT_PERMISSION, \
+ CREATE_THESAURUS_PERMISSION
from pyams_thesaurus.interfaces.loader import IThesaurusLoader, IThesaurusUpdaterConfiguration, \
IThesaurusExporterConfiguration, IThesaurusExporter
from pyams_thesaurus.interfaces.thesaurus import IThesaurusInfo, IThesaurus, IThesaurusExtracts
from pyams_thesaurus.zmi.interfaces import IThesaurusTermsMenu, IThesaurusView
-from pyams_utils.interfaces import VIEW_PERMISSION, VIEW_SYSTEM_PERMISSION, MANAGE_SYSTEM_PERMISSION
+from pyams_utils.interfaces import VIEW_PERMISSION, VIEW_SYSTEM_PERMISSION
from pyams_utils.interfaces.tree import INode, ITree
from pyams_zmi.interfaces.menu import ISiteManagementMenu, IPropertiesMenu
from pyams_zmi.layer import IAdminLayer
@@ -41,6 +43,7 @@
from pyams_skin.layer import IPyAMSLayer
from pyams_skin.page import DefaultPageHeaderAdapter
from pyams_skin.table import DefaultElementEditorAdapter
+from pyams_skin.viewlet.breadcrumb import BreadcrumbItem
from pyams_skin.viewlet.menu import MenuItem
from pyams_skin.viewlet.toolbar import ToolbarMenuItem
from pyams_template.template import template_config
@@ -70,6 +73,24 @@
from pyams_thesaurus import _
+@adapter_config(context=(IThesaurus, ISiteManagementMenu), provides=IMenuHeader)
+class ThesaurusMenuHeader(ContextRequestAdapter):
+ """Thesaurus menu header adapter"""
+
+ header = _("This thesaurus")
+
+
+@adapter_config(context=(IThesaurus, IPyAMSLayer), provides=IBreadcrumbItem)
+class ThesaurusBreadcrumbAdapter(BreadcrumbItem):
+ """Thesaurus breadcrumb adapter"""
+
+ @property
+ def label(self):
+ return II18n(self.context).query_attribute('title', request=self.request)
+
+ css_class = 'strong'
+
+
@adapter_config(context=(IThesaurus, IAdminLayer), provides=ITableElementName)
class ThesaurusNameAdapter(ContextRequestAdapter):
"""Thesaurus name adapter"""
@@ -81,7 +102,7 @@
@viewlet_config(name='add-thesaurus.menu', context=ISite, layer=IAdminLayer,
- view=UtilitiesTable, manager=IToolbarAddingMenu, permission=MANAGE_SYSTEM_PERMISSION)
+ view=UtilitiesTable, manager=IToolbarAddingMenu, permission=CREATE_THESAURUS_PERMISSION)
class ThesaurusAddMenu(ToolbarMenuItem):
"""Thesaurus add menu"""
@@ -91,7 +112,7 @@
modal_target = True
-@pagelet_config(name='add-thesaurus.html', context=ISite, layer=IPyAMSLayer, permission=MANAGE_SYSTEM_PERMISSION)
+@pagelet_config(name='add-thesaurus.html', context=ISite, layer=IPyAMSLayer, permission=CREATE_THESAURUS_PERMISSION)
class ThesaurusAddForm(AdminDialogAddForm):
"""Thesaurus add form"""
@@ -133,7 +154,7 @@
@view_config(name='add-thesaurus.json', context=ISite, request_type=IPyAMSLayer,
- permission=MANAGE_SYSTEM_PERMISSION, renderer='json', xhr=True)
+ permission=CREATE_THESAURUS_PERMISSION, renderer='json', xhr=True)
class ThesaurusAJAXAddForm(AJAXAddForm, ThesaurusAddForm):
"""Thesaurus add form, AJAX view"""