summaryrefslogtreecommitdiffstats
path: root/app/views/principal_memberships/_edit.html.erb
blob: 224303b7ad044155b8eac98ad6f5e21ab7ad91bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<%= form_for(@membership, :url => principal_membership_path(@principal, @membership),
                          :as => :membership,
                          :remote => request.xhr?,
                          :method => :put) do %>
  <p>
  <% @roles.each do |role| %>
    <label class="block">
      <%= check_box_tag 'membership[role_ids][]',
            role.id, @membership.roles.to_a.include?(role),
            :id => nil,
            :disabled => !@membership.role_editable?(role) %> <%= role.name %>
      <%= render_role_inheritance(@membership, role) %>
    </label>
  <% end %>
  </p>
  <%= hidden_field_tag 'membership[role_ids][]', '', :id => nil %>
  <p>
    <%= submit_tag l(:button_save) %>
    <%= link_to_function l(:button_cancel),
                         "$('#member-#{@membership.id}-roles').show(); $('#member-#{@membership.id}-form').empty(); return false;" if request.xhr? %>
  </p>
<% end %>