web/facet.py
changeset 7070 5f8e52d722c5
parent 6681 674461009c7c
child 7117 44775b275d45
equal deleted inserted replaced
7069:8bf2337a6f3b 7070:5f8e52d722c5
  1167         self.selected = selected
  1167         self.selected = selected
  1168 
  1168 
  1169     def _render(self):
  1169     def _render(self):
  1170         if self.selected:
  1170         if self.selected:
  1171             cssclass = ' facetValueSelected'
  1171             cssclass = ' facetValueSelected'
  1172             imgsrc = self._cw.datadir_url + self.selected_img
  1172             imgsrc = self._cw.data_url(self.selected_img)
  1173             imgalt = self._cw._('selected')
  1173             imgalt = self._cw._('selected')
  1174         else:
  1174         else:
  1175             cssclass = ''
  1175             cssclass = ''
  1176             imgsrc = self._cw.datadir_url + self.unselected_img
  1176             imgsrc = self._cw.data_url(self.unselected_img)
  1177             imgalt = self._cw._('not selected')
  1177             imgalt = self._cw._('not selected')
  1178         self.w(u'<div class="facetValue facetCheckBox%s" cubicweb:value="%s">\n'
  1178         self.w(u'<div class="facetValue facetCheckBox%s" cubicweb:value="%s">\n'
  1179                % (cssclass, xml_escape(unicode(self.value))))
  1179                % (cssclass, xml_escape(unicode(self.value))))
  1180         self.w(u'<img src="%s" alt="%s"/>&#160;' % (imgsrc, imgalt))
  1180         self.w(u'<img src="%s" alt="%s"/>&#160;' % (imgsrc, imgalt))
  1181         self.w(u'<a href="javascript: {}">%s</a>' % xml_escape(self.label))
  1181         self.w(u'<a href="javascript: {}">%s</a>' % xml_escape(self.label))
  1196         title = xml_escape(self.facet.title)
  1196         title = xml_escape(self.facet.title)
  1197         facetid = xml_escape(self.facet.__regid__)
  1197         facetid = xml_escape(self.facet.__regid__)
  1198         self.w(u'<div id="%s" class="facet">\n' % facetid)
  1198         self.w(u'<div id="%s" class="facet">\n' % facetid)
  1199         if self.selected:
  1199         if self.selected:
  1200             cssclass = ' facetValueSelected'
  1200             cssclass = ' facetValueSelected'
  1201             imgsrc = self._cw.datadir_url + self.selected_img
  1201             imgsrc = self._cw.data_url(self.selected_img)
  1202             imgalt = self._cw._('selected')
  1202             imgalt = self._cw._('selected')
  1203         else:
  1203         else:
  1204             cssclass = ''
  1204             cssclass = ''
  1205             imgsrc = self._cw.datadir_url + self.unselected_img
  1205             imgsrc = self._cw.data_url(self.unselected_img)
  1206             imgalt = self._cw._('not selected')
  1206             imgalt = self._cw._('not selected')
  1207         self.w(u'<div class="facetValue facetCheckBox%s" cubicweb:value="%s">\n'
  1207         self.w(u'<div class="facetValue facetCheckBox%s" cubicweb:value="%s">\n'
  1208                % (cssclass, xml_escape(unicode(self.value))))
  1208                % (cssclass, xml_escape(unicode(self.value))))
  1209         self.w(u'<div class="facetCheckBoxWidget">')
  1209         self.w(u'<div class="facetCheckBoxWidget">')
  1210         self.w(u'<img src="%s" alt="%s" cubicweb:unselimg="true" />&#160;' % (imgsrc, imgalt))
  1210         self.w(u'<img src="%s" alt="%s" cubicweb:unselimg="true" />&#160;' % (imgsrc, imgalt))