Make ProfileTreeComponent abstract
authorFrank Bessou <frank.bessou@logilab.fr>
Thu, 27 Sep 2018 15:33:38 +0200
changeset 2963 0b663b4c509f
parent 2962 4f0b259e419e
child 2964 9e6614f4159d
Make ProfileTreeComponent abstract We make ProfileTreeComponent abstract to avoid selecting it for any entity that can be adapted to ITreeBase. Indeed, we don't want Concepts to be rendered as contextual components in cube saem. We then create a TransferTreeComponent extending ProfileTreeComponent the same way we made the UnitTreeComponent.
cubicweb_seda/views/sedatree.py
--- a/cubicweb_seda/views/sedatree.py	Thu Sep 27 15:34:17 2018 +0200
+++ b/cubicweb_seda/views/sedatree.py	Thu Sep 27 15:33:38 2018 +0200
@@ -29,9 +29,9 @@
     __regid__ = 'seda.tree'
     __select__ = (component.EntityCtxComponent.__select__
                   & adaptable('ITreeBase'))
+    __abstract__ = True
     context = 'left'
     order = -1
-    title = _('SEDA profile tree')
 
     def render_body(self, w):
         self._cw.add_css('cubes.jqtree.css')
@@ -39,6 +39,11 @@
         self.entity.view('jqtree.treeview', w=w)
 
 
+class TransferTreeComponent(ProfileTreeComponent):
+    __select__ = ProfileTreeComponent.__select__ & is_instance('SEDAArchiveTransfer')
+    title = _('SEDA profile tree')
+
+
 class UnitTreeComponent(ProfileTreeComponent):
     __select__ = ProfileTreeComponent.__select__ & component_unit()
     title = _('Archive unit component tree')