<%= content_for :ready_function do %>
  $("#advanced_tabs_trigger").click(function() {
    $("#advanced_tabs").show();
    $("#advanced_list_item").hide();
  });
<% end %>

<div class="box-header header-tabs" id="project_tabs">
  <ul>
    <%= tab 'overview', 'Overview', :controller => :project, :action => :show %>
    <% if @is_maintenance_project && !@spider_bot %>
      <%= tab 'incidents', 'Incidents', :controller => :project, :action => :maintenance_incidents %>
      <%= tab 'maintained', 'Maintained Projects', :controller => :project, :action => :maintained_projects %>
    <% else %> <!-- also for incident project -->
      <%= tab 'repositories', "Repositories", :controller => :repositories, :action => :index unless @project.defines_remote_instance? || @spider_bot %>
    <% end %>
    <% if @project.repositories.any? && !@spider_bot -%>
      <%= tab 'monitor', "Monitor", :controller => :project, :action => :monitor %>
    <% end -%>
    <% unless @spider_bot -%>
      <%= tab 'requests', "Requests", :controller => :project, :action => 'requests' %>
      <%= tab 'users', 'Users', :controller => :project, :action => :users unless @project.defines_remote_instance? %>
      <%= tab 'subprojects', 'Subprojects', :controller => :project, :action => :subprojects unless @project.defines_remote_instance? || @is_maintenance_project %>
    <% end -%>
  
    <% if is_advanced_tab? %>
      <%= content_for :ready_function do %>
        $("#advanced_tabs").show();
      <% end %>
    <% else %>
      <li id="advanced_list_item"><a href="#" id="advanced_tabs_trigger">Advanced</a></li>
    <% end %>
  </ul>
  <div id="advanced_tabs" class="hidden">
    <ul>
      <%= tab 'projectconfig', 'Project Config', :controller => :project, :action => :prjconf unless @project.defines_remote_instance? || @is_maintenance_project %>
      <% unless @spider_bot -%>
        <%= tab 'attribute', 'Attributes', :controller => :attribute, :project => @project, :action => 'index' %>
        <%= tab 'meta', "Meta", :controller => :project, :action => :meta %>
        <%= tab 'status', 'Status', :controller => :project, :action => :status unless @project.defines_remote_instance? || @is_maintenance_project %>
      <% end -%>
    </ul>
  </div>
</div>
