% content_for :javascript do %>
$(function() {
/**
* the element
*/
var $ui = $('#form_filter');
var $ui_really = $('#ul_filter');
/**
* on focus and on click display the dropdown,
* and change the arrow image
*/
/*$ui.find('.sb_down').bind('focus click',function()*/
$ui.find('.sb_down').bind('mouseover',function()
{
$ui.find('.sb_down')
.addClass('sb_up')
.removeClass('sb_down')
.andSelf()
.find('.sb_dropdown')
.show();
/*$ui.find('.sb_up')
.hide();*/
});
/**
* on mouse leave hide the dropdown,
* and change the arrow image
*/
$ui_really.bind('mouseleave',function(){
$ui.find('.sb_up')
.addClass('sb_down')
.removeClass('sb_up')
.andSelf()
.find('.sb_dropdown')
.hide();
/*$ui.find('.sb_down')
.show();*/
});
/**
* selecting all checkboxes
*/
$ui.find('.sb_dropdown').find('label[for="all"]').prev().bind('click',function(){
$(this).parent().siblings().find(':checkbox').attr('checked',this.checked).attr('disabled',this.checked);
});
});
<% end %>
<%= form_tag "/activities/documents", :method => :post ,:id=> 'form_filter', :class => "tie_form",:remote=> true do %>
Filter
-
<%= check_box_tag 'types', 'Documents', false, :class => 'accept_tos',:onchange=>'$(\'#form_filter\').submit();'%>
-
<%= check_box_tag 'types', 'Audio', false, :class => 'accept_tos',:onchange=>'$(\'#form_filter\').submit();'%>
-
<%= check_box_tag 'types', 'Event', false, :class => 'accept_tos',:onchange=>'$(\'#form_filter\').submit();'%>
-
<%= check_box_tag 'types', 'Picture', false, :class => 'accept_tos',:onchange=>'$(\'#form_filter\').submit();'%>
-
<%= check_box_tag 'types', 'Post', false, :class => 'accept_tos',:onchange=>'$(\'#form_filter\').submit();'%>
-
<%= check_box_tag 'types', 'Video', false, :class => 'accept_tos',:onchange=>'$(\'#form_filter\').submit();'%>
<% end %>