%= content_for :javascript do%> $("#update_button_<%=performance.id%>").remove(); $("#nonjavascript_other_groups_<%=performance.id%>").remove(); $("#other_groups_link_<%=performance.id%>").show(); show_other_groups_<%=performance.id%> = function(){ $("#other_groups_link_<%=performance.id%>").hide(); $("#other_groups_<%=performance.id%>").slideDown("normal"); $("#other_groups_<%=performance.id%>").css("clear","left"); }; close_other_groups_<%=performance.id%> = function(){ $("#other_groups_link_<%=performance.id%>").show(); $("#other_groups_<%=performance.id%>").slideUp("normal", function(){ }); }; $("#role_select_<%=performance.id%>").livequery('change', function(){ val = $(this).val(); $.post("<%=performance_path(performance)%>",{ _method: "put", authenticity_token: "<%=form_authenticity_token()%>", 'performance[role_id]': val }, function(data){eval(data);}, "script" ); }); $(".group_checkbox_<%=performance.id%>").livequery('click', function(){ if($(this).is(":checked")){ $(this).addClass("clicked_checkbox"); var route = "/groups/" + $(this).val() + "/memberships/" $.post(route, {authenticity_token: "<%=form_authenticity_token()%>",'membership[user_id]':<%=user.id%>}, function(data){ eval(data); var old_checkbox = $(".clicked_checkbox").removeClass("clicked_checkbox").attr("id", membership_id).parent().removeClass("crossed"); var new_checkbox = old_checkbox.clone(); $("div#selected_groups_<%=performance.id%>").append(new_checkbox); old_checkbox.remove(); if($("#other_groups_<%=performance.id%> div").size() == 0){ $("#other_groups_<%=performance.id%>").hide(); } } ); }else{ $(this).addClass("clicked_checkbox"); var route = "/groups/" + $(this).val() + "/memberships/" + $(this).attr("id") $.post(route,{ _method: "delete", authenticity_token: "<%=form_authenticity_token()%>" }, function(data){ eval(data); $(".clicked_checkbox").removeClass("clicked_checkbox").parent().addClass("crossed") } ); } }); /* * Send Private Message */ $("a#new_private_message_link").fancybox({ 'hideOnContentClick' : false, 'frameWidth' : 450, 'frameHeight' : 430 }); <%end%>