diff options
Diffstat (limited to '')
-rw-r--r-- | static/main.js | 10 | ||||
-rw-r--r-- | tmpl/index.html | 2 | ||||
-rw-r--r-- | ws.go | 2 |
3 files changed, 9 insertions, 5 deletions
diff --git a/static/main.js b/static/main.js index ccf7356..85ff0b7 100644 --- a/static/main.js +++ b/static/main.js @@ -64,12 +64,16 @@ var connect = function(socket) { document.getElementById(`selected${ mar[1] }`).textContent = mar[2] break case "R": /* course selection rejected */ - /* TODO */ - alert("Your course selection was rejected, but Runxi is too lazy to write the code.") + document.getElementById(`coursestatus${ mar[1] }`).textContent = mar[2] + document.getElementById(`coursestatus${ mar[1] }`).style.color = "red" + document.getElementById(`tick${ mar[1] }`).checked = false + document.getElementById(`tick${ mar[1] }`).indeterminate = false break case "Y": /* course selection approved */ - document.getElementById(`tick${ mar[1] }`).indeterminate = false + document.getElementById(`coursestatus${ mar[1] }`).textContent = "" + document.getElementById(`coursestatus${ mar[1] }`).style.removeProperty("color") document.getElementById(`tick${ mar[1] }`).checked = true + document.getElementById(`tick${ mar[1] }`).indeterminate = false break default: alert(`Invalid command ${ mar[0] } received from socket. Something is wrong.`) diff --git a/tmpl/index.html b/tmpl/index.html index 6bc99bb..d55c929 100644 --- a/tmpl/index.html +++ b/tmpl/index.html @@ -106,7 +106,7 @@ {{- range .courses }} <tr class="courseitem" id="course{{.ID}}"> <th scope="row">{{.ID}}</th> - <td><input class="coursecheckbox" type="checkbox" id="tick{{.ID}}" name="tick{{.ID}}" value="tick{{.ID}}"></input></td> + <td><input class="coursecheckbox" type="checkbox" id="tick{{.ID}}" name="tick{{.ID}}" value="tick{{.ID}}"></input><span id="coursestatus{{.ID}}"></span></td> <td><span id="selected{{.ID}}">{{.Selected}}</span>/<span id="max{{.ID}}">{{.Max}}</span></td> <td>{{.Title}}</td> <td id="type{{.ID}}">{{.Type}}</td> @@ -341,7 +341,7 @@ func handleConn( return fmt.Errorf("error affirming course choice: %w", err) } } else { - err = c.Write(ctx, websocket.MessageText, []byte("R "+mar[1])) + err = c.Write(ctx, websocket.MessageText, []byte(fmt.Sprintf("R %s :Full", mar[1]))) if err != nil { return fmt.Errorf("error rejecting course choice: %w", err) } |