web/data/cubicweb.formfilter.js
branchstable
changeset 2325 363b66a15668
parent 2324 810fcd045f7c
child 2342 923111e6ab33
equal deleted inserted replaced
2324:810fcd045f7c 2325:363b66a15668
   133 			       this.setAttribute('src', UNSELECTED_BORDER_IMG);
   133 			       this.setAttribute('src', UNSELECTED_BORDER_IMG);
   134 			       this.setAttribute('alt', (_('not selected')));
   134 			       this.setAttribute('alt', (_('not selected')));
   135 			    }
   135 			    }
   136 			    else{
   136 			    else{
   137 			       this.setAttribute('src', UNSELECTED_IMG);
   137 			       this.setAttribute('src', UNSELECTED_IMG);
   138        			       this.setAttribute('alt', (_('not selected')));
   138 			       this.setAttribute('alt', (_('not selected')));
   139 			    }
   139 			    }
   140 			});
   140 			});
   141 			var index = parseInt($this.attr('cubicweb:idx'));
   141 			var index = parseInt($this.attr('cubicweb:idx'));
   142 			var shift = jQuery.grep(facet.find('.facetValueSelected'), function (n) {
   142 			var shift = jQuery.grep(facet.find('.facetValueSelected'), function (n) {
   143 			    var nindex = parseInt(n.getAttribute('cubicweb:idx'));
   143 			    var nindex = parseInt(n.getAttribute('cubicweb:idx'));
   147 			var parent = this.parentNode;
   147 			var parent = this.parentNode;
   148 			var $insertAfter = jQuery(parent).find('.facetCheckBox:nth('+index+')');
   148 			var $insertAfter = jQuery(parent).find('.facetCheckBox:nth('+index+')');
   149 			if ( ! ($insertAfter.length == 1 && shift == 0) ) {
   149 			if ( ! ($insertAfter.length == 1 && shift == 0) ) {
   150 			    // only rearrange element if necessary
   150 			    // only rearrange element if necessary
   151 			    $insertAfter.after(this);
   151 			    $insertAfter.after(this);
   152 			}else{
   152 			}
   153                          }
       
   154 		    } else {
   153 		    } else {
   155 			var lastSelected = facet.find('.facetValueSelected:last');
   154 			var lastSelected = facet.find('.facetValueSelected:last');
   156 			if (lastSelected.length) {
   155 			if (lastSelected.length) {
   157 			    lastSelected.after(this);
   156 			    lastSelected.after(this);
   158 			} else {
   157 			} else {
   159 			    var parent = this.parentNode;
   158 			    var parent = this.parentNode;
   160 			    jQuery(parent).prepend(this);
   159 			    jQuery(parent).prepend(this);
   161 			}
   160 			}
   162 			jQuery(this).addClass('facetValueSelected');
   161 			jQuery(this).addClass('facetValueSelected');
   163 			var img = jQuery(this).find('img');
   162 			var $img = jQuery(this).find('img');
   164 			img.attr('src', SELECTED_IMG);
   163 			$img.attr('src', SELECTED_IMG).attr('alt', (_('selected')));
   165 			img.attr('alt', (_('selected')));
       
   166 
       
   167 		    }
   164 		    }
   168 		    buildRQL.apply(null, evalJSON(form.attr('cubicweb:facetargs')));
   165 		    buildRQL.apply(null, evalJSON(form.attr('cubicweb:facetargs')));
   169 		    facet.find('.facetBody').animate({scrollTop: 0}, '');
   166 		    facet.find('.facetBody').animate({scrollTop: 0}, '');
   170 		});
   167 		});
   171 		facet.find('select.facetOperator').change(function() {
   168 		facet.find('select.facetOperator').change(function() {