[web/facet|views/table] bump a bit some heights, split table view methods for easier subclassing
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Fri, 20 May 2011 19:09:01 +0200
changeset 7413 94ad9523abb7
parent 7412 9179ae452159
child 7414 de802bcb6348
[web/facet|views/table] bump a bit some heights, split table view methods for easier subclassing
web/facet.py
web/views/tableview.py
--- a/web/facet.py	Fri May 20 17:29:50 2011 +0200
+++ b/web/facet.py	Fri May 20 19:09:01 2011 +0200
@@ -1096,7 +1096,7 @@
         self.value = None
 
     def height(self):
-        return 2
+        return 3
 
     def _render(self):
         title = xml_escape(self.facet.title)
@@ -1232,7 +1232,7 @@
         self.selected = selected
 
     def height(self):
-        return 1
+        return 2
 
     def _render(self):
         title = xml_escape(self.facet.title)
--- a/web/views/tableview.py	Fri May 20 17:29:50 2011 +0200
+++ b/web/views/tableview.py	Fri May 20 19:09:01 2011 +0200
@@ -83,12 +83,18 @@
         w(u'<input type="hidden" name="fromformfilter" value="1" />')
         filter_hiddens(w, facets=','.join(wdg.facet.__regid__ for wdg in fwidgets),
                        baserql=baserql)
-        # sort by vocab size
+        self._build_form_table(fwidgets)
+
+    def _facet_widget_sort(self, fwidgets):
         fwidgets.sort(key=lambda x: x.height())
+
+    def _build_form_table(self, fwidgets):
+        # sort by widget height
+        w = self.w
+        self._facet_widget_sort(fwidgets)
         w(u'<table class="filter">\n')
         widget_queue = []
         queue_size = 0
-        widget_qty = len(fwidgets)
         w(u'<tr>\n')
         for wdg in fwidgets:
             height = wdg.height()