{% extends base.html %}

{% block head %}
<style type="text/css">
  .content-left {
    width: 100%;
  }
  .login-input {
    width: 100%;
    min-width: 200px;
    padding: 12px;
    border-radius: 0px;
    outline: none;
    margin-bottom: 5px;
    border: 1px solid #ccc;
  }

  .login-submit {
    padding: 12px 24px;
    border-radius: 5px;
  }

  .login-submit:hover {
    border-radius: 5px;
  }

  .input-header {
    padding-top: 3px;
    size: 14px;
    background-color: transparent;
  }

  .nav {
    display: none;
  }

  .nav-left {
    display: none;
  }

  .x-body {
    left: 0px;
  }

  .login-box {
    width: 350px;
    background-color: #fff;
    margin: 0 auto;
    margin-top: 100px;
    border-radius: 5px;
  }

  .login-box-inner {
    background-color: #fff;
    border-radius: 5px;
  }

  .login-header {
    float: left;
    width: 100%;
    padding: 10px;
    color: black;
    font-size: 16px;
    text-align: center;
  }

  .login-body {
    float: left;
    width: 100%;
    padding: 50px 10px 50px 10px;
    background-color: #fff;
  }

  .login-footer {
    float: left;
    width: 100%;
    background-color: #fff;
    padding: 0px 10px 10px 10px;
    text-align: center;
  }

  .nav-left-search {
    display: none;
  }

  .main-content {
    width: 100%;
  }

  @media screen and (max-width: 1000px) {
    .x-body {
      padding: 0px;
      background-color: transparent;
    }

    .main-content {
      padding: 0px;
    }

    .login-box {
      width: 100%;
      height: 100%;
      margin-top: 0px;
      margin-bottom: 0px;
    }

    .login-box-inner {
      background-color: transparent;
      border-radius: 0px;
    }

    .login-body {
      position: absolute;
      background-color: transparent;
    }

    .login-footer {
      position: absolute;
      bottom: 10px;
      text-align: center;
      background-color: transparent;
    }
  }
</style>
{% end %}

{% block body %}

<div class="login-box">
  <div class="col-md-12 login-box-inner">
    <div class="login-header">登录Xnote</div>

    {% if error != "" and error != None %}
    <div class="col-md-12 error">{{error}}</div>
    {% end %}

    <div class="login-body">
      <form id="loginForm" name="loginForm" method="POST">
        <input class="login-input" type="text" name="username" value="{{username}}" placeholder="账户名" />
        <input class="login-input" type="password" name="password" value="{{password}}" placeholder="密码" />
        <input type="text" name="test" value="Test" class="hide">
        <button class="btn login-submit login-input" type="submit" value="Login" id="loginBtn">登录</button>
      </form>
    </div>

    <div class="login-footer">
      <a href="{{_server_home}}/" class="link">返回首页</a>
    </div>
  </div>
</div>

<script type="text/javascript">
  xnote.config.skipLayoutAdjust = true;
  $(function () {
    function adjustLoginBody() {
      var winWidth = getWindowWidth();

      if (winWidth < 1000) {
        var height = $(".login-body").outerHeight();
        $(".login-body").css("top", (getWindowHeight() - height) / 2);
      } else {
        var height = $(".login-box-inner").outerHeight();
        $(".login-box").css("margin-top", (getWindowHeight() - height) / 2);
      }

      $(".mobile-search").hide();
      $(".x-body").css("margin-top", 0);
    }

    adjustLoginBody();
    window.onresize = adjustLoginBody;
  })
</script>

{% end %}