<input class="batch-item" value="{{uploadFile.id}}" type="checkbox" data-role="batch-item"
    data-link-count="{{ uploadFile.usedCount }}"
    data-file-name="{{ uploadFile.filename }}" style="display:none;">
{% if uploadFile.storage == 'local' or (uploadFile.storage == 'cloud' and uploadFile.type in ['video', 'ppt', 'document'] and uploadFile.convertStatus != "success") %}
  <img src="{{ asset(uploadFile.thumbnail|default('assets/img/default/cloud_' ~ uploadFile.type ~ '.png')) }}">
{% else %}
  <img src="{{ asset(uploadFile.thumbnail|default('assets/img/default/cloud_' ~ uploadFile.type ~ '.png')) }}">
{% endif %}

<div class="mask">
  <div class="icon-operation">
    <i
      class="glyphicon glyphicon-star js-collect-btn left {% if collections[uploadFile.id]|default(0) %} material-collection {% endif %}"
      data-toggle="tooltip"
      data-placement="bottom"
      title="{{'收藏'|trans}}"
      data-url="{{ path('material_lib_save_collection', {fileId:uploadFile.id}) }}"
    ></i>
    <i
      href="javascript:;"
      class="glyphicon glyphicon-option-vertical"
      data-toggle="dropdown"
      aria-haspopup="true"
      aria-expanded="false"
    ></i>
    <ul class="dropdown-menu">
      {% if uploadFile.createdUserId == app.user.id %}
        <li>
          <a href="javascript:;" class="js-detail-btn" data-toggle="tooltip" data-placement="bottom" data-url="{{ path('material_lib_file_detail', {fileId:uploadFile.id}) }}">
            <i class="glyphicon glyphicon-pencil prm"></i>{{'编辑'|trans}}
          </a>
        </li>
      {% endif %}
      
      {% if uploadFile.storage == "cloud" and uploadFile.createdUserId != app.user.id %}
        <li>
          <a href="javascript:;" class="js-detail-btn" data-toggle="tooltip" data-placement="bottom" data-url="{{ path('material_lib_file_detail', {fileId:uploadFile.id}) }}">
            <i class="glyphicon glyphicon-eye-open prm"></i>{{'查看'|trans}}
          </a>
        </li>
      {% endif %}

      {% if uploadFile.storage == "cloud" and uploadFile.type == 'video' %}
        <li>
          <a href="{{ path('media_subtitle_manage', {mediaId:uploadFile.id, goto:path('material_lib_browsing')}) }}" data-toggle="tooltip" data-placement="bottom">
            <i class="glyphicon glyphicon-cog prm"></i>{{'字幕管理'|trans}}
          </a>
        </li>
      {% endif %}

      <li>
        <a href="javascript:;"  data-url="{{ path('material_download', {fileId:uploadFile.id}) }}" class="js-download-btn" data-toggle="tooltip" data-placement="bottom" >
          <i class="glyphicon glyphicon-save prm"></i>{{'下载'|trans}}
        </a>
      </li>

      {% if uploadFile.createdUserId == app.user.id %}
        
        {% if uploadFile.isPublic %}
          <li>
            <a href="javascript:;" class="js-unshare-btn" data-toggle="tooltip" data-placement="bottom" data-url="{{ path('material_unshare', {fileId:uploadFile.id}) }}">
              <i class="es-icon es-icon-share prm"></i>{{'取消共享'|trans}}
            </a>
          </li>
        {% else %}
            <li>
            <a href="javascript:;" class="js-share-btn" data-toggle="tooltip" data-placement="bottom" data-file-id="{{ uploadFile.id }}" data-url="{{ path('material_batch_share') }}">
              <i class="es-icon es-icon-share prm"></i>{{'共享'|trans}}
            </a>
          </li>
        {% endif %}
        
        {% if source != 'public' %}
          <li>
            <a href="javascript:;"  class="js-delete-btn" data-toggle="tooltip" data-placement="bottom" data-url="{{ path('material_delete_modal_show') }}" data-id="{{uploadFile.id }}">
              <i class="glyphicon glyphicon-trash prm"></i>{{'删除'|trans}}
            </a>
          </li>
        {% endif %}
      {% endif %}
    </ul>
  </div>
  <div class="btn-operation">
      <!-- 选择一种状态 -->

      <a class="btn btn-info" href="#modal" data-toggle="modal" data-url="{{ path('material_lib_file_preview', {fileId: uploadFile.id}) }}" >{{'资料预览'|trans}}
      </a>

      {% if uploadFile.convertStatus == 'error' %}
        {% if setting("developer.debug")|default(0) %}
        <a class="js-reconvert-btn btn btn-warning" data-url='{{path("material_reconvert", {globalId: uploadFile.globalId})}}'>{{'重新转码'|trans}}</a>
        {% endif %}
      {% endif %}

  </div>
  <div class="time">
    {% if uploadFile.type in ['video', 'audio'] and uploadFile.storage == 'cloud' %}
      {{ uploadFile.length|date('i:s') }}
    {% else %}
      {{ uploadFile.ext|upper }}
    {% endif %}
  </div>
</div>
