summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--frontend/student.js6
-rw-r--r--tmpl/student.html6
2 files changed, 7 insertions, 5 deletions
diff --git a/frontend/student.js b/frontend/student.js
index b226eef..2fd82aa 100644
--- a/frontend/student.js
+++ b/frontend/student.js
@@ -157,6 +157,12 @@ document.addEventListener("DOMContentLoaded", () => {
switch (c.checked) {
case true:
c.indeterminate = true
+ document.querySelectorAll(".coursecheckbox").forEach(d => {
+ if (d.checked === true && d.dataset.group === c.dataset.group) {
+ d.indeterminate = true
+ socket.send(`N ${ d.id.slice(4) }`)
+ }
+ })
socket.send(`Y ${ c.id.slice(4) }`)
break
case false:
diff --git a/tmpl/student.html b/tmpl/student.html
index 3c63cb7..7da6f2a 100644
--- a/tmpl/student.html
+++ b/tmpl/student.html
@@ -135,11 +135,7 @@
{{- range .Courses }}
<tr class="courseitem" id="course{{.ID}}" data-group="{{.Group}}">
<th style="font-weight: normal" scope="row">
- {{ if lt .Selected .Max -}}
- <input aria-label="Enroll in course" class="coursecheckbox" type="checkbox" id="tick{{.ID}}" name="tick{{.ID}}" value="tick{{.ID}}"></input>
- {{ else -}}
- <input aria-label="Enroll in course" disabled class="coursecheckbox" type="checkbox" id="tick{{.ID}}" name="tick{{.ID}}" value="tick{{.ID}}"></input>
- {{ end -}}
+ <input aria-label="Enroll in course" class="coursecheckbox" type="checkbox" id="tick{{.ID}}" name="tick{{.ID}}" value="tick{{.ID}}" data-group="{{.Group}}" {{ if ge .Selected .Max }}disabled{{ end }} ></input>
<span id="coursestatus{{.ID}}"></span>
<span id="selected{{.ID}}">{{.Selected}}</span>/<span id="max{{.ID}}">{{.Max}}</span>
</th>