X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=templates%2Fall_checkboxes.html.ep;h=0e034d38e024887a58e6dc731a965992367876ab;hb=257b572dcca656e0f7b5530c0c1c6a0b09d1ff7c;hp=d18fb32440583171b96fda608d725686996f5e97;hpb=dd94053ca40642c627077aadfed0ad7fb28ba070;p=MojoFacets.git diff --git a/templates/all_checkboxes.html.ep b/templates/all_checkboxes.html.ep index d18fb32..0e034d3 100644 --- a/templates/all_checkboxes.html.ep +++ b/templates/all_checkboxes.html.ep @@ -1,9 +1,47 @@ +all +none + + +included +excluded + + -all -none +$('a#all').click( function(){ + $("input[type='checkbox']:not([disabled='disabled'])").attr('checked', true); +}); + +$('a#none').click( function(){ + $("input[type='checkbox']:not([disabled='disabled'])").attr('checked', false); +}); + +$('a#included').click( function(){ + $("label.included input[type='checkbox']:not([disabled='disabled'])").attr('checked', true); +}).hide(); + +$('a#excluded').click( function(){ + $("label.excluded input[type='checkbox']:not([disabled='disabled'])").attr('checked', true); +}).hide(); + +$('input[name=filter_regex]').change( function(e) { + console.debug( this, e ); + var r = new RegExp( this.value ,'i'); + var included = 0; + var excluded = 0; + $("input[type='checkbox']:not([disabled='disabled'])").each( function(i,element){ + if ( r.test( this.value ) ) { + $(this).parent().removeClass('excluded').addClass('included'); + included++; + } else { + $(this).parent().removeClass('included').addClass('excluded'); + excluded++; + } + }); + + $('a#included').text('+' + included).show(); + $('a#excluded').text('-' + excluded).show(); +}); + +