|
1 | 1 | {% load i18n heroicons apply_tags %} |
2 | 2 |
|
3 | | -<a class="flex justify-between items-center py-2 px-3 mb-2 max-w-2xl font-medium rounded-sm border transition-colors not-prose bg-base-200 hover:bg-base-300" |
4 | | - href="{{ file.url }}" |
5 | | - target="_blank" |
6 | | - rel="noopener noreferrer" |
7 | | - title="View file - {{ file.filename }}" |
8 | | -> |
9 | | - <span class="text-sm truncate"> |
10 | | - {% heroicon_mini "document-text" class="inline align-text-bottom" aria_hidden=true %} |
11 | | - {{ file.filename|truncatechars_middle:45 }} |
12 | | - <span class="text-xs text-fg-muted"> |
13 | | - <span class="sr-only">{% trans "uploaded" %}</span> |
14 | | - <span aria-hidden>•</span> |
15 | | - <relative-time datetime={{ file.modification_time|date:"c" }}>{{ file.modification_time|date:"SHORT_DATE_FORMAT" }}</relative-time> |
| 3 | +{% if file.exists %} |
| 4 | + <a class="flex justify-between items-center py-2 px-3 mb-2 max-w-2xl font-medium rounded-sm border transition-colors not-prose bg-base-200 hover:bg-base-300" |
| 5 | + href="{{ file.url }}" |
| 6 | + target="_blank" |
| 7 | + rel="noopener noreferrer" |
| 8 | + title="View file - {{ file.filename }}" |
| 9 | + > |
| 10 | + <span class="text-sm truncate"> |
| 11 | + {% heroicon_mini "document-text" class="inline align-text-bottom" aria_hidden=true %} |
| 12 | + {{ file.filename|truncatechars_middle:45 }} |
| 13 | + <span class="text-xs text-fg-muted"> |
| 14 | + <span class="sr-only">{% trans "uploaded" %}</span> |
| 15 | + <span aria-hidden>•</span> |
| 16 | + <relative-time datetime={{ file.modification_time|date:"c" }}>{{ file.modification_time|date:"SHORT_DATE_FORMAT" }}</relative-time> |
| 17 | + </span> |
16 | 18 | </span> |
17 | | - </span> |
18 | | - <span> |
19 | | - {% heroicon_mini "arrow-down" class="w-5 h-5" stoke_width=2 aria_hidden=true %} |
20 | | - </span> |
21 | | -</a> |
| 19 | + <span> |
| 20 | + {% heroicon_mini "arrow-down" class="w-5 h-5" stoke_width=2 aria_hidden=true %} |
| 21 | + </span> |
| 22 | + </a> |
| 23 | +{% else %} |
| 24 | + <div class="flex justify-between items-center py-2 px-3 mb-2 max-w-2xl font-medium rounded-sm border opacity-60 not-prose bg-base-200" |
| 25 | + title="{% trans "File not found" %} - {{ file.filename }}" |
| 26 | + > |
| 27 | + <span class="text-sm truncate"> |
| 28 | + {% heroicon_mini "document-text" class="inline align-text-bottom" aria_hidden=true %} |
| 29 | + {{ file.filename|truncatechars_middle:45 }} |
| 30 | + <span class="text-xs text-error"> |
| 31 | + <span aria-hidden>•</span> |
| 32 | + {% trans "Missing file" %} |
| 33 | + </span> |
| 34 | + </span> |
| 35 | + <span> |
| 36 | + {% heroicon_mini "exclamation-circle" class="w-5 h-5 text-error" aria_hidden=true %} |
| 37 | + </span> |
| 38 | + </div> |
| 39 | +{% endif %} |
0 commit comments