{% extends base %}

{% block head %}

{% set-global search_action = '/fs_find' %}
{% set-global search_placeholder = '搜索文件' %}

<script type="text/javascript" src="{{_server_home}}/static/js/fs/fs.js"></script>

{% end %}

{% block search_form %}
    <input type="text" name="path" class="hide" value="{{?path}}"/>
{% end %}

{% block body_left %}

{% init find_key = "" %}
{% init error = "" %}
{% init show_fs_path = True %}
{% init search_category = "fs" %}
{% init show_hidden_files = False %}

<div class="hide error row"></div>
<div class="hide success row"></div>

<div class="card">
    {% include fs/component/fs_title.html %}
</div>

<div class="card">
    {% if show_fs_path %}
        {% include mod_fs_path.html %}
    {% end %}
    
    {% include fs/component/options/fs_options.html %}
    {% include fs/component/script/file_op_script.html %}

    <div class="col-md-12 file-list fs-scrollbar">
        {% for _item in filelist %}
            {# 隐藏文件 #}
            {% if _item.name == "" %}
                {% set print("overflow fileItem=%s" % _item) %}
                {% continue %}
            {% end %}
            
            <a class="list-item {{_item.css_class}}" href="{{_item.url}}" 
                data-src="{{_item.data_url}}">

                <i class="fa {{_item.icon}}"></i>
                <span>{{_item.name}}</span>

                {% if _item.show_opt_btn %}
                <div class="float-right">
                    <span class="fs-size-span">{{_item.size}}</span>
                    <span>&nbsp;</span>
                    <button class="btn btn-default" 
                        data-path="{{_item.path}}"
                        data-name="{{_item.name}}"
                        data-realname="{{_item.realname}}"
                        data-path-b64="{{_item.path_b64}}"
                        onclick="xnote.action.fs.openOptionDialog(this, event)">{{T("操作")}}</button>
                </div>
                {% end %}
            </a>
        {% end %}
    </div>
</div>

{% if error != "" %}
<div class="card">
    <pre class="error col-md-12">{{error}}</pre>
</div>
{% end %}

{% end %}

{% block body_right %}
    {% include fs/component/fs_sidebar.html %}
{% end %}