diff --git a/CHANGES.rst b/CHANGES.rst index 74e86cca32..4851a0d7ac 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -7,6 +7,7 @@ Changelog **Added** +- #1529 Moved contentmenu provider into core - #1523 Moved Installation Screens into core - #1520 JavaScripts/CSS Integration and Cleanup - #1517 Integrate senaite.core.spotlight diff --git a/bika/lims/browser/configure.zcml b/bika/lims/browser/configure.zcml index 9f7104f540..44330ff0f5 100644 --- a/bika/lims/browser/configure.zcml +++ b/bika/lims/browser/configure.zcml @@ -19,6 +19,7 @@ + diff --git a/bika/lims/browser/contentmenu.py b/bika/lims/browser/contentmenu.py index 5c14982817..df4b2ad1df 100644 --- a/bika/lims/browser/contentmenu.py +++ b/bika/lims/browser/contentmenu.py @@ -19,10 +19,37 @@ # Some rights reserved, see README and LICENSE. from plone.app.contentmenu.menu import WorkflowMenu as BaseClass +from plone.app.contentmenu.view import ContentMenuProvider +from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile +from zope.component import getUtility +from zope.browsermenu.interfaces import IBrowserMenu -class WorkflowMenu(BaseClass): +class SenaiteContentMenuProvider(ContentMenuProvider): + """Provides a proper styled content menu + """ + index = ViewPageTemplateFile( + "templates/plone.app.contentmenu.contentmenu.pt") + + def render(self): + return self.index() + + # From IContentMenuView + + def available(self): + return True + def menu(self): + menu = getUtility(IBrowserMenu, name="plone_contentmenu") + items = menu.getMenuItems(self.context, self.request) + # always filter out the selection of the default view + items = filter( + lambda a: not a["action"].endswith("/select_default_view"), items) + items.reverse() + return items + + +class WorkflowMenu(BaseClass): def getMenuItems(self, context, request): """Overrides the workflow actions menu displayed top right in the object's view. Displays the current state of the object, as well as a @@ -32,6 +59,6 @@ def getMenuItems(self, context, request): """ actions = super(WorkflowMenu, self).getMenuItems(context, request) # Remove status history menu item ('Advanced...') - actions = [action for action in actions - if not action['action'].endswith('/content_status_history')] - return actions + return filter( + lambda a: not a["action"].endswith("/content_status_history"), + actions) diff --git a/bika/lims/browser/contentmenu.zcml b/bika/lims/browser/contentmenu.zcml new file mode 100644 index 0000000000..98be900251 --- /dev/null +++ b/bika/lims/browser/contentmenu.zcml @@ -0,0 +1,16 @@ + + + + + + diff --git a/bika/lims/browser/templates/plone.app.contentmenu.contentmenu.pt b/bika/lims/browser/templates/plone.app.contentmenu.contentmenu.pt new file mode 100644 index 0000000000..98da7fe3d5 --- /dev/null +++ b/bika/lims/browser/templates/plone.app.contentmenu.contentmenu.pt @@ -0,0 +1,89 @@ +
+ + + + +