<header role="header" class="site__header header" id="home">
    <div class="header__wrapper">

        <div class="header__brand">
            <a href="/main/index"><img src="/static/style/brand.png" /></a>
            {{/*<div class="header__title"></div>*/}}
            <a href="https://github.com/bzppx/bzppx-codepub/releases" target="_blank" style="text-decoration: none;"><span class="label label-default" style="padding: .2em .6em .2em;">{{.version}}</span></a>
        </div>

        <div class="header__account account account--has-login">
            <div class="account__wrapper">
                <img class="account__img" src="/static/style/irfan-maulana.jpg" />
                <span class="account__name">{{.loginUser.username}}</span>
            </div>
            <i class="account__arrow fa fa-angle-down js--show-dropdown-menu"></i>

            <div class="account__menu">
                <ul class="account__menu-wrapper">
                    <li class="account__menu-item">
                        <a href="/profile/my" target="main">
                            <i class="nav__icon fa fa-x fa-male"></i>我的资料
                        </a>
                    </li>
                    <li class="account__menu-item">
                        <a href="/login/logout">
                            <i class="nav__icon fa fa-x fa-sign-out"></i>安全退出</a>
                    </li>
                </ul>
            </div>

        </div>

        <div class="header__nav--mobile">
            <div class="header__nav-btn" id="menu-toggle">
                <span></span>
                <span></span>
                <span></span>
                <span></span>
            </div>
        </div>

    </div>
</header>


<main role="main" class="site__main main">
    <nav class="main__nav nav">

        <ul class="nav__wrapper">
            <li class="nav__item nav__item--has-child">
                <a href="#">
                    <i class="nav__icon fa fa-user"></i> 个人中心
                    <i class="nav__arrow fa fa-angle-down"></i>
                </a>
                <ul class="nav__wrapper nav__wrapper--child">
                    <li class="nav__item--child">
                        <a href="/profile/my" target="main"><i class="nav__icon fa fa-list"></i>我的资料</a>
                    </li>
                    <li class="nav__item--child">
                        <a href="/profile/password" target="main"><i class="nav__icon fa fa-list"></i>修改密码</a>
                    </li>
                </ul>
            </li>
            <li class="nav__item nav__item--has-child">
                <a href="#">
                    <i class="nav__icon fa fa-code-fork"></i> 发布代码
                    <i class="nav__arrow fa fa-angle-down"></i>
                </a>
                <ul class="nav__wrapper nav__wrapper--child">
                    <li class="nav__item--child">
                        <a href="/publish/project"><i class="nav__icon fa fa-list"></i>项目列表</a>
                    </li>
                    <li class="nav__item--child">
                        <a href="/task/center"><i class="nav__icon fa fa-list"></i>任务队列</a>
                    </li>
                </ul>
            </li>
            {{if .isAdmin }}
            <li class="nav__item nav__item--has-child">
                <a href="#">
                    <i class="nav__icon fa fa-users"></i> 用户管理
                    <i class="nav__arrow fa fa-angle-down"></i>
                </a>
                <ul class="nav__wrapper nav__wrapper--child">
                    <li class="nav__item--child"><a href="/user/add"><i class="nav__icon fa fa-list"></i>添加用户</a></li>
                    <li class="nav__item--child"><a href="/user/list"><i class="nav__icon fa fa-list"></i>用户列表</a></li>
                </ul>
            </li>
            <li class="nav__item nav__item--has-child">
                <a href="#">
                    <i class="nav__icon fa fa-bullhorn"></i> 公告管理
                    <i class="nav__arrow fa fa-angle-down"></i>
                </a>
                <ul class="nav__wrapper nav__wrapper--child">
                    <li class="nav__item--child"><a href="/notice/add"><i class="nav__icon fa fa-list"></i>添加公告</a></li>
                    <li class="nav__item--child"><a href="/notice/list"><i class="nav__icon fa fa-list"></i>公告列表</a></li>
                </ul>
            </li>
            <li class="nav__item nav__item--has-child">
                <a href="#">
                    <i class="nav__icon fa fa-cube"></i> 项目管理
                    <i class="nav__arrow fa fa-angle-down"></i>
                </a>
                <ul class="nav__wrapper nav__wrapper--child">
                    <li class="nav__item--child">
                        <a href="/group/list"><i class="nav__icon fa fa-list"></i>项目组</a>
                    </li>
                    <li class="nav__item--child">
                        <a href="/project/add"><i class="nav__icon fa fa-list"></i>添加项目</a>
                    </li>
                    <li class="nav__item--child">
                        <a href="/project/list"><i class="nav__icon fa fa-list"></i>项目列表</a>
                    </li>
                </ul>
            </li>
            <li class="nav__item nav__item--has-child">
                <a href="#">
                    <i class="nav__icon fa fa-crosshairs"></i> 节点管理
                    <i class="nav__arrow fa fa-angle-down"></i>
                </a>
                <ul class="nav__wrapper nav__wrapper--child">
                    <li class="nav__item--child">
                        <a href="/nodes/list"><i class="nav__icon fa fa-list"></i>节点组</a>
                    </li>
                    <li class="nav__item--child">
                        <a href="/node/add"><i class="nav__icon fa fa-list"></i>添加节点</a>
                    </li>
                    <li class="nav__item--child">
                        <a href="/node/list"><i class="nav__icon fa fa-list"></i>节点列表</a>
                    </li>
                </ul>
            </li>
            <li class="nav__item nav__item--has-child">
                <a href="#">
                    <i class="nav__icon fa fa-file-text"></i> 日志管理
                    <i class="nav__arrow fa fa-angle-down"></i>
                </a>
                <ul class="nav__wrapper nav__wrapper--child">
                    <li class="nav__item--child">
                        <a href="/log/action"><i class="nav__icon fa fa-list"></i>操作日志</a>
                    </li>
                    <li class="nav__item--child">
                        <a href="/log/task"><i class="nav__icon fa fa-list"></i>任务日志</a>
                    </li>
                </ul>
            </li>
            <li class="nav__item nav__item--has-child">
                <a href="#">
                    <i class="nav__icon fa fa-bar-chart-o"></i> 发布统计
                    <i class="nav__arrow fa fa-angle-down"></i>
                </a>
                <ul class="nav__wrapper nav__wrapper--child">
                    <li class="nav__item--child">
                        <a href="/statistics/statistics"><i class="nav__icon fa fa-list"></i>统计</a>
                    </li>
                </ul>
            </li>
            <li class="nav__item nav__item--has-child">
                <a href="#">
                    <i class="nav__icon fa fa-gears"></i> 系统管理
                    <i class="nav__arrow fa fa-angle-down"></i>
                </a>
                <ul class="nav__wrapper nav__wrapper--child">
                    <li class="nav__item--child">
                        <a href="/apiauth/list"><i class="nav__icon fa fa-list"></i>认证管理</a>
                    </li>
                    <li class="nav__item--child">
                        <a href="/configure/block"><i class="nav__icon fa fa-list"></i>封版配置</a>
                    </li>
                    <li class="nav__item--child">
                        <a href="/configure/email"><i class="nav__icon fa fa-list"></i>邮件配置</a>
                    </li>
					<li class="nav__item--child">
                        <a href="/contact/list"><i class="nav__icon fa fa-list"></i>联系人管理</a>
                    </li>
                </ul>
            </li>
            {{end}}
        </ul>

        <div class="footer__wrapper">
            <div class="footer__text">
                <!--<span>Crafted with &nbsp;<i class="fa fa-heart-o"></i>&nbsp; by Irfan Maulana</span>-->
            </div>
        </div>
    </nav>
    <article class="main__content content">
        <div class="content__wrapper">
            <iframe id="main" name="main" src="/main/default" scrolling="yes" style="overflow-y:auto;border:none;" frameborder="yes" width="100%"></iframe>
        </div>
    </article>
</main>
<script type="text/javascript">
    window.onload = window.onresize = function() {
        $("#main").height($(window).height() - $('header').height() - 12);
    };
    $(function() {
        $(".nav__item--child>a").each(function() {
            var hash = location.hash;
            var aurl = parseUrl(this.href);
            var ahash = "#" + aurl.pathname + (aurl.search ? '?' + aurl.search : '');
            if (hash == ahash) {
                $(this).parent().parent().click();
                $("#main").attr("src", this.href);
                $(".nav__item--child").removeClass("nav__item--active")
                $(this).parent().addClass("nav__item--active");
            }
        });

        $(".nav__item--child>a").click(function() {
            $("#main").attr("src", this.href);
            $(".nav__item--child").removeClass("nav__item--active")
            $(this).parent().addClass("nav__item--active");
            var url = parseUrl(this.href);
            var hash = url.pathname + (url.search ? '?' + url.search : '');
            location.hash = "#" + hash;
            return false;
        });

        function parseUrl(url) {
            var a = document.createElement('a');
            a.href = url;
            return a;
        }
    });
</script>