{% extends "qommon/forms/widget.html" %}
{% load i18n %}

{% block widget-control %}
<div class="file-button {% if widget.is_image %}file-image{% endif %}"
     {% if widget.automatic_image_resize %}data-image-resize="true"{% endif %}>
{% for w in widget.get_widgets %}
  {{ w.render|safe }}
{% endfor %}
<div class="widget-message click-to-upload">
  {% trans "Drop a file or click to select one" %}
</div>
<div class="widget-message upload-done">
  {% trans "Upload done" %}
</div>
<style>.click-to-upload, .upload-done { display: none; }</style>
<div class="fileprogress" style="display: none;">
  <div class="bar"
       data-upload="{% trans "Upload in progress..." %}"
       data-resize="{% trans "Resizing image..." %}"
       data-error="{% trans "Error during upload." %}"></div>
</div>
<div class="fileinfo {% if widget.readonly and widget.has_tempfile_image %}thumbnail{% endif %}">
  <span class="filename">{{ widget.tempfile.base_filename }}</span>
{% if not widget.readonly %}
  <a href="#" class="remove" title="{% trans 'Remove this file' %}">{% trans "remove" %}</a>
{% elif widget.has_tempfile_image %}
  <img alt="" src="tempfile?t={{ widget.tempfile.token }}&thumbnail=1"/>
{% endif %}
</div>
</div>
{% block portfolio-picker %}
{% if not widget.readonly and widget.allow_portfolio_picking and session_user %}
  <p class="use-file-from-fargo"><span
     data-src="{{site_url}}/fargo/pick" data-width="500" data-height="400"
     data-title="{% trans "Pick a file from the portfolio" %}"
     rel="popup">{% trans "Use file from the portfolio" %}</span></p>
{% endif %}
{% endblock %}
{% endblock %}
