base_sidebar.html 2.18 KB
{% load staticfiles %}
<aside class="main-sidebar" style="z-index: 98">
<!-- sidebar: style can be found in sidebar.less -->
    <section class="sidebar">
        <!-- Sidebar user panel -->
        <div class="user-panel">
            <div class="pull-left image">
                <img src="{% static "dist/img/user2-160x160.jpg" %}" class="img-circle" alt="User Image">
            </div>
            <div class="pull-left info">
                <p>{{request.user.employeeName}}</p>
                <a href="#"><i class="fa fa-circle text-success"></i> {{request.user.deptNames}}</a>
            </div>
        </div>
        <!-- search form -->
        <form action="#" method="get" class="sidebar-form">
            <div class="input-group">
                <input type="text" name="q" class="form-control" placeholder="Search...">
                <span class="input-group-btn">
                    <button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i></button>
                </span>
            </div>
        </form>
        <!-- /.search form -->
        <!-- sidebar menu: : style can be found in sidebar.less -->
        <ul class="sidebar-menu">
            <li class="header">MAIN NAVIGATION</li>
            <li id="servicedeskmenu" class="treeview">
                <a href="/">
                    <i class="fa fa-dashboard"></i> <span>服务台</span>
                </a>
            </li>
            <li id="logmanagemenu" class="treeview">
                <a href="/account/list/">
                    <i class="fa fa-desktop"></i>
                    <span>用户管理</span>
                </a>
            </li>
        </ul>
    </section>
    <!-- /.sidebar -->
</aside>
<script>
    $(function () {
        var menu_list = $("aside.main-sidebar .sidebar-menu").find('.treeview');
        for(var i=0; i<menu_list.length; i++){
            var menu = $(menu_list[i]);
            var num_label = menu.find('a span.label');
            if(num_label.length>0){
                var sub_menu_num = menu.find('ul.treeview-menu li').length;
                num_label.html(sub_menu_num);
            }
        }
        $(".hide_js").hide();
    })
</script>