Skip to content

Commit c4f904b

Browse files
committed
Add horizonal flex layout to admin-vote page; Add subcards for different election types: published, closed, and unpublished
1 parent 4213f2d commit c4f904b

4 files changed

Lines changed: 117 additions & 35 deletions

File tree

docker-compose-saml.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
services:
22
auth:
33
ports:
4-
- 443:443
4+
- 3000:3000
55
build:
66
dockerfile: Dockerfile.dev
77
command: air
88
volumes:
99
- ./keys:/app/keys
1010
- ./tlskeys:/app/tlskeys
11-
environment:
12-
- ENV=saml
1311
develop:
1412
watch:
1513
- action: sync

templates/#admin-vote.html.tpl#

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{{ template "admin.html.tpl" . }}
2+
3+
{{ define "title" }}Admin Vote | Cyber Security Club @ Ohio State{{ end }}
4+
5+
{{ define "admin" }}
6+
<div class="card">
7+
<div class="card-title">Admin Votes</div>
8+
<div class="card-content">
9+
<a hx-boost="true" href="/admin/vote/new" class="secondary-button"
10+
>New Vote</a
11+
>
12+
13+
<div>
14+
<h1>Past Votes</h1>
15+
<ul class="list-disc list-inside">
16+
{{
17+
range.pastElections
18+
}}
19+
<li>
20+
<a
21+
class="font-bold"
22+
hx-boost="true"
23+
href="/admin/vote/{{ .ElectionId }}"
24+
>{{ .Name }}</a
25+
>
26+
{{ if .Published }}<em>published</em>{{ end }}
27+
28+
{{ if .Done }}
29+
<em>completed {{ .DoneTime }}</em>
30+
{{ end }}
31+
</li>
32+
{{
33+
end
34+
}}
35+
</ul>
36+
</div>
37+
</div>
38+
</div>
39+
{{ end }}

templates/admin-vote.html.tpl

Lines changed: 65 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,70 @@
55
{{ define "admin" }}
66
<div class="card">
77
<div class="card-title">Admin Votes</div>
8-
<div class="card-content">
9-
<a hx-boost="true" href="/admin/vote/new" class="secondary-button"
10-
>New Vote</a
11-
>
12-
13-
<div>
14-
<h1>Past Votes</h1>
15-
<ul class="list-disc list-inside">
16-
{{
17-
range.pastElections
18-
}}
19-
<li>
20-
<a
21-
class="font-bold"
22-
hx-boost="true"
23-
href="/admin/vote/{{ .ElectionId }}"
24-
>{{ .Name }}</a
25-
>
26-
{{ if .Published }}<em>published</em>{{ end }}
27-
28-
{{ if .Done }}
29-
<em>completed {{ .DoneTime }}</em>
30-
{{ end }}
31-
</li>
32-
{{
33-
end
34-
}}
35-
</ul>
36-
</div>
37-
</div>
8+
<a hx-boost="true" href="/admin/vote/new" class="secondary-button"
9+
>New Vote</a
10+
>
11+
<div class="container">
12+
<div class="subcard">
13+
<h5 class="mb-3 text-base font-semibold">
14+
Published
15+
</h5>
16+
<ul>
17+
{{ range.pastElections }}
18+
<li>
19+
{{ if .Published }}
20+
<span class="flex-1 ms-3 whitespace-nowrap">
21+
<a
22+
hx-boost="true"
23+
href="/admin/vote/{{ .ElectionId }}"
24+
>{{ .Name }}</a
25+
>
26+
</span>
27+
{{ end }}
28+
</li>
29+
{{ end }}
30+
</ul>
31+
</div>
32+
<div class="subcard">
33+
<h5 class="mb-3 text-base font-semibold">
34+
Closed
35+
</h5>
36+
<ul>
37+
{{ range.pastElections }}
38+
<li>
39+
{{ if .Done }}
40+
<span class="flex-1 ms-3 whitespace-nowrap">
41+
<a
42+
hx-boost="true"
43+
href="/admin/vote/{{ .ElectionId }}"
44+
>{{ .Name }}</a
45+
>
46+
</span>
47+
{{ end }}
48+
</li>
49+
{{ end }}
50+
</ul>
51+
</div>
52+
<div class="subcard">
53+
<h5 class="mb-3 text-base font-semibold">
54+
Unpublished
55+
</h5>
56+
<ul>
57+
{{ range.pastElections }}
58+
<li>
59+
{{ if and (not .Published) (not .Done) }}
60+
<span class="flex-1 ms-3 whitespace-nowrap">
61+
<a
62+
hx-boost="true"
63+
href="/admin/vote/{{ .ElectionId }}"
64+
>{{ .Name }}</a
65+
>
66+
</span>
67+
{{ end }}
68+
</li>
69+
{{ end }}
70+
</ul>
71+
</div>
72+
</div>
3873
</div>
3974
{{ end }}

templates/base.html.tpl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,21 @@
1111
@tailwind base;
1212
@tailwind components;
1313
@tailwind utilities;
14-
.card { @apply shadow-md rounded-sm border; }
14+
.card {
15+
@apply shadow-md rounded-sm
16+
border;
17+
padding-right: 25px;
18+
}
19+
.container {
20+
display: flex;
21+
margin-right: 20px;
22+
}
23+
.container div { margin: 5px 10px; }
24+
.subcard { @apply w-full max-w-sm p-4 bg-white border border-gray-200 rounded-lg shadow-sm sm:p-6 dark:bg-gray-100 dark:border-gray-100; }
1525
.card-title { @apply shadow-sm py-2 px-3 font-bold; }
1626
.card-content { @apply py-2 px-3; }
1727
.external-link { @apply text-blue-500; }
18-
.secondary-button { @apply inline-flex border border-gray-300 hover:border-gray-400 active:border-gray-500 text-gray-800 rounded-md cursor-pointer px-4 py-2 text-center; }
28+
.secondary-button { @apply inline-flex border border-gray-300 hover:border-gray-400 active:border-gray-500 text-gray-800 rounded-md cursor-pointer px-4 py-2 text-center; margin-left: 20px; }
1929
.primary-button { @apply inline-flex bg-teal-400 hover:bg-teal-500 active:bg-teal-600 font-bold text-gray-100 rounded-md cursor-pointer px-4 py-2 text-center; }
2030
</style>
2131
<title>{{ block "title" . }}{{ end }}</title>

0 commit comments

Comments
 (0)