scinote-web/app/views/shared/_secondary_navigation.html.erb
2022-08-09 10:13:43 +02:00

124 lines
5.8 KiB
Text

<% render_breadcrumbs ||= nil %>
<% experiment ||= nil %>
<% project ||= nil %>
<% content_for :secondary_navigation do %>
<nav class="navbar navbar-default navbar-secondary">
<div class="container-fluid">
<% if render_breadcrumbs %>
<div id="breadcrumbsWrapper" class="breadcrumbs-in-secondary-navigation">
<%= render partial: 'projects/index/breadcrumbs', locals: {target_folder: project.project_folder, project: project, experiment: experiment} %>
</div>
<% end %>
<div class="navbar-header">
<!-- Small devices dropdown button -->
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#secondary-menu" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- buttons -->
<div class="collapse navbar-collapse <%= render_breadcrumbs ? 'with-breadcrumbs' : '' %>" id="secondary-menu">
<!-- True secondary navigation (buttons on the right side) -->
<ul class="nav navbar-nav navbar-right" style="vertical-align: bottom">
<% if all_projects_page? %>
<% if can_read_team?(current_team) %>
<li id="projects-active-nav-tab"
class="<%= 'active' if @current_filter == 'active' %> projects-view-filter"
data-filter="active">
<a href="#" title="<%=t "nav2.all_projects.index" %>">
<span><%=t "nav2.all_projects.index" %></span>
</a>
</li>
<li id="projects-archive-nav-tab"
class="<%= 'active' if @current_filter == 'archived' %> projects-view-filter"
data-filter="archived">
<a href="#" title="<%=t "nav2.all_projects.archive" %>">
<span><%=t "nav2.all_projects.archive" %></span>
</a>
</li>
<li id="projects-all-nav-tab"
class="<%= 'active' if @current_filter == 'all' %> projects-view-filter"
data-filter="all">
<a href="#" title="<%=t "nav2.all_projects.all" %>">
<span><%=t "nav2.all_projects.all" %></span>
</a>
</li>
<li>
<ul class="list-unstyled">
<li>
<div class="projects-view-mode-switch sci-toggles-group" data-toggle="buttons">
<input type="radio" name="projects-view-mode-selector" value="cards" class="sci-toggle-item" checked>
<a href="#projects-cards-view" data-toggle="tab" data-mode="cards" class="sci-toggle-item-label"><i class="fas fa-th-large"></i></a>
<input type="radio" name="projects-view-mode-selector" value="list" class="sci-toggle-item">
<a class="sci-toggle-item-label" href="#projects-table-view" data-toggle="tab" data-mode="table"><i class="fas fa-th-list"></i></a>
</div>
</li>
</ul>
</li>
<% end %>
<% elsif module_page? %>
<% if can_read_experiment?(@my_module.experiment) %>
<li id="steps-nav-tab" class="<%= "active" if is_module_protocols? %>">
<a href="<%= protocols_my_module_url(@my_module) %>" title="<%=t "nav2.modules.steps" %>">
<%=t "nav2.modules.steps" %>
</a>
</li>
<li id="results-nav-tab" class="<%= "active" if is_module_results? %>">
<a href="<%= results_my_module_url(@my_module) %>" title="<%=t "nav2.modules.results" %>">
<%=t "nav2.modules.results" %>
<% @active_results_size = @my_module.results.where(archived:false).size %>
<% if @active_results_size.positive? %>
<sup class="navigation-results-counter"><%= @my_module.archived_branch? ? @my_module.results.size : @active_results_size %></sup>
<% end %>
</a>
</li>
<li id="activities-nav-tab" class="<%= "active" if is_module_activities? %>">
<a href="<%= activities_my_module_url(@my_module) %>" title="<%=t "nav2.modules.activities" %>">
<%=t "nav2.modules.activities" %>
</a>
</li>
<% end %>
<li data-hook="secondary-navigation-tabs"></li>
<% if can_read_experiment?(@my_module.experiment) && !@my_module.archived_branch? %>
<li id="archive-nav-tab" class="<%= "active" if is_module_archive? %>">
<a href="<%= archive_my_module_url(@my_module) %>" title="<%= t'nav2.modules.archive' %>">
<%=t "nav2.modules.archive" %>
<% @archived_results_size = @my_module.results.where(archived:true).size %>
<% if @archived_results_size.positive? %>
<sup class="navigation-results-counter"><%= @archived_results_size %></sup>
<% end %>
</a>
</li>
<% end %>
<% end %>
</ul>
<!-- Secondary navigation title -->
<h1 class="nav-name <%= @inline_editable_title_config.present? ? 'editable' : '' %>" data-hook="secondary-navigation-title-name">
<% if @inline_editable_title_config.present? %>
<%= render partial: "shared/inline_editing",
locals: {
initial_value: title_element.name,
config: @inline_editable_title_config
} %>
<% else %>
<% if title_element.archived_branch? %>
<i class="fas fa-archive"></i>&nbsp;
<% end %>
<%= title_element.name %>
<% end %>
</h1>
</div>
</div>
</nav>
<%= javascript_include_tag('secondary_navigation') %>
<% end %>