web/views/workflow.py
branch3.5
changeset 3228 7b05b2709439
parent 3220 11b6016e3970
child 3230 1d25e928c299
child 3262 12ffb1e95771
--- a/web/views/workflow.py	Tue Sep 15 14:48:13 2009 +0200
+++ b/web/views/workflow.py	Tue Sep 15 14:49:30 2009 +0200
@@ -123,20 +123,25 @@
     order = 10
 
     def fill_menu(self, box, menu):
-        req = self.req
         entity = self.rset.get_entity(self.row or 0, self.col or 0)
-        menu.label = u'%s: %s' % (req._('state'), entity.printable_state)
+        menu.label = u'%s: %s' % (self.req._('state'), entity.printable_state)
         menu.append_anyway = True
+        super(WorkflowActions, self).fill_menu(box, menu)
+
+    def actual_actions(self):
+        entity = self.rset.get_entity(self.row or 0, self.col or 0)
+        hastr = False
         for tr in entity.possible_transitions():
             url = entity.absolute_url(vid='statuschange', treid=tr.eid)
-            menu.append(box.mk_action(req._(tr.name), url))
+            yield self.build_action(self.req._(tr.name), url)
+            hastr = True
         # don't propose to see wf if user can't pass any transition
-        if menu.items:
+        if hastr:
             wfurl = entity.current_workflow.absolute_url()
-            menu.append(box.mk_action(req._('view workflow'), wfurl))
+            yield self.build_action(self.req._('view workflow'), wfurl)
         if entity.workflow_history:
             wfurl = entity.absolute_url(vid='wfhistory')
-            menu.append(box.mk_action(req._('view history'), wfurl))
+            yield self.build_action(self.req._('view history'), wfurl)
 
 
 # workflow entity types views ##################################################