mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-18 07:01:58 +08:00
38 lines
1.8 KiB
Text
38 lines
1.8 KiB
Text
|
<% # frozen_string_literal: true %>
|
||
|
|
||
|
<%
|
||
|
object_assignment = UserAssignment.find_by(user_id: user.id, assignable: object)
|
||
|
item_id = dom_id(user, :assignment_member)
|
||
|
%>
|
||
|
|
||
|
<%= form_with(model: object_assignment, url: update_path, method: :put, remote: true, html: { class: 'row member-item', id: item_id, data: { action: 'replace-form autosave-form', object_type: :assignment_member } }) do |f| %>
|
||
|
<%= f.hidden_field :user_id, value: f.object.user.id %>
|
||
|
<div class="user-assignment-info">
|
||
|
<div class="global-avatar-container">
|
||
|
<%= 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, object) %></small>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="user-assignment-controls">
|
||
|
<% unless defined?(with_inherit) && current_user == user %>
|
||
|
<div class="user-assignment-role">
|
||
|
<%= f.select :user_role_id, options_for_select(user_roles_collection(with_inherit: defined? with_inherit), selected: f.object.user_role.id), {}, class: 'form-control selectpicker', title: t('user_assignment.change_role'), data: { 'selected-text-format' => 'static' } %>
|
||
|
</div>
|
||
|
<% if defined? delete_path %>
|
||
|
<div class="user-assignment-remove">
|
||
|
<% unless object_assignment.last_assignable_owner? %>
|
||
|
<%= link_to delete_path, 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>
|
||
|
<% end %>
|
||
|
<% end %>
|
||
|
</div>
|
||
|
<% end %>
|