{% init show_cdate = False %}
{% init show_mdate = False %}
{% init show_adate = False %}
{% init show_action_time = False %}
{% init show_hot_index = False %}
{% init show_next = True %}
{% init show_size = False %}
{% init show_orderby = False %}
{% init show_expand = False %}
{% init orderby = "ctime_asc" %}

{% init date_type = "" %}
{% init ACTION_TEXT_MAP = {
    "create": "创建了笔记",
    "view": "查看了笔记",
    "edit": "更新了笔记"
} %}
{% init get_date_by_type = xutils.get_func_by_name("note.get_date_by_type") %}
{% from xnote_handlers.note.dao_tag import get_tag_name_by_code %}
{% init sticky_position = "left" %} 
{% set note_list_id = xutils.create_uuid() %}

{% if len(files) == 0 %}
    {% include common/text/empty_text.html %}
{% end %}

<div class="row note-list" id="{{note_list_id}}">
{% for item in files %}
    <!-- 隐藏的记录 -->
    {% if hasattr(item, "hide") and item.hide %}
        {% continue %}
    {% end %}

    <!-- 检查角色 -->
    {% if hasattr(item, "roles") and item.roles != None and _user_role not in item.roles %}
        {% continue %}
    {% end %}

    <a class="list-link" href="{{item.url}}">
        {% if sticky_position == "left" %}
            {% if item.is_sticky %}
                <span class="tag orange-tag">置顶</span>
            {% end %}
            {% if item.archived %}
                <span class="tag system">归档</span>
            {% end %}
            {% if item.type == "alias" %}
                <span class="tag system">别名</span>
            {% end %}
        {% end %}

        <!-- 图标和标题 -->
        <i class="fa {{item.icon}} fa-{{item.icon}} black"></i>
        <span>{{item.name}}</span>
        {% include note/component/note_list_item_tags.html %}

        <div class="float-right">
            {% if item.is_deleted %}
                <span class="tag gray" href="{{_server_home}}/note/removed">删除</span>
            {% end %}

            {% comment 新的角标统一使用badge_info %}
            <span class="book-size-span">{{item.badge_info}}</span>

            {% if item.show_next or show_next %}
                <i class="fa fa-chevron-right"></i>
            {% end %}
        </div>
    </a>
{% end %}

{% if show_expand %}
    {% include note/component/note_list_expand.html %}
{% end %}
</div>
