-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathcreate.tmpl
More file actions
138 lines (135 loc) · 4.36 KB
/
create.tmpl
File metadata and controls
138 lines (135 loc) · 4.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<!DOCTYPE html>
<html lang="en">
<head>
<title>CSH Vote</title>
<!-- <link rel="stylesheet" href="https://themeswitcher.csh.rit.edu/api/get" /> -->
<link rel="stylesheet" href="https://assets.csh.rit.edu/csh-material-bootstrap/4.6.2/dist/csh-material-bootstrap.min.css" media="screen">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
{{ template "nav" . }}
<div class="container main p-5">
<h2>Create Poll</h2>
<form action="/create" method="POST">
<div class="form-group">
<input
type="text"
class="form-control"
name="title"
placeholder="Poll Title"
>
</div>
<div class="form-group">
<input
type="text"
name="description"
class="form-control"
placeholder="Description (Optional)"
>
</div>
<div class="form-group">
<select name="options" id="options" onChange="onOptionsChange()" class="form-control">
<option value="pass_fail" selected>Pass/Fail</option>
<option value="pass-fail-conditional">
Pass/Fail or Conditional
</option>
<option value="fail-conditional">Fail/Conditional</option>
<option value="custom">Custom</option>
</select>
</div>
<div style="display:none;" id="customOptions" class="form-group">
<input
type="text"
name="customOptions"
class="form-control"
placeholder="Custom Options (Comma-separated)"
>
</div>
<div class="form-group">
<input
type="checkbox"
name="allowWriteIn"
value="true"
>
<span>Allow Write-In Votes</span>
</div>
<div class="form-group">
<input
type="checkbox"
name="rankedChoice"
value="true"
>
<span>Ranked Choice Vote</span>
</div>
<div class="form-group">
<input
type="checkbox"
name="hidden"
value="true"
>
<span>Hide Results Until Vote is Complete</span>
</div>
{{ if .IsEvals }}
<div class="form-group">
<input
type="checkbox"
name="gatekeep"
id="gatekeep"
value="true"
onchange="onGatekeepChange()"
>
<span> Gatekeep Required (Require Quorum, Limit Voters, Force Automatic Close)</span>
</div>
<div id="quorumTypeGroup" class="form-group" style="display:none">
<span>Quorum Type</span>
<input
type="radio"
name="quorumType"
id="quorumType"
value="12"
>
<span> One-Half</span>
<input
type="radio"
name="quorumType"
id="quorumType"
value="23"
>
<span> Two-Thirds</span>
</div>
<div id="waivedUsers" class="form-group" style="display:none">
<input
type="text"
name="waivedUsers"
class="form-control"
placeholder="Waive Usernames (Comma-separated)"
>
</div>
{{ end }}
<input type="submit" class="btn btn-primary" value="Create">
</form>
</div>
<script>
function onOptionsChange() {
if (document.getElementById("options").value == "custom") {
document.getElementById("customOptions").style.display = null;
} else {
document.getElementById("customOptions").style.display = "none";
}
}
function onGatekeepChange(){
const gatekeepBox = document.getElementById("gatekeep");
const waivedUsers = document.getElementById("waivedUsers");
const quorumType = document.getElementById("quorumTypeGroup");
if (gatekeepBox.checked){
waivedUsers.style.display = null
quorumType.style.display = null
} else {
waivedUsers.style.display = "none"
quorumType.style.display = "none"
}
}
</script>
</body>
</html>