2016-02-12 23:52:43 +08:00
|
|
|
module SidebarHelper
|
|
|
|
def project_action_to_link_to(project)
|
|
|
|
case action_name
|
2016-08-24 15:14:29 +08:00
|
|
|
when 'samples'
|
2016-02-12 23:52:43 +08:00
|
|
|
return samples_project_path(project)
|
2016-08-24 15:14:29 +08:00
|
|
|
when 'archive', 'module_archive', 'experiment_archive'
|
2016-07-28 17:05:28 +08:00
|
|
|
return experiment_archive_project_url(project)
|
2016-02-12 23:52:43 +08:00
|
|
|
else
|
2016-07-28 22:41:10 +08:00
|
|
|
return project_path(project)
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-07-29 21:47:41 +08:00
|
|
|
def experiment_action_to_link_to(experiment)
|
2016-08-24 15:05:57 +08:00
|
|
|
case action_name
|
|
|
|
when 'samples'
|
|
|
|
return samples_experiment_path(experiment)
|
2016-08-24 15:14:29 +08:00
|
|
|
when 'archive', 'module_archive', 'experiment_archive'
|
2016-08-24 15:05:57 +08:00
|
|
|
return module_archive_experiment_url(experiment)
|
|
|
|
else
|
|
|
|
return canvas_experiment_path(experiment)
|
|
|
|
end
|
2016-07-29 21:47:41 +08:00
|
|
|
end
|
|
|
|
|
2016-02-12 23:52:43 +08:00
|
|
|
def module_action_to_link_to(my_module)
|
2017-06-13 15:09:07 +08:00
|
|
|
if action_name == 'results'
|
2017-06-09 18:51:33 +08:00
|
|
|
results_my_module_url(my_module)
|
2017-06-13 15:09:07 +08:00
|
|
|
elsif action_name == 'activities'
|
2017-06-09 18:51:33 +08:00
|
|
|
activities_my_module_url(my_module)
|
2017-06-13 15:09:07 +08:00
|
|
|
elsif action_name == 'samples'
|
2017-06-09 18:51:33 +08:00
|
|
|
samples_my_module_url(my_module)
|
2017-06-13 15:09:07 +08:00
|
|
|
elsif action_name.in?(%w(archive module_archive experiment_archive))
|
2017-06-09 18:51:33 +08:00
|
|
|
archive_my_module_url(my_module)
|
2017-06-13 15:09:07 +08:00
|
|
|
elsif action_name == 'repository' && @repository
|
2017-06-09 18:51:33 +08:00
|
|
|
repository_my_module_url(
|
|
|
|
id: my_module.id,
|
|
|
|
repository_id: @repository.id
|
|
|
|
)
|
2016-02-12 23:52:43 +08:00
|
|
|
else
|
2017-06-09 18:51:33 +08:00
|
|
|
protocols_my_module_url(my_module)
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|