mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-01 13:13:22 +08:00
Merge pull request #2588 from aignatov-bio/ai-sci-4660-change-assigned-private-task-view
Add private tasks to assigned task list [SCI-4660]
This commit is contained in:
commit
d3781a7048
5 changed files with 34 additions and 17 deletions
|
@ -57,6 +57,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
.private-tasks-counter {
|
||||
@include font-button;
|
||||
border-top: $border-tertiary;
|
||||
color: $color-silver-chalice;
|
||||
padding-top: .5em;
|
||||
}
|
||||
|
||||
.archived {
|
||||
@include font-small;
|
||||
background: $brand-warning;
|
||||
|
|
|
@ -49,8 +49,9 @@ class RepositoryRowsController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
@assigned_modules = MyModuleRepositoryRow.eager_load(my_module: [{ experiment: :project }])
|
||||
.where(repository_row: @repository_row)
|
||||
@assigned_modules = @repository_row.my_modules.joins(experiment: :project)
|
||||
@viewable_modules = @assigned_modules.viewable_by_user(current_user, current_user.teams)
|
||||
@private_modules = @assigned_modules - @viewable_modules
|
||||
|
||||
respond_to do |format|
|
||||
format.json do
|
||||
|
@ -152,11 +153,13 @@ class RepositoryRowsController < ApplicationController
|
|||
end
|
||||
|
||||
def assigned_task_list
|
||||
my_modules = @repository_row.my_modules.joins(experiment: :project)
|
||||
.search_by_name(current_user, current_team, params[:query])
|
||||
assigned_modules = @repository_row.my_modules.joins(experiment: :project)
|
||||
private_modules = assigned_modules - assigned_modules.viewable_by_user(current_user, current_user.teams)
|
||||
viewable_modules = assigned_modules.search_by_name(current_user, current_user.teams, params[:query])
|
||||
render json: {
|
||||
html: render_to_string(partial: 'shared/my_modules_list_partial.html.erb', locals: {
|
||||
my_modules: my_modules
|
||||
my_modules: viewable_modules,
|
||||
private_modules: private_modules
|
||||
})
|
||||
}
|
||||
end
|
||||
|
|
|
@ -40,36 +40,38 @@
|
|||
</p>
|
||||
|
||||
<% if @repository_row.repository.is_a?(Repository) %>
|
||||
<% if @assigned_modules.size > 0 %>
|
||||
<% if @assigned_modules.size.positive? %>
|
||||
<div>
|
||||
<%= t('repository_row.modal_info.title', nr: @assigned_modules.size) %>
|
||||
<%= t('repository_row.modal_info.private_tasks', nr: @private_modules.size) if @private_modules.size.positive? %>
|
||||
</div>
|
||||
<% if @viewable_modules.size.positive? %>
|
||||
<div class="linked-children-datatable">
|
||||
<table id="repository_row-info-table" class="table dataTable no-footer" role="grid">
|
||||
<tbody>
|
||||
<% @assigned_modules.each_with_index do |element, i| %>
|
||||
<% @viewable_modules.each do |my_module| %>
|
||||
<tr role="row">
|
||||
<td class="sorting_1">
|
||||
<ol class='breadcrumb'>
|
||||
<li>
|
||||
<span class='fas fa-users'></span>
|
||||
<%= render partial: 'search/results/partials/team_text.html.erb',
|
||||
locals: { team: element.my_module.experiment.project.team } %>
|
||||
locals: { team: my_module.experiment.project.team } %>
|
||||
</li>
|
||||
<li>
|
||||
<%= image_tag 'icon_small/project.svg' %>
|
||||
<%= render partial: 'search/results/partials/project_text.html.erb',
|
||||
locals: { project: element.my_module.experiment.project } %>
|
||||
locals: { project: my_module.experiment.project } %>
|
||||
</li>
|
||||
<li>
|
||||
<%= image_tag 'icon_small/experiment.svg' %>
|
||||
<%= render partial: 'search/results/partials/experiment_text.html.erb',
|
||||
locals: { experiment: element.my_module.experiment } %>
|
||||
locals: { experiment: my_module.experiment } %>
|
||||
</li>
|
||||
<li>
|
||||
<%= image_tag 'icon_small/task.svg' %>
|
||||
<%= render partial: 'search/results/partials/my_module_text.html.erb',
|
||||
locals: { my_module: element.my_module,
|
||||
locals: { my_module: my_module,
|
||||
link_to_page: :repositories,
|
||||
repository: @repository_row.repository } %>
|
||||
</li>
|
||||
|
@ -85,6 +87,7 @@
|
|||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<em><%= t('repository_row.modal_info.no_tasks') %></em>
|
||||
<% end %>
|
||||
|
|
|
@ -19,14 +19,15 @@
|
|||
<% if task.archived %>
|
||||
<span class="archived"><%= t('general.archived') %></span>
|
||||
<% end %>
|
||||
<% if can_read_experiment?(current_user, task.experiment) %>
|
||||
<%= link_to(task.name, protocols_my_module_path(task.id), {class: "task-link", title: task.name, target: "_blank"}) %>
|
||||
<% else %>
|
||||
<%= task.name %>
|
||||
<% end %>
|
||||
<%= link_to(task.name, protocols_my_module_path(task.id), {class: "task-link", title: task.name, target: "_blank"}) %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if defined?(private_modules) && private_modules.size.positive? %>
|
||||
<div class="private-tasks-counter">
|
||||
<%= t('my_modules.modules_list_partial.private_tasks_html', nr: private_modules.size ) %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -831,6 +831,8 @@ en:
|
|||
message: Do you want to assign %{size} items only to this task, or assign them to this task & downstream tasks in the workflow as well?
|
||||
task: 'Assign to task'
|
||||
task_and_downstream: 'Assign to task & downstream'
|
||||
modules_list_partial:
|
||||
private_tasks_html: 'Assigned to <strong>%{nr}</strong> private task(s)'
|
||||
unshared_inventory:
|
||||
title_html: The inventory <b>%{inventory_name}</b> is no longer shared with your team.
|
||||
body_html: This inventory has been ushared with your team by the inventory’s owner. To view the item/s that are assigned to your task/s contact the <b>%{team_name}</b> team administrator <b>%{admin_name}</b> (<b>%{admin_email}</b>).
|
||||
|
@ -1320,6 +1322,7 @@ en:
|
|||
added_by: "Added by"
|
||||
custom_field: "%{cf}: "
|
||||
title: "This item is assigned to %{nr} tasks."
|
||||
private_tasks: "%{nr} task(s) are private and will not be displayed."
|
||||
no_tasks: "This item in not assigned to any task."
|
||||
samples:
|
||||
columns: "Columns"
|
||||
|
|
Loading…
Reference in a new issue