[facets] make sure has_text facet data is posted correctly (closes #1857405) stable
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Tue, 26 Jul 2011 13:11:37 +0200
branchstable
changeset 7692 b37f4fdc44d4
parent 7691 c47dcd37d4e3
child 7695 2f6e37661cf6
[facets] make sure has_text facet data is posted correctly (closes #1857405) Posted data was associated to facet id (e.g. has-text-123098dasdf898adssdd) rather than facet name (i.e. has-text).
web/data/cubicweb.facets.js
--- a/web/data/cubicweb.facets.js	Tue Jul 26 11:25:10 2011 +0200
+++ b/web/data/cubicweb.facets.js	Tue Jul 26 13:11:37 2011 +0200
@@ -23,15 +23,24 @@
     var values = [];
     $form.find('.facet').each(function() {
         var facetName = jQuery(this).find('.facetTitle').attr('cubicweb:facetName');
-        var facetValues = jQuery(this).find('.facetValueSelected').each(function(x) {
+        // FacetVocabularyWidget
+        jQuery(this).find('.facetValueSelected').each(function(x) {
             names.push(facetName);
             values.push(this.getAttribute('cubicweb:value'));
         });
+        // FacetStringWidget (e.g. has-text)
+        jQuery(this).find('input:text').each(function(){
+            names.push(facetName);
+            values.push(this.value);
+        });
     });
-    $form.find('input').each(function() {
+    // pick up hidden inputs (required metadata inputs such as 'facets'
+    // but also RangeWidgets)
+    $form.find('input:hidden').each(function() {
         names.push(this.name);
         values.push(this.value);
     });
+    // And / Or operators
     $form.find('select option[selected]').each(function() {
         names.push(this.parentNode.name);
         values.push(this.value);
@@ -94,7 +103,7 @@
                 },
                 'ctxcomponents', 'edit_box'));
             }
-            $node = jQuery('#breadcrumbs')
+            $node = jQuery('#breadcrumbs');
             if ($node.length) {
                 $node.loadxhtml('json', ajaxFuncArgs('render', {
                     'rql': rql