# HG changeset patch # User Adrien Di Mascio # Date 1311678697 -7200 # Node ID b37f4fdc44d4322e80cb4bc82117539258d6ac92 # Parent c47dcd37d4e328bc2c0e49f764127a379a294f10 [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). diff -r c47dcd37d4e3 -r b37f4fdc44d4 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