% update_name = "cr__" + context_role.to_s + "__" + set_id.to_s %>
<% unless update_partial %>
<% end %>
<% form_for "/cbac/permissions/update", :remote => true, :url => cbac_permissions_update_path,
:update => update_name, :before => "$('#{update_name}').style.visibility = 'hidden';",
:complete => "$('#{update_name}').style.visibility = 'visible';" do %>
<%= hidden_field_tag "context_role" + update_name, context_role.to_s, :name => "context_role" %>
<%= hidden_field_tag "privilege_set_id" + update_name, set_id.to_s, :name => "privilege_set_id" %>
<%= check_box_tag "permission" + update_name, "1",
(Cbac::Permission.where(context_role: context_role.to_s, privilege_set_id: set_id.to_s).count > 0),
{:onclick => "this.form.onsubmit();", :name => "permission"}%>
<% end %>
<% unless update_partial %>
<% end %>