work in progress: states portlet
This commit is contained in:
parent
fbd036a7d0
commit
a78ce4f880
3 changed files with 43 additions and 1 deletions
|
@ -195,7 +195,11 @@ class NodeView(BaseView):
|
|||
subMacro=calendar_macros.macros['main'],
|
||||
priority=90)
|
||||
# force early portlet registrations by target by setting up target view
|
||||
self.virtualTarget
|
||||
if self.virtualTarget is not None:
|
||||
std = self.virtualTarget.typeOptions('portlet_states')
|
||||
if std:
|
||||
from loops.organize.stateful.browser import registerStatesPortlet
|
||||
registerStatesPortlet(self.controller, self.virtualTarget, std)
|
||||
|
||||
@Lazy
|
||||
def usersPresent(self):
|
||||
|
|
|
@ -43,6 +43,16 @@ statefulActions = ('classification_quality',
|
|||
'publishable_task',)
|
||||
|
||||
|
||||
def registerStatesPortlet(controller, view, statesDefs,
|
||||
region='portlet_right', priority=98):
|
||||
cm = controller.macros
|
||||
stfs = [component.getAdapter(view.context, IStateful, name=std)
|
||||
for std in statesDefs]
|
||||
cm.register(region, 'states', title=_(u'States'),
|
||||
subMacro=template.macros['portlet_states'],
|
||||
priority=priority, info=view, stfs=stfs)
|
||||
|
||||
|
||||
class StateAction(Action):
|
||||
|
||||
url = None
|
||||
|
|
|
@ -68,4 +68,32 @@
|
|||
</metal:query>
|
||||
|
||||
|
||||
<!-- portlets -->
|
||||
|
||||
<metal:actions define-macro="portlet_states">
|
||||
<div tal:repeat="stf macro/stfs">
|
||||
<div tal:condition="python:len(macro.stfs) > 1">
|
||||
<span i18n:translate="">Workflow</span>
|
||||
<span i18n:translate=""
|
||||
tal:content="stf/statesDefinition" />
|
||||
</div>
|
||||
<div>
|
||||
<b i18n:translate="">State</b>:
|
||||
<span i18n:translate=""
|
||||
tal:content="stf/state" />
|
||||
</div>
|
||||
<div>
|
||||
<div><b i18n:translate="">Available Transitions</b>:</div>
|
||||
<ul>
|
||||
<li tal:repeat="action stf/getAvailableTransitionsForUser">
|
||||
<a i18n:translate=""
|
||||
tal:attributes="href string:change_state.html"
|
||||
tal:content="action/title" />
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</metal:actions>
|
||||
|
||||
|
||||
</html>
|
||||
|
|
Loading…
Add table
Reference in a new issue