[web] refactor side box to use autolimited view stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 12 May 2010 12:17:46 +0200
branchstable
changeset 5517 4b5577515722
parent 5516 232d13fc3e86
child 5518 ceea458025b9
[web] refactor side box to use autolimited view
web/views/boxes.py
--- a/web/views/boxes.py	Wed May 12 12:16:41 2010 +0200
+++ b/web/views/boxes.py	Wed May 12 12:17:46 2010 +0200
@@ -201,20 +201,5 @@
         if title:
             self.w(u'<div class="sideBoxTitle"><span>%s</span></div>' % title)
         self.w(u'<div class="%s"><div class="sideBoxBody">' % boxclass)
-        # if not too much entities, show them all in a list
-        maxrelated = self._cw.property_value('navigation.related-limit')
-        if self.cw_rset.rowcount <= maxrelated:
-            if len(self.cw_rset) == 1:
-                self.wview('incontext', self.cw_rset, row=0)
-            elif 1 < len(self.cw_rset) < 5:
-                self.wview('csv', self.cw_rset)
-            else:
-                self.wview('simplelist', self.cw_rset)
-        # else show links to display related entities
-        else:
-            self.cw_rset.limit(maxrelated)
-            rql = self.cw_rset.printable_rql(encoded=False)
-            self.wview('simplelist', self.cw_rset)
-            self.w(u'[<a href="%s">%s</a>]' % (self._cw.build_url(rql=rql),
-                                               self._cw._('see them all')))
+        self.wview('autolimited', self.cw_rset, **self.cw_extra_kwargs)
         self.w(u'</div>\n</div>\n')