MrDoc/template/app_doc/head_base.html
2020-12-06 01:33:59 +08:00

115 lines
5.4 KiB
HTML

{% load static %}
{% load i18n %}
<div class="layui-header layui-fluid">
<div class="" style="display:flex;flex-direction:row;justify-content:space-between;">
<!-- LOGO -->
<div class="">
<a class="logo" href="{% url 'pro_list' %}">
<img src="{% static 'logo.jpg' %}" style="height: 32px;width: auto;">
</a>
</div>
<!-- 搜索框 -->
<div style="margin:12px;" class="layui-hide-xs">
<form method="get" action="{% url 'doc_search' %}" target="_blank">
<div class="layui-input-inline">
<input class="layui-input mrdoc-search-input" placeholder="{% trans '搜索文档' %}" name="q"/>
<button type="submit" style="position: absolute;top:12px;right: 8px;border: none;background-color: white;">
<i class="layui-icon layui-icon-search" ></i>
</button>
</div>
</form>
</div>
<div class="layui-hide-lg layui-hide-md layui-hide-sm" style="margin:20px;">
<a href="{% url 'search' %}">
<i class="layui-icon layui-icon-search" style="font-size: 24px;"></i>
</a>
</div>
<!-- 新建文档按钮 -->
<div class="layui-hide-xs">
<ul class="layui-nav">
<li class="layui-nav-item">
<a>
<i class="layui-icon layui-icon-add-circle" style="color:black;"></i> <span>{% trans "新建" %}</span>
</a>
<dl class="layui-nav-child">
<dd>
<a href="{% url 'create_doc' %}" target="_blank">
<img src="{% static 'icon_img/create-doc-icon.svg' %}" height="14px" width="14px"></img>
<span class="layui-hide-xs">{% trans "新建文档" %}</span>
</a>
</dd>
{% if request.user.is_authenticated %}
<dd>
<a href="javascript:void(0);" onclick="createPro();">
<img src="{% static 'icon_img/create-pro-icon.svg' %}" height="14px" width="14px"></img>
<span class="layui-hide-xs">{% trans "新建文集" %}</span>
</a>
</dd>
{% endif %}
</dl>
</li>
</ul>
</div>
<!-- 用户菜单 -->
<div class="">
<ul class="layui-nav layui-layout-right">
{% if request.user.is_authenticated %}
<li class="layui-nav-item">
<a href="javascript:void(0);">
<i class="layui-icon layui-icon-friends"></i>
<span class="layui-hide-xs">{% if request.user.first_name != '' %} {{request.user.first_name}} {% else %} {{request.user.username}}{% endif %}</span>
</a>
<dl class="layui-nav-child">
{% if request.user.is_superuser %}
<dd>
<a href="{% url 'admin_center' %}">
<i class="layui-icon layui-icon-console layui-hide-md"></i>
<span class="layui-hide-xs">{% trans "进入后台" %}</span>
</a>
</dd>
{% endif %}
<dd class="layui-hide-md">
<a href="{% url 'create_doc' %}">
<i class="layui-icon layui-icon-add-1 layui-hide-md"></i>
</a>
</dd>
<dd>
<a href="{% url 'user_center' %}">
<i class="layui-icon layui-icon-app layui-hide-md"></i>
<span class="layui-hide-xs">{% trans "个人中心" %}</span>
</a>
</dd>
<dd>
<a href="javascript:void(0);" onclick="changePwd('{{ request.user.id }}','{{ request.user.username }}' )">
<i class="layui-icon layui-icon-password layui-hide-md"></i>
<span class="layui-hide-xs">{% trans "修改密码" %}</span>
</a>
</dd>
<dd>
<a href="{% url 'logout' %}">
<i class="layui-icon layui-icon-release layui-hide-md"></i>
<span class="layui-hide-xs">{% trans "退出登录" %}</span>
</a>
</dd>
</dl>
</li>
{% else %}
<li class="layui-nav-item">
<a href="javascript:void(0);">
<i class="layui-icon layui-icon-username"></i> {% trans "游客" %}
</a>
<dl class="layui-nav-child">
{% if close_register == 'on' %}
<dd><a href="{% url 'login' %}">{% trans "登录" %}</a></dd>
{% else %}
<dd><a href="{% url 'register' %}">{% trans "注册" %}</a></dd>
<dd><a href="{% url 'login' %}">{% trans "登录" %}</a></dd>
{% endif %}
</dl>
</li>
{% endif %}
</ul>
</div>
</div>
</div>