web/box.py
changeset 2789 39712da6f397
parent 2757 c8e28e1754f0
child 2799 b703639614e7
equal deleted inserted replaced
2788:8d3dbe577d3a 2789:39712da6f397
   148 
   148 
   149 class RelatedEntityBoxTemplate(EntityBoxTemplate):
   149 class RelatedEntityBoxTemplate(EntityBoxTemplate):
   150     __select__ = EntityBoxTemplate.__select__ & partial_has_related_entities()
   150     __select__ = EntityBoxTemplate.__select__ & partial_has_related_entities()
   151 
   151 
   152     def cell_call(self, row, col, **kwargs):
   152     def cell_call(self, row, col, **kwargs):
   153         entity = self.entity(row, col)
   153         entity = self.rset.get_entity(row, col)
   154         limit = self.req.property_value('navigation.related-limit') + 1
   154         limit = self.req.property_value('navigation.related-limit') + 1
   155         role = get_role(self)
   155         role = get_role(self)
   156         self.w(u'<div class="sideBox">')
   156         self.w(u'<div class="sideBox">')
   157         self.wview('sidebox', entity.related(self.rtype, role, limit=limit),
   157         self.wview('sidebox', entity.related(self.rtype, role, limit=limit),
   158                    title=display_name(self.req, self.rtype, role))
   158                    title=display_name(self.req, self.rtype, role))
   167     class attributes.
   167     class attributes.
   168     """
   168     """
   169 
   169 
   170     def cell_call(self, row, col, view=None, **kwargs):
   170     def cell_call(self, row, col, view=None, **kwargs):
   171         self.req.add_js('cubicweb.ajax.js')
   171         self.req.add_js('cubicweb.ajax.js')
   172         entity = self.entity(row, col)
   172         entity = self.rset.get_entity(row, col)
   173         box = SideBoxWidget(display_name(self.req, self.rtype), self.id)
   173         box = SideBoxWidget(display_name(self.req, self.rtype), self.id)
   174         related = self.related_boxitems(entity)
   174         related = self.related_boxitems(entity)
   175         unrelated = self.unrelated_boxitems(entity)
   175         unrelated = self.unrelated_boxitems(entity)
   176         box.extend(related)
   176         box.extend(related)
   177         if related and unrelated:
   177         if related and unrelated: