scinote-web/app/views/access_permissions/partials/_project_member_field.html.erb

34 lines
1.6 KiB
Text
Raw Normal View History

<% # frozen_string_literal: true %>
2021-04-30 19:26:06 +08:00
<%
project_member = ProjectMember.new(user, project)
item_id = dom_id(user, :project_member)
%>
<%= form_with(model: project_member, url: update_path, method: :put, remote: true, html: { class: 'row member-item', id: item_id, data: { action: 'replace-form autosave-form', object_type: :project } }) do |f| %>
<%= f.hidden_field :user_id, value: f.object.user.id %>
<div class="user-assignment-info">
<div class="global-avatar-container">
2021-04-30 22:02:59 +08:00
<%= image_tag avatar_path(user, :icon_small), title: current_assignee_name(user), class: 'img-circle pull-left' %>
</div>
<div>
<%= current_assignee_name(user) %>
<br>
<small class="text-muted"><%= user_assignment_resource_role_name(user, project) %></small>
</div>
</div>
<div class="user-assignment-controls">
<div class="user-assignment-role">
<%= f.select :user_role_id, options_for_select(user_roles_collection, selected: f.object.user_role.id), {}, class: 'form-control selectpicker', title: t('user_assignment.change_project_role'), data: { 'selected-text-format' => 'static' } %>
</div>
<div class="user-assignment-remove">
<% unless project_member.last_project_owner? %>
<%= link_to access_permissions_project_path(project, user_id: user), remote: true, method: :delete, class: 'btn btn-secondary', data: { action: 'remote-destroy', target: "##{item_id}" } do %>
<span class="fas fa-times"></span>
<%= t 'general.remove' %>
<% end %>
<% end %>
</div>
</div>
<% end %>