2023-02-23 21:57:38 +08:00
|
|
|
<% # frozen_string_literal: true %>
|
|
|
|
|
|
|
|
<div class="modal fade user-assignments-modal <%= assignable.class.name.parameterize(separator: '-') %>-assignments-modal" tabindex="-1" role="dialog" data-action="modal-close">
|
2023-03-06 23:43:46 +08:00
|
|
|
<div class="modal-dialog" role="document">
|
2023-02-23 21:57:38 +08:00
|
|
|
<div class="modal-content" id="user_assignments_modal">
|
|
|
|
<div class="modal-header">
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
|
|
|
<h4 class="modal-title"><%= t "access_permissions.#{assignable.class.name.pluralize.underscore}.modals.edit_modal.title", resource_name: assignable.name %></h4>
|
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
|
|
|
<% manually_assigned_users.order(full_name: :asc).each do |user| %>
|
2023-03-06 23:43:46 +08:00
|
|
|
<%
|
|
|
|
options = { user: user, with_inherit: !assignable.top_level_assignable?, assignable: assignable, update_path: public_send("access_permissions_#{assignable.class.name.underscore}_path", assignable) }
|
|
|
|
options.merge!(delete_path: public_send("access_permissions_#{assignable.class.name.underscore}_path", assignable, user_id: user.id)) if assignable == top_level_assignable
|
|
|
|
%>
|
|
|
|
|
|
|
|
<%= render('access_permissions/partials/member_field', options) %>
|
2023-02-23 21:57:38 +08:00
|
|
|
<% end %>
|
|
|
|
<%= render('access_permissions/partials/default_public_user_role_form', assignable: top_level_assignable, editable: assignable == top_level_assignable) if top_level_assignable.respond_to?(:visible?) && top_level_assignable.visible? %>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<% if assignable.top_level_assignable? %>
|
|
|
|
<div class="modal-footer">
|
2023-03-06 23:43:46 +08:00
|
|
|
<%= link_to new_assignment_path, class: 'btn btn-default pull-right', data: { action: 'swap-remote-container', target: '#user_assignments_modal' } do %>
|
2023-02-23 21:57:38 +08:00
|
|
|
<i class="fas fa-plus"></i>
|
|
|
|
<%= t('access_permissions.grant_access') %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|