|
1
|
{% extends "base.html" %} |
|
2
|
{% block title %}Files — {{ project.name }} — Fossilrepo{% endblock %} |
|
3
|
|
|
4
|
{% block content %} |
|
5
|
<h1 class="text-2xl font-bold text-gray-100 mb-2">{{ project.name }}</h1> |
|
6
|
{% include "fossil/_project_nav.html" %} |
|
7
|
|
|
8
|
<div class="flex items-center justify-between mb-6"> |
|
9
|
<h2 class="text-lg font-semibold text-gray-200">Unversioned Files</h2> |
|
10
|
<div> |
|
11
|
<span class="search-wrap"> |
|
12
|
<input type="search" |
|
13
|
name="search" |
|
14
|
value="{{ search }}" |
|
15
|
placeholder="Search files..." |
|
16
|
aria-label="Search files" |
|
17
|
class="rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand text-sm px-3 py-1.5" |
|
18
|
hx-get="{% url 'fossil:unversioned' slug=project.slug %}" |
|
19
|
hx-trigger="input changed delay:300ms, search" |
|
20
|
hx-target="#unversioned-content" |
|
21
|
hx-swap="innerHTML" |
|
22
|
hx-push-url="true" |
|
23
|
hx-indicator="closest .search-wrap" /> |
|
24
|
<svg class="search-spinner animate-spin h-4 w-4" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path></svg> |
|
25
|
</span> |
|
26
|
</div> |
|
27
|
</div> |
|
28
|
|
|
29
|
<div id="unversioned-content"> |
|
30
|
{% if files %} |
|
31
|
<div class="overflow-x-auto rounded-lg bg-gray-800 shadow-sm border border-gray-700"> |
|
32
|
<table class="min-w-full divide-y divide-gray-700"> |
|
33
|
<thead class="bg-gray-900/80"> |
|
34
|
<tr> |
|
35
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">Name</th> |
|
36
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">Size</th> |
|
37
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">Modified</th> |
|
38
|
<th class="px-6 py-3 text-right text-xs font-medium text-gray-400 uppercase tracking-wider"></th> |
|
39
|
</tr> |
|
40
|
</thead> |
|
41
|
<tbody class="divide-y divide-gray-700/70"> |
|
42
|
{% for file in files %} |
|
43
|
<tr class="hover:bg-gray-700/30 transition-colors"> |
|
44
|
<td class="px-6 py-3 text-sm text-gray-200 font-mono">{{ file.name }}</td> |
|
45
|
<td class="px-6 py-3 text-sm text-gray-400">{{ file.size|filesizeformat }}</td> |
|
46
|
<td class="px-6 py-3 text-sm text-gray-400">{% if file.mtime %}{{ file.mtime|date:"Y-m-d H:i" }} UTC{% else %}--{% endif %}</td> |
|
47
|
<td class="px-6 py-3 text-right"> |
|
48
|
<a href="{% url 'fossil:unversioned_download' slug=project.slug filename=file.name %}" |
|
49
|
class="inline-flex items-center rounded-md bg-gray-700 px-3 py-1 text-xs font-semibold text-gray-300 hover:bg-gray-600"> |
|
50
|
Download |
|
51
|
</a> |
|
52
|
</td> |
|
53
|
</tr> |
|
54
|
{% endfor %} |
|
55
|
</tbody> |
|
56
|
</table> |
|
57
|
</div> |
|
58
|
{% else %} |
|
59
|
<div class="rounded-lg bg-gray-800 border border-gray-700 p-8 text-center"> |
|
60
|
<p class="text-sm text-gray-500">{% if search %}No files matching "{{ search }}".{% else %}No unversioned files.{% endif %}</p> |
|
61
|
</div> |
|
62
|
{% endif %} |
|
63
|
{% include "includes/_pagination_manual.html" %} |
|
64
|
</div> |
|
65
|
|
|
66
|
{% if has_admin %} |
|
67
|
<div class="mt-6"> |
|
68
|
<form method="post" |
|
69
|
action="{% url 'fossil:unversioned_upload' slug=project.slug %}" |
|
70
|
enctype="multipart/form-data" |
|
71
|
class="rounded-lg bg-gray-800 border border-gray-700 p-4 shadow-sm"> |
|
72
|
{% csrf_token %} |
|
73
|
<h4 class="text-sm font-medium text-gray-300 mb-3">Upload File</h4> |
|
74
|
<div class="flex items-center gap-3"> |
|
75
|
<input type="file" name="file" required |
|
76
|
class="block w-full text-sm text-gray-400 file:mr-4 file:py-1.5 file:px-3 file:rounded-md file:border-0 file:text-sm file:font-semibold file:bg-brand file:text-white hover:file:bg-brand-hover" /> |
|
77
|
<button type="submit" |
|
78
|
class="rounded-md bg-brand px-4 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-brand-hover focus:outline-none focus:ring-2 focus:ring-brand focus:ring-offset-2 focus:ring-offset-gray-950 transition-colors whitespace-nowrap"> |
|
79
|
Upload |
|
80
|
</button> |
|
81
|
</div> |
|
82
|
<p class="mt-2 text-xs text-gray-500">Unversioned files do not preserve history. Only the latest version is kept.</p> |
|
83
|
</form> |
|
84
|
</div> |
|
85
|
{% endif %} |
|
86
|
{% endblock %} |
|
87
|
|