{% init show_sidebar_group_entry = True %}
{% init show_sidebar_note_brothers = False %}

{% if show_sidebar_group_entry %}
{% init special_groups = xutils.call("page.list_special_groups") %}
<div class="card">
    {% for item in special_groups %}
        <a class="list-link" href="{{_server_home}}{{item.url}}">
            
            {% if item.priority>0 %}
                <i class="fa fa-thumb-tack black"></i>
            {% end %}

            <!-- 图标和标题 -->
            <i class="fa {{item.icon}} fa-{{item.icon}} black"></i>                
            <span>{{item.name}}</span>
            <div class="float-right">
                <span class="book-size-span">{{item.size}}</span>
                <i class="fa fa-chevron-right"></i>
            </div>
        </a>
    {% end %}
</div>
{% end %}

{% if _has_login and show_sidebar_note_brothers and file.creator == _user_name %}
<!-- TODO: 考虑无权限用户的视图 -->
<div class="card">
    <div class="card-title">
        <span>笔记本目录</span>
    </div>
    <div class="note-sidebar-contents">
    {% for item in xutils.call("note.list_by_parent", _user_name, file.parent_id, orderby = "db") %}
        <a class="list-item" href="{{_server_home}}{{item.url}}" 
            {% if item.id == file_id %}
                data-current=true
            {% end %}>
            {% if item.priority>0 %}<span class="tag orange">置顶</span>{% end %}
            <i class="fa {{item.icon}} fa-{{item.icon}} black"></i>
            <span>{{item.name}}</span>
        </a>
    {% end %}
    </div>
</div>

<script type="text/javascript">
    $(function() {
        $(".note-sidebar-contents>a[data-current=true]").showInScroll(-100);
    });
</script>

{% end %}