[facet] use facet name as input name for text widget (eg has_text) stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 08 Jul 2013 17:38:10 +0200
branchstable
changeset 9139 5ca6e0ab0227
parent 9138 bc6e25dbfd04
child 9140 e7ffe39d4b1a
[facet] use facet name as input name for text widget (eg has_text) we need to ba able to distinguish between text-inputs so we can write a widget for a single facet that uses more than one text input. This fix consists in the diff in cubicweb.facts.js; modifications in facet.py result from this former.
web/data/cubicweb.facets.js
web/facet.py
--- a/web/data/cubicweb.facets.js	Tue Jul 02 09:36:20 2013 +0200
+++ b/web/data/cubicweb.facets.js	Mon Jul 08 17:38:10 2013 +0200
@@ -30,7 +30,7 @@
         });
         // FacetStringWidget (e.g. has-text)
         $(this).find('input:text').each(function(){
-            names.push(facetName);
+            names.push(this.name);
             values.push(this.value);
         });
     });
--- a/web/facet.py	Tue Jul 02 09:36:20 2013 +0200
+++ b/web/facet.py	Mon Jul 08 17:38:10 2013 +0200
@@ -1517,7 +1517,8 @@
             cssclass += ' hideFacetBody'
         w(u'<div class="%s" cubicweb:facetName="%s">%s</div>\n' %
                (cssclass, xml_escape(self.facet.__regid__), title))
-        w(u'<input name="%s" type="text" value="%s" />\n' % (facetid, self.value or u''))
+        w(u'<input name="%s" type="text" value="%s" />\n' % (
+                xml_escape(self.facet.__regid__), self.value or u''))
         w(u'</div>\n')