<!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" />
    <meta name="description" content="AdventureLog Server" />
    <meta name="author" content="Sean Morley" />

    <title>AdventureLog API Server</title>

    <!-- Latest compiled and minified CSS -->
    <link
      rel="stylesheet"
      href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"
    />

    <!-- Optional theme -->
    <link
      rel="stylesheet"
      href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"
    />

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>

  <body role="document">
    <div class="navbar navbar-inverse" role="navigation">
      <div class="container">
        <div class="navbar-header">
          <button
            type="button"
            class="navbar-toggle collapsed"
            data-toggle="collapse"
            data-target=".navbar-collapse"
          >
            <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="/">AdventureLog API Server</a>
        </div>
        <div class="collapse navbar-collapse">
          <ul class="nav navbar-nav">
            <li class="active"><a href="/">Server Home</a></li>
            <li>
              <a target="_blank" href="http://adventurelog.app"
                >Documentation</a
              >
            </li>

            <li>
              <a
                target="_blank"
                href="https://github.com/seanmorley15/AdventureLog"
                >Source Code</a
              >
            </li>
            <li><a href="/docs">API Docs</a></li>
          </ul>
        </div>
        <!--/.nav-collapse -->
      </div>
    </div>

    <div class="container theme-showcase" role="main">
      {% block content %}{% endblock %}
    </div>
    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
    <script type="text/javascript">
      var error_response = function (data) {
        $(".api-response").html(
          "API Response: " +
            data.status +
            " " +
            data.statusText +
            "<br/>Content: " +
            data.responseText
        );
      };
      var susccess_response = function (data) {
        $(".api-response").html(
          "API Response: OK<br/>Content: " + JSON.stringify(data)
        );
      };

      $().ready(function () {
        $("form.ajax-post button[type=submit]").click(function () {
          var form = $("form.ajax-post");
          $.post(form.attr("action"), form.serialize())
            .fail(function (data) {
              error_response(data);
            })
            .done(function (data) {
              susccess_response(data);
            });
          return false;
        });
      });
    </script>
    {% block script %}{% endblock %}
  </body>
</html>
