fixed navigation link

This commit is contained in:
zmagod 2016-12-14 10:35:48 +01:00
parent 4b0e2baa3f
commit 9037ab3f48
4 changed files with 38 additions and 10 deletions

View file

@ -13,18 +13,34 @@ module ApplicationHelper
end
def sample_types_page_project?
controller_name == 'sample_types' && !(defined? @my_module)
controller_name == 'sample_types' &&
@my_module.nil? &&
@experiment.nil?
end
def sample_groups_page_project?
controller_name == 'sample_groups' && !(defined? @my_module)
controller_name == 'sample_groups' &&
@my_module.nil? &&
@experiment.nil?
end
def sample_types_page_my_module?
controller_name == 'sample_types' && defined? @my_module
controller_name == 'sample_types' && !@my_module.nil?
end
def sample_groups_page_my_module?
controller_name == 'sample_groups' && defined? @my_module
controller_name == 'sample_groups' && !@my_module.nil?
end
def sample_groups_page_experiment?
controller_name == 'sample_groups' &&
@my_module.nil? &&
!@experiment.nil?
end
def sample_types_page_expermient?
controller_name == 'sample_types' &&
@my_module.nil? &&
!@experiment.nil?
end
end

View file

@ -105,7 +105,9 @@
</li>
<% end %>
<% elsif experiment_page? %>
<% elsif experiment_page? ||
sample_groups_page_experiment? ||
sample_types_page_expermient? %>
<% if can_view_experiment(@experiment) then %>
<li id="canvas-nav-tab" class="<%= "active" if is_experiment_canvas? %>">
<a href="<%= canvas_experiment_url(@experiment) %>" title="<%=t "nav2.experiments.canvas" %>">
@ -115,7 +117,9 @@
</li>
<% end %>
<% if can_view_experiment_samples(@experiment) then %>
<li id="experiment-samples-nav-tab" class="<%= "active" if is_experiment_samples? %>">
<li id="experiment-samples-nav-tab" class="<%= "active" if is_experiment_samples? ||
sample_groups_page_experiment? ||
sample_types_page_expermient? %>">
<a href="<%= samples_experiment_url(@experiment) %>" title="<%=t "nav2.projects.samples" %>">
<span class="hidden-sm hidden-md"><%=t "nav2.projects.samples" %></span>
<span class="hidden-xs hidden-lg glyphicon glyphicon-tint"></span>
@ -223,8 +227,12 @@
<% if experiment_page? ||
module_page? ||
sample_types_page_my_module? ||
sample_groups_page_my_module? %>
<% if !module_page? %>
sample_groups_page_my_module? ||
sample_groups_page_experiment? ||
sample_types_page_expermient? %>
<% if !module_page? &&
!sample_types_page_my_module? &&
!sample_groups_page_my_module? %>
<li class="active">
<%= truncate(@experiment.name,
length: Constants::NAME_TRUNCATION_LENGTH) %>

View file

@ -14,7 +14,9 @@
<div class="tree">
<ul>
<% if project_page? %>
<% if project_page? ||
sample_types_page_project? ||
sample_groups_page_project? %>
<li class="active">
<span class="tree-link line-wrap">
<i></i>

View file

@ -1,7 +1,9 @@
<ul>
<% if project.active_experiments.present? then %>
<% project.active_experiments.each do |experiment| %>
<% if experiment_page? && experiment == @experiment %>
<% if (experiment_page? ||
sample_groups_page_experiment? ||
sample_types_page_expermient?) && experiment == @experiment %>
<li class="active" data-parent="candidate">
<span class="tree-link line-wrap">
<i></i>