<% content_for :secondary_navigation do %>
<nav class="navbar navbar-default navbar-secondary">
  <div class="container-fluid">

    <!-- header -->
    <div class="navbar-header">
      <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>
      <ul class="breadcrumb hidden-sm hidden-md hidden-lg">
        <% if is_project_page? or is_project_activities_page? %>
          <li class="active">
        <% else %>
          <li>
        <% end %>
           <% if can_view_project(@project) %>
              <a href="<%= canvas_project_url(@project) %>">
            <% end %>
            <%= @project.name %>
            <% if can_view_project(@project) %>
              </a>
            <% end %>
          </li>
        <% if is_module_page? %>
          <li class="active">
            <% if can_view_module(@my_module) %>
              <a href="<%= protocols_my_module_path(@my_module) %>">
            <% end %>
            <%= @my_module.name %>
            <% if can_view_project(@project) %>
              </a>
            <% end %>
          </li>
        <% end %>
      </ul>
    </div>

    <!-- buttons -->
    <div class="collapse navbar-collapse" id="secondary-menu">
      <ul class="nav navbar-nav navbar-right" style="vertical-align: bottom">
        <% if is_project_page? or is_project_activities_page? %>
          <!-- TEMPORARY HIDDEN -->
          <!--<li class="<%= "active" if is_project_info? %>">
            <a href="<%= project_url(@project) %>"><span class="glyphicon glyphicon-info-sign"></span></a>
          </li>-->
          <% if can_view_project(@project) then %>
            <li id="canvas-nav-tab" class="<%= "active" if is_project_canvas? %>">
              <a href="<%= canvas_project_url(@project) %>" title="<%=t "nav2.projects.canvas" %>">
                <span class="hidden-sm hidden-md"><%=t "nav2.projects.canvas" %></span>
                <span class="hidden-xs hidden-lg glyphicon glyphicon-blackboard"></span>
              </a>
            </li>
          <% end %>
          <% if can_view_project_samples(@project) then %>
            <li id="project-samples-nav-tab" class="<%= "active" if is_project_samples? %>">
              <a href="<%= samples_project_url(@project) %>" 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>
              </a>
            </li>
          <% end %>
          <!-- TEMPORARY HIDDEN -->
          <!--<li class="<%= "active" if is_project_activities? %>">
            <a href="<%= project_project_activities_url(@project) %>"><%=t "nav2.projects.activities" %></a></a>
          </li>-->
          <% if can_view_reports(@project) then %>
            <li id="reports-nav-tab" class="<%= "active" if is_project_reports? %>">
              <a href="<%= project_reports_url(@project) %>" title="<%=t "nav2.projects.reports" %>">
                <span class="hidden-sm hidden-md"><%=t "nav2.projects.reports" %></span>
                <span class="hidden-xs hidden-lg glyphicon glyphicon-list-alt"></span>
              </a>
            </li>
          <% end %>
          <% if can_view_project_archive(@project) then %>
            <li id="project-archive-nav-tab" class="<%= "active" if is_project_archive? %>">
              <a href="<%= module_archive_project_url(@project) %>"><span class="glyphicon glyphicon-briefcase"></span></a>
            </li>
          <% end %>

        <% elsif is_module_page? %>
          <!-- TEMPORARY HIDDEN -->
          <!--<li class="<%= "active" if is_module_info? %>">
            <a href="<%= my_module_url(@my_module) %>"><span class="glyphicon glyphicon-info-sign"></span></a>
          </li>-->
          <% if can_view_module_protocols(@my_module) then %>
            <li id="steps-nav-tab" class="<%= "active" if is_module_protocols? %>">
              <a href="<%= protocols_my_module_url(@my_module) %>" title="<%=t "nav2.modules.steps" %>">
                <span class="hidden-sm hidden-md"><%=t "nav2.modules.steps" %></span>
                <span class="hidden-xs hidden-lg glyphicon glyphicon-circle-arrow-right"></span>
              </a>
            </li>
          <% end %>
          <% if can_view_results_in_module(@my_module) then %>
            <li id="results-nav-tab" class="<%= "active" if is_module_results? %>">
              <a href="<%= results_my_module_url(@my_module) %>" title="<%=t "nav2.modules.results" %>">
                <span class="hidden-sm hidden-md"><%=t "nav2.modules.results" %></span>
                <span class="hidden-xs hidden-lg glyphicon glyphicon-th"></span>
              </a>
            </li>
          <% end %>
          <% if can_view_module_activities(@my_module) then %>
            <li id="activities-nav-tab" class="<%= "active" if is_module_activities? %>">
              <a href="<%= activities_my_module_url(@my_module) %>" title="<%=t "nav2.modules.activities" %>">
                <span class="hidden-sm hidden-md"><%=t "nav2.modules.activities" %></span>
                <span class="hidden-xs hidden-lg glyphicon glyphicon-equalizer"></span>
              </a>
            </li>
          <% end %>
          <% if can_view_module_samples(@my_module) then %>
            <li id="module-samples-nav-tab" class="<%= "active" if is_module_samples? %>">
              <a href="<%= samples_my_module_url(@my_module) %>" title="<%=t "nav2.modules.samples" %>">
                <span class="hidden-sm hidden-md"><%=t "nav2.modules.samples" %></span>
                <span class="hidden-xs hidden-lg glyphicon glyphicon-tint"></span>
              </a>
            </li>
          <% end %>
          <% if can_view_reports(@my_module.project) then %>
            <li id="reports-nav-tab" >
              <a href="<%= project_reports_url(@my_module.project) %>" title="<%=t "nav2.projects.reports" %>">
                <span class="hidden-sm hidden-md"><%=t "nav2.projects.reports" %></span>
                <span class="hidden-xs hidden-lg glyphicon glyphicon-list-alt"></span>
              </a>
            </li>
          <% end %>
          <% if can_view_module_archive(@my_module) then %>
            <li id="archive-nav-tab" class="<%= "active" if is_module_archive? %>">
              <a href="<%= archive_my_module_url(@my_module) %>">
                <span class="glyphicon glyphicon-briefcase" title="<%= t'nav2.modules.archive' %>"></span></a>
            </li>
          <% end %>

        <% end %>
      </ul>
      <ul class="breadcrumb hidden-xs">
        <li>
          <% if can_view_projects(@project.organization) %>
            <a href="<%= projects_path :organization => @project.organization.id %>">
          <% end %>
          <%= truncate( @project.organization.name, length: 20 ) %>
          <% if can_view_projects(@project.organization) %>
            </a>
          <% end %>
        </li>
        <% if is_project_page? or is_project_activities_page? %>
          <li class="active">
        <% else %>
          <li>
        <% end %>
           <% if can_view_project(@project) %>
              <a href="<%= canvas_project_url(@project) %>">
            <% end %>
            <%= truncate( @project.name, length: 20 ) %>
            <% if can_view_project(@project) %>
              </a>
            <% end %>
          </li>
        <% if is_module_page? %>
          <li class="active">
            <% if can_view_module(@my_module) %>
              <a href="<%= protocols_my_module_path(@my_module) %>">
            <% end %>
            <%= truncate( @my_module.name, length: 20 ) %>
            <% if can_view_project(@project) %>
              </a>
            <% end %>
          </li>
        <% end %>
      </ul>
    </div>
  </div>
</nav>
<% end %>
