scinote-web/app/views/repositories/_share_repository_modal.html.erb
2023-08-09 15:47:33 +02:00

64 lines
3.3 KiB
Text

<div class="modal share-repo-modal" tabindex="-1" role="dialog" >
<%= form_for :shares, url: team_repository_team_repositories_path(current_team, @repository), data: { remote: true },
data: { success_message: t("repositories.index.modal_share.success_message", inventory_name: @repository.name) } do |f| %>
<div class="modal-dialog" role="document">
<div class="modal-content">
<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" id="create-repo-modal-label">
<%= t("repositories.index.modal_share.title") %>
</h4>
</div>
<div class="modal-body share-repo-container">
<div class="header">
<span class="team-selector"><%= t("repositories.index.modal_share.share_with_team") %></span>
<span class="permission-selector"><%= t("repositories.index.modal_share.can_edit") %></span>
</div>
<div class="data-list">
<div class="all-teams">
<span class="team-selector" title="<%= t("repositories.index.modal_share.all_teams_tooltip") %>">
<span class="sci-checkbox-container">
<%= check_box_tag 'select_all_teams', 0, @repository.shared_read? || @repository.shared_write?, { class: 'sci-checkbox' } %>
<span class="sci-checkbox-label"></span>
</span>
<%= t("repositories.index.modal_share.all_teams") %>
</span>
<span class="permission-selector">
<span class="sci-toggle-checkbox-container">
<%= check_box_tag 'select_all_write_permission', 0, @repository.shared_write?, { class: 'hidden sci-toggle-checkbox' }%>
<span class="sci-toggle-checkbox-label"></span>
</span>
</span>
</div>
<div class="teams-list">
<% (current_user.teams - [@repository.team]).each do |t| %>
<div class="team-container">
<div class="team-selector">
<span class="sci-checkbox-container">
<%= check_box_tag 'share_team_ids[]', t.id, @repository.private_shared_with?(t), {id: "shared_#{t.id}", class: "sci-checkbox"} %>
<span class="sci-checkbox-label"></span>
</span>
<%= t.name %>
</div>
<div class="permission-selector">
<span class="sci-toggle-checkbox-container">
<%= check_box_tag 'write_permissions[]', t.id, @repository.private_shared_with_write?(t), {
id: "editable_#{t.id}",
class: (@repository.private_shared_with?(t) ? 'sci-toggle-checkbox' : 'sci-toggle-checkbox hidden')
}.compact %>
<span class="sci-toggle-checkbox-label"></span>
</span>
</div>
</div>
<% end %>
</div>
</div>
</div>
<%= hidden_field_tag 'permission_changes', '{}' %>
<div class="modal-footer">
<%= f.submit t("repositories.index.modal_share.submit"), class: "btn btn-primary" %>
</div>
</div>
</div>
<% end %>
</div>