Skip to content

Commit

Permalink
fix: file download button (#543)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasvinclav authored Jul 6, 2024
1 parent d100068 commit d4a6584
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/unfold/templates/unfold/widgets/clearable_file_input.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,18 @@
<input type="text" value="{% if widget.value %}{{ widget.value.url }}{% else %}{% trans 'Choose file to upload' %}{% endif %}" disabled class="bg-white flex-grow font-medium px-3 py-2 text-ellipsis dark:bg-gray-900 {% if widget.value %}text-gray-500 dark:text-gray-400{% else %}text-gray-300 dark:text-gray-400{% endif %}">

<div class="flex flex-none items-center leading-none self-stretch">
<input id="{{ widget.name }}" type="{{ widget.type }}" name="{{ widget.name }}" class="hidden" {% include "django/forms/widgets/attrs.html" %} />
<div class="hidden">
<input id="{{ widget.name }}" type="{{ widget.type }}" name="{{ widget.name }}" {% include "django/forms/widgets/attrs.html" %} />
</div>

{% if widget.is_initial %}
<a href="{{ widget.value.url }}" class="border-r cursor-pointer text-gray-400 px-3 hover:text-gray-700 dark:border-gray-700 dark:text-gray-500 dark:hover:text-gray-200" target="_blank">
<span class="material-symbols-outlined">download</span>
</a>
{% endif %}

<label for="{{ widget.name }}" class="cursor-pointer text-gray-400 px-3 hover:text-gray-700 dark:text-gray-500 dark:hover:text-gray-200">
<span class="material-symbols-outlined">file_upload</span>
<span class="material-symbols-outlined">upload</span>
</label>
</div>
</div>

0 comments on commit d4a6584

Please sign in to comment.