mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-13 00:24:42 +08:00
Fix sidebar navigation for archived task [SCI-6050]
This commit is contained in:
parent
86dd02c6de
commit
6a1223c498
3 changed files with 39 additions and 8 deletions
|
@ -316,7 +316,7 @@ class MyModulesController < ApplicationController
|
|||
end
|
||||
|
||||
def load_experiment_my_modules
|
||||
@experiment_my_modules = @my_module.experiment.my_modules.active.order(:name)
|
||||
@experiment_my_modules = @my_module.experiment.my_modules.where(archived: @my_module.archived?).order(:name)
|
||||
end
|
||||
|
||||
def check_manage_permissions
|
||||
|
|
|
@ -10,7 +10,17 @@
|
|||
|
||||
<% provide(:sidebar_title, t("sidebar.my_module.sidebar_title")) %>
|
||||
|
||||
|
||||
<%= content_for :sidebar do %>
|
||||
<% if @my_module.archived? %>
|
||||
<%= render partial: 'shared/sidebar/archived_my_module.html.erb',
|
||||
locals: {
|
||||
my_modules: @experiment_my_modules,
|
||||
experiment: @my_module.experiment,
|
||||
current_my_module: @my_module
|
||||
}
|
||||
%>
|
||||
<% else %>
|
||||
<%= render partial: 'shared/sidebar/my_module.html.erb',
|
||||
locals: {
|
||||
my_modules: @experiment_my_modules,
|
||||
|
@ -18,6 +28,7 @@
|
|||
current_my_module: @my_module
|
||||
}
|
||||
%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= render partial: 'shared/drag_n_drop_overlay' %>
|
||||
<%= render partial: 'shared/secondary_navigation', locals: { render_breadcrumbs: true, project: @experiment.project, experiment: @experiment } %>
|
||||
|
|
20
app/views/shared/sidebar/_archived_my_module.html.erb
Normal file
20
app/views/shared/sidebar/_archived_my_module.html.erb
Normal file
|
@ -0,0 +1,20 @@
|
|||
<ul class="sidebar-branch">
|
||||
<% if experiment.archived_branch? %>
|
||||
<li class="sidebar-leaf">
|
||||
<%= link_to t('sidebar.my_modules.back_to_archived_button'), project_path(experiment.project, view_mode: :archived), class: 'sidebar-link back-button' %>
|
||||
</li>
|
||||
<% else %>
|
||||
<li class="sidebar-leaf">
|
||||
<%= link_to t('sidebar.my_modules.back_to_active_button'), canvas_experiment_url(experiment), class: 'sidebar-link back-button' %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% my_modules.each do |my_module| %>
|
||||
<li class="sidebar-leaf">
|
||||
<%= link_to my_module.name,
|
||||
protocols_my_module_url(my_module),
|
||||
title: my_module.name,
|
||||
class: "sidebar-link #{'selected' if my_module == current_my_module}",
|
||||
data: { module_id: my_module.id } %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
Loading…
Add table
Reference in a new issue