Merge pull request #3041 from okriuchykhin/ok_SCI_5327

Fix links in sidebar navigation [SCI-5327]
This commit is contained in:
Alex Kriuchykhin 2021-01-04 10:53:38 +01:00 committed by GitHub
commit 4638e74e1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 34 deletions

View file

@ -1,31 +0,0 @@
module SidebarHelper
def project_action_to_link_to(project)
case action_name
when 'archive', 'module_archive', 'experiment_archive'
return experiment_archive_project_url(project)
else
return project_path(project)
end
end
def experiment_action_to_link_to(experiment)
case action_name
when 'archive', 'module_archive', 'experiment_archive'
return module_archive_experiment_url(experiment)
else
return canvas_experiment_path(experiment)
end
end
def module_action_to_link_to(my_module)
if action_name == 'results'
results_my_module_url(my_module)
elsif action_name == 'activities'
activities_my_module_url(my_module)
elsif action_name.in?(%w(archive module_archive experiment_archive))
archive_my_module_url(my_module)
else
protocols_my_module_url(my_module)
end
end
end

View file

@ -11,7 +11,7 @@
<% my_modules.each do |my_module| %>
<li class="sidebar-leaf">
<%= link_to my_module.name,
module_action_to_link_to(my_module),
protocols_my_module_url(my_module),
class: 'sidebar-link',
data: { module_id: my_module.id } %>
</li>

View file

@ -8,7 +8,7 @@
</li>
<% project.sorted_experiments(@current_sort, archived).each do |experiment| %>
<li class="sidebar-leaf">
<%= link_to experiment.name, experiment_action_to_link_to(experiment), class: 'sidebar-link' %>
<%= link_to experiment.name, canvas_experiment_path(experiment), class: 'sidebar-link' %>
</li>
<% end %>
<% unless archived %>

View file

@ -5,7 +5,7 @@
<% my_modules.each do |my_module| %>
<li class="sidebar-leaf">
<%= link_to my_module.name,
module_action_to_link_to(my_module),
protocols_my_module_url(my_module),
class: 'sidebar-link',
data: { module_id: my_module.id } %>
<% if action_name == 'canvas' %>