* layout * user * config * header * badges, badge_achievements, layout * broadcasts * chat channels * comments.. not much really * Events * growth * listings * mod actions * mods * orgs * pages * permissions * podcasts * reactions * profile fields * reports * response templates * tools * users * Secrets * webhooks * welcome threads * . * internal * css fix * . * main element elsewhere * scope * bring back some of the old styling * . * . * . * notice * Revert schema.db * add alert * little fixes * profile fields * Update schema.rb * closing span * another span * Fixed broken admin specs. Co-authored-by: Nick Taylor <nick@dev.to>
52 lines
2.2 KiB
Text
52 lines
2.2 KiB
Text
<div class="crayons-card p-6 grid gap-6">
|
|
<h2>Organization Memberships</h2>
|
|
|
|
<div>
|
|
<h3>Add to New Organization</h3>
|
|
<%= form_with model: [:admin, OrganizationMembership.new], local: true, html: { class: "form-inline justify-content-between my-3" } do |f| %>
|
|
<%= f.hidden_field :user_id, value: @user.id %>
|
|
<div class="form-group">
|
|
<%= f.label "Organization ID:", class: "mr-3" %>
|
|
<%= f.text_field :organization_id, class: "form-control mr-3", size: 8 %>
|
|
<%= f.label "Membership Level:", class: "mr-3" %>
|
|
<%= f.select(:type_of_user, options_for_select(%w[member admin])) %>
|
|
</div>
|
|
<div class="form-group">
|
|
<%= f.submit "Add to Org", class: "btn btn-primary" %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
|
|
<% unless @organization_memberships.load.empty? %>
|
|
<div>
|
|
<h3>Manage Memberships</h3>
|
|
<table class='table'>
|
|
<tbody>
|
|
<% @organization_memberships.each do |org_membership| %>
|
|
<tr>
|
|
<td>
|
|
<a href="<%= org_membership.organization.path %>" target="_blank" rel="noopener">
|
|
<h3><%= org_membership.organization.name %></h3>
|
|
</a>
|
|
</td>
|
|
<td>
|
|
<%= form_with model: [:admin, org_membership], method: :patch, local: true, html: { class: "form-inline justify-content-between" } do |f| %>
|
|
<div class="form-group">
|
|
<%= f.label "Permission Level:", class: "mr-3" %>
|
|
<%= f.select("type_of_user", options_for_select(%w[member admin], selected: org_membership.type_of_user)) %>
|
|
</div>
|
|
<%= f.submit "Update Permissions", class: "btn btn-primary " %>
|
|
<% end %>
|
|
</td>
|
|
<td>
|
|
<%= form_with model: [:admin, org_membership], method: :delete, local: true, html: { class: "d-flex justify-content-end" } do |f| %>
|
|
<%= f.submit "Remove From Org", class: "btn btn-danger", data: { confirm: "Are you sure you want to remove them from #{org_membership.organization.name}?" } %>
|
|
<% end %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<% end %>
|
|
</div>
|