[ui component] RelatedObjectsCtxComponent to superseede RelatedObjectsVComponent (still there for bw compat)
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 12 Oct 2010 22:12:50 +0200
changeset 6461 b546296227ff
parent 6460 b62bd7cd71df
child 6462 9586590060d4
[ui component] RelatedObjectsCtxComponent to superseede RelatedObjectsVComponent (still there for bw compat)
web/component.py
--- a/web/component.py	Tue Oct 12 22:11:06 2010 +0200
+++ b/web/component.py	Tue Oct 12 22:12:50 2010 +0200
@@ -514,6 +514,20 @@
             w(u'</td></tr></table>')
 
 
+class RelatedObjectsCtxComponent(EntityCtxComponent):
+    """a contextual component to display entities related to another"""
+    __select__ = EntityCtxComponent.__select__ & partial_has_related_entities()
+    context = 'navcontentbottom'
+    rtype = None
+    role = 'subject'
+
+    vid = 'list'
+
+    def render_body(self, w):
+        rset = self.entity.related(self.rtype, role(self))
+        self.wview(self.vid, rset)
+
+
 # old contextual components, deprecated ########################################
 
 class EntityVComponent(Component):