diff --git a/app/controllers/repository_rows_controller.rb b/app/controllers/repository_rows_controller.rb index d2a84a9cb..335291900 100644 --- a/app/controllers/repository_rows_controller.rb +++ b/app/controllers/repository_rows_controller.rb @@ -213,12 +213,12 @@ class RepositoryRowsController < ApplicationController params[:query], whole_phrase: true ) - viewable_modules = assigned_modules.viewable_by_user(current_user, current_user.teams) - private_modules = assigned_modules - viewable_modules + viewable_modules = assigned_modules.viewable_by_user(current_user, current_team) + private_modules_number = assigned_modules.where.not(id: viewable_modules).count render json: { html: render_to_string(partial: 'shared/my_modules_list_partial.html.erb', locals: { my_modules: viewable_modules, - private_modules: private_modules + private_modules_number: private_modules_number }) } end diff --git a/app/views/shared/_my_modules_list_partial.html.erb b/app/views/shared/_my_modules_list_partial.html.erb index c3bb1bac4..43eed252b 100644 --- a/app/views/shared/_my_modules_list_partial.html.erb +++ b/app/views/shared/_my_modules_list_partial.html.erb @@ -1,43 +1,44 @@
- <% grouped_by_prj_exp(my_modules).each do |task_group| %> -
-
- <% if task_group[:project_archived]%> - <%= t('general.archived') %> - <% end %> - <%= task_group[:project_name] %> - / - <% if task_group[:experiment_archived] %> - <%= t('general.archived') %> - <% end %> - <%= task_group[:experiment_name] %> -
-
- <% task_group[:tasks].each do |task| %> -
- <%= draw_custom_icon('task-icon') %> - <% if task.archived %> + <% grouped_my_modules = grouped_by_prj_exp(my_modules) %> + <% grouped_my_modules.each do |task_group| %> +
+
+ <% if task_group[:project_archived] %> <%= t('general.archived') %> <% end %> - <%= link_to(task.name, protocols_my_module_path(task.id), {class: "task-link", title: task.name, target: "_blank"}) %> + <%= task_group[:project_name] %> + / + <% if task_group[:experiment_archived] %> + <%= t('general.archived') %> + <% end %> + <%= task_group[:experiment_name] %> +
+
+ <% task_group[:tasks].each do |task| %> +
+ <%= draw_custom_icon('task-icon') %> + <% if task.archived? %> + <%= t('general.archived') %> + <% end %> + <%= link_to(task.name, protocols_my_module_path(task.id), { class: 'task-link', title: task.name, target: '_blank' }) %> +
+ <% end %>
- <% end %>
-
<% end %> - <% if defined?(private_modules) && private_modules.size.positive? %> -
- <%= t('my_modules.modules_list_partial.private_tasks_html', nr: private_modules.size ) %> -
+ <% if defined?(private_modules_number) && private_modules_number.positive? %> +
+ <%= t('my_modules.modules_list_partial.private_tasks_html', nr: private_modules_number) %> +
<% end %> - <% unless my_modules.any? || (defined?(private_modules) && private_modules.any?) %> -
- - - - -

<%= t('my_modules.modules_list_partial.no_results.title') %>

-

<%= t('my_modules.modules_list_partial.no_results.description') %>

-
+ <% unless grouped_my_modules.present? || (defined?(private_modules_number) && private_modules_number.positive?) %> +
+ + + + +

<%= t('my_modules.modules_list_partial.no_results.title') %>

+

<%= t('my_modules.modules_list_partial.no_results.description') %>

+
<% end %>