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">
|
2023-08-17 19:55:17 +08:00
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="sn-icon sn-icon-close"></i></button>
|
2023-02-23 21:57:38 +08:00
|
|
|
<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-06-19 21:45:22 +08:00
|
|
|
<%= link_to new_assignment_path, class: 'btn btn-secondary pull-right', data: { action: 'swap-remote-container', target: '#user_assignments_modal' } do %>
|
2023-06-08 14:33:37 +08:00
|
|
|
<i class="sn-icon sn-icon-new-task"></i>
|
2023-02-23 21:57:38 +08:00
|
|
|
<%= t('access_permissions.grant_access') %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|