scinote-web/app/views/access_permissions/modals/_edit_modal.html.erb

33 lines
1.9 KiB
Text
Raw Normal View History

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">
<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">&times;</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| %>
<%
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">
<%= link_to new_assignment_path, class: 'btn btn-default 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>