Skip to content

Commit b7311d9

Browse files
authored
Merge pull request #62 from drduh/wip-03may25
use radio buttons to select files for download in list
2 parents b5f4a40 + 75b46ad commit b7311d9

File tree

2 files changed

+43
-13
lines changed

2 files changed

+43
-13
lines changed

assets/style.css

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ input[type="file"]::file-selector-button:hover {
164164
color: var(--bg-dark);
165165
}
166166

167+
input[type="radio"] {
168+
display: none;
169+
}
170+
167171
table {
168172
border-collapse: collapse;
169173
border-radius: var(--box-radius);
@@ -197,7 +201,14 @@ tr:nth-child(odd) {
197201
background-color: var(--bg-dark);
198202
}
199203

200-
tr:hover {
204+
.list-row label {
205+
display: block;
206+
height: 100%;
207+
width: 100%;
208+
}
209+
210+
tr:hover,
211+
.list-row:has(input[type="radio"]:checked) {
201212
background-color: var(--bg-light);
202213
transition: background-color var(--animation) ease;
203214
}

templates/data/list.tmpl

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,50 @@
33
<div class="box">
44
<form action="{{ .Paths.List }}"
55
method="get">
6+
{{ if .Auth.Require.List }} {{ template "auth" . }} {{ end }}
7+
<input class="selectSubmit"
8+
type="submit"
9+
value="list">
10+
</form>
11+
<form action="{{ .Paths.Download }}"
12+
method="get">
13+
<br>
614
{{ if .Auth.Require.List }} {{ template "auth" . }} {{ else }}
715
{{ if .Storage.Files }}
816
<table>
9-
<tr>
10-
<th>Name</th>
11-
<th>Size</th>
12-
<th>Owner</th>
13-
<th>Remain</th>
14-
</tr>
15-
{{ $root := . }}
17+
<thead>
18+
<tr>
19+
<th>Name</th>
20+
<th>Size</th>
21+
<th>Owner</th>
22+
<th>Time</th>
23+
</tr>
24+
</thead>
25+
<tbody>
1626
{{ range .Storage.Files }}
17-
<tr>
18-
<td><a href="{{ $root.Paths.Download }}/{{ .Name }}">{{ .Name }}</a></td>
27+
<tr class="list-row">
28+
<td>
29+
<label for="{{ .Name }}">{{ .Name }}</label>
30+
<input id="{{ .Name }}"
31+
name="name"
32+
type="radio"
33+
value="{{ .Name }}" required>
34+
</td>
1935
<td>{{ .Size }}</td>
2036
<td>{{ .Owner.Address }}</td>
2137
<td>{{ .Time.Remain }}</td>
2238
</tr>
23-
{{end}}
39+
{{ end }}
40+
</tbody>
2441
</table>
25-
{{end}}
42+
{{ end }}
2643
<br>
2744
{{ end }}
45+
{{ if .Auth.Require.Download }} {{ template "auth" . }} {{ end }}
2846
<input class="selectSubmit"
47+
title="download selected file"
2948
type="submit"
30-
value="list">
49+
value="download">
3150
</form>
3251
</div>
3352
{{ end }}

0 commit comments

Comments
 (0)