web/facet.py
changeset 368 84a5106840fa
parent 346 5bbb01a133ae
child 407 68783684ec2f
equal deleted inserted replaced
367:2c0d00b40387 368:84a5106840fa
   501         self.items.append(item)
   501         self.items.append(item)
   502             
   502             
   503     def _render(self):
   503     def _render(self):
   504         title = html_escape(self.facet.title)
   504         title = html_escape(self.facet.title)
   505         facetid = html_escape(self.facet.id)
   505         facetid = html_escape(self.facet.id)
   506         self.w(u'<div id="%s" class="facet">\n' % facetid)
   506         if len(self.items) > 6:
       
   507             self.w(u'<div id="%s" class="facet overflowed">\n' % facetid)
       
   508         else:
       
   509             self.w(u'<div id="%s" class="facet">\n' % facetid)
   507         self.w(u'<div class="facetTitle" cubicweb:facetName="%s">%s</div>\n' %
   510         self.w(u'<div class="facetTitle" cubicweb:facetName="%s">%s</div>\n' %
   508                (html_escape(facetid), title))
   511                (html_escape(facetid), title))
   509         if self.facet.support_and():
   512         if self.facet.support_and():
   510             _ = self.facet.req._
   513             _ = self.facet.req._
   511             self.w(u'''<select name="%s" class="radio facetOperator" title="%s">
   514             self.w(u'''<select name="%s" class="radio facetOperator" title="%s">
   512   <option value="OR">%s</option>
   515   <option value="OR">%s</option>
   513   <option value="AND">%s</option>
   516   <option value="AND">%s</option>
   514 </select>''' % (facetid + '_andor', _('and/or between different values'),
   517 </select>''' % (facetid + '_andor', _('and/or between different values'),
   515                 _('OR'), _('AND')))
   518                 _('OR'), _('AND')))
   516         if self.facet.start_unfolded:
   519         cssclass = ''
   517             cssclass = ''
   520         if not self.facet.start_unfolded:
   518         else:
   521             cssclass += ' hidden'
   519             cssclass = ' hidden'
       
   520         self.w(u'<div class="facetBody%s">\n' % cssclass)
   522         self.w(u'<div class="facetBody%s">\n' % cssclass)
   521         for item in self.items:
   523         for item in self.items:
   522             item.render(self.w)
   524             item.render(self.w)
   523         self.w(u'</div>\n')
   525         self.w(u'</div>\n')
   524         self.w(u'</div>\n')
   526         self.w(u'</div>\n')