# set right alt values, fix disapearing values in facetCheckBox stable
authorKatia Saurfelt <katia.saurfelt@logilab.fr>
Wed, 08 Jul 2009 10:34:31 +0200
branchstable
changeset 2324 810fcd045f7c
parent 2323 017bc7d7552d
child 2325 363b66a15668
child 2337 6620e5abcd99
# set right alt values, fix disapearing values in facetCheckBox
web/data/cubicweb.formfilter.js
--- a/web/data/cubicweb.formfilter.js	Tue Jul 07 11:13:09 2009 +0200
+++ b/web/data/cubicweb.formfilter.js	Wed Jul 08 10:34:31 2009 +0200
@@ -131,9 +131,11 @@
 			$this.find('img').each(function (i){
 			if (this.getAttribute('cubicweb:unselimg')){
 			       this.setAttribute('src', UNSELECTED_BORDER_IMG);
+			       this.setAttribute('alt', (_('not selected')));
 			    }
 			    else{
 			       this.setAttribute('src', UNSELECTED_IMG);
+       			       this.setAttribute('alt', (_('not selected')));
 			    }
 			});
 			var index = parseInt($this.attr('cubicweb:idx'));
@@ -144,10 +146,11 @@
 			index += shift;
 			var parent = this.parentNode;
 			var $insertAfter = jQuery(parent).find('.facetCheckBox:nth('+index+')');
-			if ( ! ($insertAfter.length == 1 && index == 0) ) {
+			if ( ! ($insertAfter.length == 1 && shift == 0) ) {
 			    // only rearrange element if necessary
 			    $insertAfter.after(this);
-			}
+			}else{
+                         }
 		    } else {
 			var lastSelected = facet.find('.facetValueSelected:last');
 			if (lastSelected.length) {
@@ -157,7 +160,10 @@
 			    jQuery(parent).prepend(this);
 			}
 			jQuery(this).addClass('facetValueSelected');
-			jQuery(this).find('img').attr('src', SELECTED_IMG);
+			var img = jQuery(this).find('img');
+			img.attr('src', SELECTED_IMG);
+			img.attr('alt', (_('selected')));
+
 		    }
 		    buildRQL.apply(null, evalJSON(form.attr('cubicweb:facetargs')));
 		    facet.find('.facetBody').animate({scrollTop: 0}, '');