web/facet.py
branchstable
changeset 7225 a4a115aab086
parent 7205 9220ae2cacf1
child 7235 5a0ee8de7f06
--- a/web/facet.py	Thu Apr 14 14:19:21 2011 +0200
+++ b/web/facet.py	Thu Apr 14 11:36:47 2011 +0200
@@ -1066,12 +1066,12 @@
   <option value="AND">%s</option>
 </select>''' % (facetid + '_andor', _('and/or between different values'),
                 _('OR'), _('AND')))
-        cssclass = ''
+        cssclass = 'facetBody'
         if not self.facet.start_unfolded:
             cssclass += ' hidden'
         if len(self.items) > 6:
             cssclass += ' overflowed'
-        self.w(u'<div class="facetBody%s">\n' % cssclass)
+        self.w(u'<div class="%s">\n' % cssclass)
         for item in self.items:
             item.render(w=self.w)
         self.w(u'</div>\n')
@@ -1140,6 +1140,10 @@
         self.w(u'<div id="%s" class="facet">\n' % facetid)
         self.w(u'<div class="facetTitle" cubicweb:facetName="%s">%s</div>\n' %
                (facetid, title))
+        cssclass = 'facetBody'
+        if not self.facet.start_unfolded:
+            cssclass += ' hidden'
+        self.w(u'<div class="%s">\n' % cssclass)
         self.w(u'<span id="%s_inf"></span> - <span id="%s_sup"></span>'
                % (sliderid, sliderid))
         self.w(u'<input type="hidden" name="%s_inf" value="%s" />'
@@ -1152,6 +1156,7 @@
                % (facetid, self.maxvalue))
         self.w(u'<div id="%s"></div>' % sliderid)
         self.w(u'</div>\n')
+        self.w(u'</div>\n')
 
 
 class DateFacetRangeWidget(FacetRangeWidget):
@@ -1183,15 +1188,15 @@
         self.selected = selected
 
     def _render(self):
+        cssclass = 'facetValue facetCheckBox'
         if self.selected:
-            cssclass = ' facetValueSelected'
+            cssclass += ' facetValueSelected'
             imgsrc = self._cw.data_url(self.selected_img)
             imgalt = self._cw._('selected')
         else:
-            cssclass = ''
             imgsrc = self._cw.data_url(self.unselected_img)
             imgalt = self._cw._('not selected')
-        self.w(u'<div class="facetValue facetCheckBox%s" cubicweb:value="%s">\n'
+        self.w(u'<div class="%s" cubicweb:value="%s">\n'
                % (cssclass, xml_escape(unicode(self.value))))
         self.w(u'<img src="%s" alt="%s"/>&#160;' % (imgsrc, imgalt))
         self.w(u'<a href="javascript: {}">%s</a>' % xml_escape(self.label))
@@ -1212,15 +1217,15 @@
         title = xml_escape(self.facet.title)
         facetid = xml_escape(self.facet.__regid__)
         self.w(u'<div id="%s" class="facet">\n' % facetid)
+        cssclass = 'facetValue facetCheckBox'
         if self.selected:
-            cssclass = ' facetValueSelected'
+            cssclass += ' facetValueSelected'
             imgsrc = self._cw.data_url(self.selected_img)
             imgalt = self._cw._('selected')
         else:
-            cssclass = ''
             imgsrc = self._cw.data_url(self.unselected_img)
             imgalt = self._cw._('not selected')
-        self.w(u'<div class="facetValue facetCheckBox%s" cubicweb:value="%s">\n'
+        self.w(u'<div class="%s" cubicweb:value="%s">\n'
                % (cssclass, xml_escape(unicode(self.value))))
         self.w(u'<div class="facetCheckBoxWidget">')
         self.w(u'<img src="%s" alt="%s" cubicweb:unselimg="true" />&#160;' % (imgsrc, imgalt))