<!DOCTYPE html>
<html lang="zh_CN">

  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
    <meta name="renderer" content="webkit">
    <meta name="screen-orientation" content="portrait">
    <meta name="x5-orientation" content="portrait">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
    <link rel="apple-touch-icon" href="/favicon.ico">
    <link rel="stylesheet" href="{{ static_url('bower_components/layui/dist/css/layui.css') }}">
    <link rel="stylesheet" href="{{ static_url('src/css/style.css') }}">
    <title>File Server</title>
  </head>

  <body>
    <header id="header">
      <div class="layui-container">
        <a class="logo" href="/"><i class="layui-icon layui-icon-home"></i> Home</a>
        <ul class="layui-nav">
          {% if handler.app.options.auth %}
          <li class="layui-nav-item">
            <a href="/disk/public"><i class="layui-icon layui-icon-heart"></i> Public</a>
          </li>
          {% end %}
          <li class="layui-nav-item">
            <form class="pc layui-form">
              <input class="layui-input" placeholder="搜索" name="q" {% if handler.args.q %}value="{{ handler.args.q }}"{% end %}>
            </form>
          </li>
        </ul>
        {% if handler.app.options.auth %}
        <ul class="layui-nav nav-right" lay-filter="">
          <li class="layui-nav-item logout layui-hide">
            <a href="javascript:;"><span class="username"></span></a>
            <dl class="layui-nav-child">
              <dd><a href="/admin">用户中心</a></dd>
              <dd><a href="/share">我的分享</a></dd>
              <dd class="layui-hide user-admin"><a href="/manage">用户管理</a></dd>
              <dd><a class="user-logout" href="/logout">退出</a></dd>
            </dl>
          </li>
          <li class="layui-nav-item login layui-hide"><a href="/signin">登录</a></li>
          <li class="layui-nav-item login layui-hide"><a href="/signup">注册</a></li>
        </ul>
        {% end %}
      </div>
    </header>
    <div id="content">
      {% block page-content %}
      <div class="layui-container">{% block content %}{% end %}</div>
      {% end %}
    </div>

  </body>
  <script src="{{ static_url('bower_components/jquery/dist/jquery.min.js') }}"></script>
  <script src="{{ static_url('bower_components/layui/dist/layui.js') }}"></script>
  <script src="{{ static_url('bower_components/clipboard/dist/clipboard.min.js') }}"></script>
  <script src="{{ static_url('bower_components/fex-webuploader/dist/webuploader.nolog.min.js') }}"></script>
  <script src="{{ static_url('src/js/imagesloaded.pkgd.min.js') }}"></script>
  <script src="{{ static_url('src/js/masonry.pkgd.min.js') }}"></script>
  <script src="{{ static_url('src/js/utils.js') }}"></script>
  <script src="{{ static_url('src/js/page.js') }}"></script>

  <script>
    layui.use(['element', 'laydate', 'laypage'], function () {
      layui.laydate.render({elem: 'input[name=startdate]'})
      layui.laydate.render({elem: 'input[name=enddate]'})

      var laypage = layui.laypage;
      var element = layui.element;
      {% if handler.args.total and handler.args.total > 0 %}
      var params = parseUrl().params;
      laypage.render({
        elem: 'pagination',
        limit: {{ handler.args.count }},
        count: {{ handler.args.total }},
        curr: {{ handler.args.page }},
        layout: ['page', 'count'],
        jump: function(obj, first){
          if(!first){
            params.page = obj.curr;
            location.href = location.pathname + '?' + layui.$.param(params);
          }
        }
      });
      {% end %}
    })
  </script>

</html>
