<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>{{template "title" .}}</title>

    <link href="/public/bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="/public/bower_components/bootstrap/dist/css/bootstrap-theme.min.css" rel="stylesheet">
    <link href="/public/inbucket.css" rel="stylesheet">
    <link href="/public/favicon.png" rel="shortcut icon" type="image/png">
    <script src="/public/bower_components/jquery/dist/jquery.min.js"></script>
    <script src="/public/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
    <script src="/public/bower_components/clipboard/dist/clipboard.min.js"></script>
    <script src="/public/bower_components/jquery-load-template/dist/jquery.loadTemplate.min.js"></script>
    <script src="/public/bower_components/moment/min/moment.min.js"></script>
    {{template "script" .}}
  </head>
  <body>
    <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="/">@ inbucket</a>
        </div>
        <div id="navbar" class="collapse navbar-collapse">
          <ul class="nav navbar-nav">
            {{with .ctx.Session.Values.recentMailboxes}}
            <li id="nav-mail" class="dropdown">
              <a class="dropdown-toggle"
                 href="#"
                 accesskey="1"
                 data-toggle="dropdown"
                 role="button"
                 aria-haspopup="true"
                 aria-expanded="false">Recent Mailboxes <span class="caret"></span></a>
              <ul class="dropdown-menu">
                {{range .}}
                <li><a href="{{reverse "MailboxIndex"}}?name={{.}}">{{.}}</a></li>
                {{end}}
              </ul>
            </li>
            {{end}}
            {{if .ctx.WebConfig.MonitorVisible}}
            <li id="nav-monitor"><a href="/monitor" accesskey="2">Monitor</a></li>
            {{end}}
            <li id="nav-status"><a href="/status" accesskey="3">Status</a></li>
          </ul>
          <form class="navbar-form navbar-right" action="{{reverse "MailboxIndex"}}" method="GET">
            <div class="form-group">
              <div class="input-group">
                <input name="name"
                       type="text"
                       placeholder="mailbox"
                       class="form-control"
                       aria-describedby="at-inbucket-addon"/>
                {{with .ctx.WebConfig.MailboxPrompt}}
                <span class="input-group-addon" id="at-inbucket-addon">{{.}}</span>
                {{end}}
              </div>
            </div>
            <button type="submit" class="btn btn-success">View</button>
          </form>
        </div><!--/.nav-collapse -->
      </div>
    </nav>

    <div class="container">
      {{with .errorFlash}}
      <div class="alert alert-danger">
        <p>Please fix the following errors and try again:<p>
        <ul>
          {{range .}}
          <li>{{.}}</li>
          {{end}}
        </ul>
      </div>
      {{end}}

      {{template "content" .}}
    </div>

    <footer class="footer">
      <div class="container">
        <p class="text-muted">
        <a href="http://www.inbucket.org/">Inbucket</a> is an open source project hosted at
        <a href="http://github.com/jhillyerd/inbucket">github</a>.
        Design by <a href="http://getbootstrap.com/">Bootstrap</a>.
        </p>
      </div>
    </footer>
  </body>
</html>
