mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-11 23:54:43 +08:00
Show assigned users modal also for view
This commit is contained in:
parent
4040483c74
commit
d2415c3b1d
2 changed files with 19 additions and 30 deletions
|
@ -1,7 +1,7 @@
|
|||
class UserMyModulesController < ApplicationController
|
||||
before_action :load_vars
|
||||
before_action :check_view_permissions, only: %i(index index_old)
|
||||
before_action :check_manage_permissions, only: %i(create index_edit destroy)
|
||||
before_action :check_view_permissions, only: %i(index index_old index_edit)
|
||||
before_action :check_manage_permissions, only: %i(create destroy)
|
||||
|
||||
def index_old
|
||||
@user_my_modules = @my_module.user_my_modules
|
||||
|
|
|
@ -1,35 +1,24 @@
|
|||
<% user_my_modules = @my_module.user_my_modules %>
|
||||
<% if can_manage_users_in_module?(@my_module) %>
|
||||
<a class="task-assigned-users manage-users-link <%= 'empty' unless user_my_modules.present? %>"
|
||||
data-remote="true"
|
||||
href="<%= my_module_users_edit_path(@my_module, format: :json) %>"
|
||||
data-module-id="<%= @my_module.id %>"
|
||||
data-module-users-url="<%= my_module_user_my_modules_url(@my_module, format: :json) %>">
|
||||
<% if user_my_modules.present? %>
|
||||
<% user_my_modules.each do |user_my_module| %>
|
||||
<% user = user_my_module.user %>
|
||||
<span class='global-avatar-container'>
|
||||
<%= image_tag avatar_path(user, :icon_small) %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% if @my_module.unassigned_users.any? %>
|
||||
<span class='global-avatar-container assign-new-user'>
|
||||
<i class="fas fa-plus"></i>
|
||||
</span>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<span class="empty-label">
|
||||
<%= t('my_modules.details.no_assigned_users') %>
|
||||
</span>
|
||||
<% end %>
|
||||
</a>
|
||||
<% else %>
|
||||
<div class="task-assigned-users">
|
||||
<a class="task-assigned-users manage-users-link <%= 'empty' unless user_my_modules.present? %>"
|
||||
data-remote="true"
|
||||
href="<%= my_module_users_edit_path(@my_module, format: :json) %>"
|
||||
data-module-id="<%= @my_module.id %>"
|
||||
data-module-users-url="<%= my_module_user_my_modules_url(@my_module, format: :json) %>">
|
||||
<% if user_my_modules.present? %>
|
||||
<% user_my_modules.each do |user_my_module| %>
|
||||
<% user = user_my_module.user %>
|
||||
<span class='global-avatar-container'>
|
||||
<%= image_tag avatar_path(user, :icon_small) %>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if can_manage_users_in_module?(@my_module) && @my_module.unassigned_users.any? %>
|
||||
<span class='global-avatar-container assign-new-user'>
|
||||
<i class="fas fa-plus"></i>
|
||||
</span>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<span class="empty-label">
|
||||
<%= t('my_modules.details.no_assigned_users') %>
|
||||
</span>
|
||||
<% end %>
|
||||
</a>
|
||||
|
|
Loading…
Add table
Reference in a new issue