{% load static %}
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>{% block title %}{% endblock %}</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="{% static 'layui/css/layui.css' %}">
    {% block link %}{% endblock %}
</head>

<body>
    <script src={% static "layui/layui.js" %}></script>
    <script>
        layui.use('element', function () {
            var element = layui.element; //导航的hover效果、二级菜单等功能，需要依赖element模块

            //监听导航点击
            element.on('nav(demo)', function (elem) {
                //console.log(elem)
                layer.msg(elem.text());
            });
        });
    </script>

    <ul class="layui-nav">
        <li class="layui-nav-item"><a href="/">首页</a></li>
        <li class="layui-nav-item"><a href="/api/share">分享</a></li>
        <li class="layui-nav-item"><a href="/webui" target="_blank">网页控制</a></li>

        {% if u.is_admin %}
        <li class="layui-nav-item"><a href="/admin" target="_blank">管理后台</a>
        </li>
        {% endif %}
        <li class="layui-nav-item"><a href="/api/user_action?action=logout" target="_blank">退出</a></li>
    </ul>

    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>{% block legend_name %}{% endblock %}</legend>
    </fieldset>
    {% block content %}{% endblock %}
</body>

</html>