227 return sorted((a.id, a.__class__) for a in self.vreg['views'].possible_views(req, rset=rset)) |
227 return sorted((a.id, a.__class__) for a in self.vreg['views'].possible_views(req, rset=rset)) |
228 |
228 |
229 def pactions(self, req, rset, skipcategories=('addrelated', 'siteactions', 'useractions')): |
229 def pactions(self, req, rset, skipcategories=('addrelated', 'siteactions', 'useractions')): |
230 return [(a.id, a.__class__) for a in self.vreg['actions'].possible_vobjects(req, rset=rset) |
230 return [(a.id, a.__class__) for a in self.vreg['actions'].possible_vobjects(req, rset=rset) |
231 if a.category not in skipcategories] |
231 if a.category not in skipcategories] |
|
232 |
|
233 def action_submenu(self, req, rset, id): |
|
234 return self._test_action(self.vreg['actions'].select(id, req, rset=rset)) |
|
235 |
|
236 def _test_action(self, action): |
|
237 class fake_menu(list): |
|
238 @property |
|
239 def items(self): |
|
240 return self |
|
241 class fake_box(object): |
|
242 def mk_action(self, label, url, **kwargs): |
|
243 return (label, url) |
|
244 def box_action(self, action, **kwargs): |
|
245 return (action.title, action.url()) |
|
246 submenu = fake_menu() |
|
247 action.fill_menu(fake_box(), submenu) |
|
248 return submenu |
232 |
249 |
233 def pactions_by_cats(self, req, rset, categories=('addrelated',)): |
250 def pactions_by_cats(self, req, rset, categories=('addrelated',)): |
234 return [(a.id, a.__class__) for a in self.vreg['actions'].possible_vobjects(req, rset=rset) |
251 return [(a.id, a.__class__) for a in self.vreg['actions'].possible_vobjects(req, rset=rset) |
235 if a.category in categories] |
252 if a.category in categories] |
236 |
253 |