forked from senaite/senaite.core
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dynamic Workflow Menu (senaite#2137)
* Added menu provider * Implemented WF Menu Updater * Production JS * Changelog updated * Handle no workflow menu views, e.g. multi_results * Production JS * Log warning instead of throwing an error * Production JS * Do not repace WF menu if the server responded exceptionally * Production JS * Fetch the current url from the attribute dataset * Comment updated
- Loading branch information
Showing
7 changed files
with
90 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from zope.interface import Interface | ||
|
||
|
||
class IMenuProvider(Interface): | ||
"""View to render a menu/submenu | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from Products.Five import BrowserView | ||
from zope.component import getMultiAdapter | ||
from zope.interface import implementer | ||
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile | ||
|
||
from .interfaces import IMenuProvider | ||
|
||
|
||
@implementer(IMenuProvider) | ||
class MenuProviderView(BrowserView): | ||
"""View to render a menu/submenu | ||
""" | ||
template = ViewPageTemplateFile('templates/contentmenu.pt') | ||
|
||
def __init__(self, context, request): | ||
super(BrowserView, self).__init__(context, request) | ||
self.menu = [] | ||
|
||
@property | ||
def contentmenu(self): | ||
return getMultiAdapter( | ||
(self.context, self.request, self), name="plone.contentmenu") | ||
|
||
def available(self): | ||
return self.contentmenu.available() | ||
|
||
def workflow_menu(self): | ||
menu_id = "content_status_history" | ||
menu = self.contentmenu.menu() | ||
self.menu = filter( | ||
lambda m: m.get("action").endswith(menu_id), menu) | ||
return self.template() |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters