<!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="Django-dj-rest-auth demo" />
    <meta name="author" content="iMerica, Inc." />

    <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">
        <ul class="nav navbar-nav navbar-right">
          <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown"
              >API endpoints <span class="caret"></span
            ></a>

            <ul class="dropdown-menu" role="menu">
              <!-- these pages don't require user token -->
              <li><a href="{% url 'signup' %}">Signup</a></li>
              <li>
                <a href="{% url 'email-verification' %}">E-mail verification</a>
              </li>
              <li>
                <a href="{% url 'resend-email-verification' %}"
                  >Resend E-mail verification</a
                >
              </li>
              <li><a href="{% url 'login' %}">Login</a></li>
              <li><a href="{% url 'password-reset' %}">Password Reset</a></li>
              <li>
                <a href="{% url 'password-reset-confirm' %}"
                  >Password Reset Confirm</a
                >
              </li>
              <li class="divider"></li>
              <!-- these pages require user token -->
              <li><a href="{% url 'user-details' %}">User details</a></li>
              <li><a href="{% url 'logout' %}">Logout</a></li>
              <li><a href="{% url 'password-change' %}">Password change</a></li>
            </ul>
          </li>
        </ul>

        <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="/">Demo</a></li>
            <li>
              <a
                target="_blank"
                href="http://dj-rest-auth.readthedocs.org/en/latest/"
                >Documentation</a
              >
            </li>
            <li>
              <a target="_blank" href="https://github.com/iMerica/dj-rest-auth"
                >Source code</a
              >
            </li>
            <li><a target="_blank" href="{% url 'api_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>
