{% load static %}
{% load i18n %}
<!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="/">{% trans "首页" %}</a></li>
        {% if u.is_admin %}
        <li class="layui-nav-item"><a href="/api/work?show_type=admin">{% trans "所有设备" %}</a>
        </li>
        {% endif %}
        <li class="layui-nav-item"><a href="/api/share">{% trans "分享" %}</a></li>
        <li class="layui-nav-item"><a href="/webui" target="_blank">{% trans "网页控制" %}</a></li>

        {% if u.is_admin %}
        <li class="layui-nav-item">
            <a href="">{% trans "日志" %}</a>
            <dl class="layui-nav-child">
                <dd><a href="/api/conn_log">{% trans "连接日志" %}</a></dd>
                <dd><a href="/api/file_log">{% trans "文件传输日志" %}</a></dd>
            </dl>
        </li>
        <li class="layui-nav-item"><a href="/admin" target="_blank">{% trans "管理后台" %}</a></li>
        {% endif %}
        <li class="layui-nav-item"><a href="/api/user_action?action=logout" target="_blank">{% trans "退出" %}</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>