mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-12-10 06:06:24 +08:00
Add private tasks to assigned task list
This commit is contained in:
parent
29370cf82e
commit
d16930e987
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 {
|
.archived {
|
||||||
@include font-small;
|
@include font-small;
|
||||||
background: $brand-warning;
|
background: $brand-warning;
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,9 @@ class RepositoryRowsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@assigned_modules = MyModuleRepositoryRow.eager_load(my_module: [{ experiment: :project }])
|
@assigned_modules = @repository_row.my_modules.joins(experiment: :project)
|
||||||
.where(repository_row: @repository_row)
|
@viewable_modules = @assigned_modules.viewable_by_user(current_user, current_user.teams)
|
||||||
|
@private_modules = @assigned_modules - @viewable_modules
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.json do
|
format.json do
|
||||||
|
|
@ -152,11 +153,13 @@ class RepositoryRowsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def assigned_task_list
|
def assigned_task_list
|
||||||
my_modules = @repository_row.my_modules.joins(experiment: :project)
|
assigned_modules = @repository_row.my_modules.joins(experiment: :project)
|
||||||
.search_by_name(current_user, current_team, params[:query])
|
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: {
|
render json: {
|
||||||
html: render_to_string(partial: 'shared/my_modules_list_partial.html.erb', locals: {
|
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
|
end
|
||||||
|
|
|
||||||
|
|
@ -40,36 +40,38 @@
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<% if @repository_row.repository.is_a?(Repository) %>
|
<% if @repository_row.repository.is_a?(Repository) %>
|
||||||
<% if @assigned_modules.size > 0 %>
|
<% if @assigned_modules.size.positive? %>
|
||||||
<div>
|
<div>
|
||||||
<%= t('repository_row.modal_info.title', nr: @assigned_modules.size) %>
|
<%= 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>
|
</div>
|
||||||
|
<% if @viewable_modules.size.positive? %>
|
||||||
<div class="linked-children-datatable">
|
<div class="linked-children-datatable">
|
||||||
<table id="repository_row-info-table" class="table dataTable no-footer" role="grid">
|
<table id="repository_row-info-table" class="table dataTable no-footer" role="grid">
|
||||||
<tbody>
|
<tbody>
|
||||||
<% @assigned_modules.each_with_index do |element, i| %>
|
<% @viewable_modules.each do |my_module| %>
|
||||||
<tr role="row">
|
<tr role="row">
|
||||||
<td class="sorting_1">
|
<td class="sorting_1">
|
||||||
<ol class='breadcrumb'>
|
<ol class='breadcrumb'>
|
||||||
<li>
|
<li>
|
||||||
<span class='fas fa-users'></span>
|
<span class='fas fa-users'></span>
|
||||||
<%= render partial: 'search/results/partials/team_text.html.erb',
|
<%= 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>
|
||||||
<li>
|
<li>
|
||||||
<%= image_tag 'icon_small/project.svg' %>
|
<%= image_tag 'icon_small/project.svg' %>
|
||||||
<%= render partial: 'search/results/partials/project_text.html.erb',
|
<%= render partial: 'search/results/partials/project_text.html.erb',
|
||||||
locals: { project: element.my_module.experiment.project } %>
|
locals: { project: my_module.experiment.project } %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%= image_tag 'icon_small/experiment.svg' %>
|
<%= image_tag 'icon_small/experiment.svg' %>
|
||||||
<%= render partial: 'search/results/partials/experiment_text.html.erb',
|
<%= render partial: 'search/results/partials/experiment_text.html.erb',
|
||||||
locals: { experiment: element.my_module.experiment } %>
|
locals: { experiment: my_module.experiment } %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%= image_tag 'icon_small/task.svg' %>
|
<%= image_tag 'icon_small/task.svg' %>
|
||||||
<%= render partial: 'search/results/partials/my_module_text.html.erb',
|
<%= 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,
|
link_to_page: :repositories,
|
||||||
repository: @repository_row.repository } %>
|
repository: @repository_row.repository } %>
|
||||||
</li>
|
</li>
|
||||||
|
|
@ -85,6 +87,7 @@
|
||||||
</thead>
|
</thead>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<em><%= t('repository_row.modal_info.no_tasks') %></em>
|
<em><%= t('repository_row.modal_info.no_tasks') %></em>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
||||||
|
|
@ -19,14 +19,15 @@
|
||||||
<% if task.archived %>
|
<% if task.archived %>
|
||||||
<span class="archived"><%= t('general.archived') %></span>
|
<span class="archived"><%= t('general.archived') %></span>
|
||||||
<% end %>
|
<% 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"}) %>
|
||||||
<%= link_to(task.name, protocols_my_module_path(task.id), {class: "task-link", title: task.name, target: "_blank"}) %>
|
|
||||||
<% else %>
|
|
||||||
<%= task.name %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
|
||||||
</div>
|
</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>
|
</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?
|
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: 'Assign to task'
|
||||||
task_and_downstream: 'Assign to task & downstream'
|
task_and_downstream: 'Assign to task & downstream'
|
||||||
|
modules_list_partial:
|
||||||
|
private_tasks_html: 'Assigned to <strong>%{nr}</strong> private task(s)'
|
||||||
unshared_inventory:
|
unshared_inventory:
|
||||||
title_html: The inventory <b>%{inventory_name}</b> is no longer shared with your team.
|
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>).
|
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"
|
added_by: "Added by"
|
||||||
custom_field: "%{cf}: "
|
custom_field: "%{cf}: "
|
||||||
title: "This item is assigned to %{nr} tasks."
|
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."
|
no_tasks: "This item in not assigned to any task."
|
||||||
samples:
|
samples:
|
||||||
columns: "Columns"
|
columns: "Columns"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue