<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <% if @refresh %>
      <meta http-equiv="refresh" content="300"/>
    <% end %>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="<%= Debci.config.distro_name %> Continuous Integration Results">
    <meta name="author" content="The Debian Project">
    <title><%= Debci.config.distro_name %> Continuous Integration<% if defined?(@moretitle) %> - <%= @moretitle %><% end %></title>
    <link rel="icon" type="image/png" href="/debian.png"/>
    <link rel="stylesheet" type="text/css" href="/bootstrap/css/bootstrap.css"/>
    <link rel="stylesheet" type="text/css" href="/bootstrap/css/bootstrap-theme.css"/>
    <link rel="stylesheet" type="text/css" href="/style.css"/>
    <link rel="stylesheet" type="text/css" href="/font-awesome/css/font-awesome.min.css"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <% if defined?(@head) %>
      <%== @head %>
    <% end %>
  </head>
  <body>
    <div id='wrap'>

      <!-- Fixed navbar -->
      <div class="navbar navbar-default">
        <div class="container">
          <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand hidden-xs" href="/"><%= Debci.config.distro_name %> Continuous Integration</a>
            <a class="navbar-brand visible-xs" href="/"><%= Debci.config.distro_name %> CI</a>
          </div>
          <div class="collapse navbar-collapse">
            <ul class="nav navbar-nav">
              <li><a href="/">Home</a></li>
              <li><a href="/status/">Status</a></li>
              <li><a href="/doc/">Documentation</a></li>
              <li><a href="/api/">API</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
              <% if defined?(@user) && @user %>
                <li class="nav-item dropdown">
                  <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">
                    <%= @user.username %>
                    <i class="fa fa-caret-down"></i>
                  </a>
                  <ul class="dropdown-menu dropdown-menu-right">
                    <li>
                      <a class="dropdown-item" href="/user/<%= @user.username %>">
                        Self Service panel
                      </a>
                    </li>
                    <li class="divider" style="margin: 0.25rem 0;"></li>
                    <li>
                      <a class="dropdown-item" href="/user/<%= @user.username %>/test">
                        Request Test
                      </a>
                    </li>
                    <li>
                      <a class="dropdown-item" href="/user/<%= @user.username %>/jobs">
                        Job History
                      </a>
                    </li>
                    <li>
                      <a class="dropdown-item" href="/user/<%= @user.username %>/keys">
                        Manage API keys
                      </a>
                    </li>
                    <% if @user.admin %>
                      <li>
                        <a class="dropdown-item" href="/admin/">
                          Admin Interface
                        </a>
                      </li>
                    <% end %>
                    <li class="divider" style="margin: 0.25rem 0;"></li>
                    <li>
                      <a class="dropdown-item" href="/user/logout">
                        Logout
                      </a>
                    </li>
                  </ul>
                </li>
              <% else %>
                <li><a href="/user/login?original_url=<%= request.path %>">Login</a></li>
              <% end %>
            </ul>
          </div><!--/.nav-collapse -->
        </div>
      </div>

      <div class="container">
        <%== yield %>
      </div>

      <div id="footer">
        <div class="container">
          <div class='row'>
            <p class='text-muted credit'>
            debci - Copyright © 2014-<%= Time.now.year %> the debci development team. This is free
            software licensed under the GNU General Public License version 3 or
            later. Source code on
            <a href="https://salsa.debian.org/ci-team/debci">git repository</a>
            </p>
            <p class='text-muted'>
            This page was generated on <%= Time.now.utc.to_s %>
            </p>
          </div>
        </div>
      </div>
    </div>

    <% @root ||= "" %>
    <script type="text/javascript" src="<%= @root %>/jquery.js"></script>
    <script type="text/javascript" src="<%= @root %>/jquery.flot.js"></script>
    <script type="text/javascript" src="<%= @root %>/jquery.flot.time.js"></script>
    <script type="text/javascript" src="<%= @root %>/jquery.flot.stack.js"></script>
    <script type="text/javascript" src="<%= @root %>/bootstrap/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="<%= @root %>/app.js"></script>
    <% if defined?(@footer) %>
      <%== @footer %>
    <% end %>
  </body>
</html>
