Skip to content

Commit

Permalink
Ruth/bug-fixes (#203)
Browse files Browse the repository at this point in the history
* fixes the ds in match play to not get cut off

* add alliance selection buttons

* button fun

* added data to the fieldstatus funciton to make it work lol

* fix alliance selection visual

* fixed bug where the modal show was throwing errors

* forgot to remove commented out old code
  • Loading branch information
Nutella399 authored Nov 5, 2024
1 parent 302a77b commit 17d0bf9
Show file tree
Hide file tree
Showing 5 changed files with 188 additions and 168 deletions.
2 changes: 1 addition & 1 deletion static/css/cheesy-arena.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
border: 1px solid #999;
border-radius: 4px;
padding: 0px;
width: 50px;
width: 60px;
height: 27px;
line-height: 25px;
font-size: 14px;
Expand Down
7 changes: 4 additions & 3 deletions static/js/announcer_display.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@ var handleScorePosted = function(data) {
return;
}

const matchResult = $("#matchResult");
const matchResult = document.getElementById("matchResult");
fetch("/displays/announcer/score_posted")
.then(response => response.text())
.then(html => {
matchResult.html(html);
matchResult.modal("show");
matchResult.innerHTML = html;
const modal = new bootstrap.Modal(matchResult);
modal.show();

// Activate tooltips above the foul listings.
const tooltipTriggerList = document.querySelectorAll("[data-bs-toggle=tooltip]");
Expand Down
3 changes: 3 additions & 0 deletions static/js/field_monitor_display.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ var handleArenaStatus = function(data) {
const wifiStatus = stationStatus.WifiStatus;
teamRadioTextElement.text(wifiStatus.TeamId);

$("#accessPointStatus").attr("data-status", data.AccessPointStatus);
$("#switchStatus").attr("data-status", data.SwitchStatus);

if (stationStatus.DsConn) {
// Format the driver station status box.
var dsConn = stationStatus.DsConn;
Expand Down
209 changes: 105 additions & 104 deletions templates/alliance_selection.html
Original file line number Diff line number Diff line change
@@ -1,127 +1,128 @@
{{/*
Copyright 2014 Team 254. All Rights Reserved.
Author: [email protected] (Patrick Fairbank)
Copyright 2014 Team 254. All Rights Reserved.
Author: [email protected] (Patrick Fairbank)

UI for controlling the alliance selection process.
UI for controlling the alliance selection process.
*/}}
{{define "title"}}Alliance Selection{{end}}
{{define "body"}}
<div class="row">
{{if .ErrorMessage}}
<div class="alert alert-dismissible alert-danger">
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
{{.ErrorMessage}}
</div>
<div class="alert alert-dismissible alert-danger">
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
{{.ErrorMessage}}
</div>
{{end}}
{{if len .Alliances | eq 0}}
<div class="col-lg-3">
<form action="/alliance_selection/start" method="POST">
<legend>Alliance Selection</legend>
<button type="submit" class="btn btn-primary">Start Alliance Selection</button>
</form>
</div>
{{else}}
<div class="col-lg-3 ">
<div class="col-lg-3">
<form action="/alliance_selection/start" method="POST">
<legend>Alliance Selection</legend>
<div class="mb-2">
<button type="submit" class="btn btn-primary" form="alliancesForm">Update</button>
</div>
<div class="mb-2">
<button type="button" class="btn btn-warning"
onclick="$('#confirmResetAllianceSelection').modal('show');">
Reset Alliance Selection
</button>
</div>
<div>
<button type="button" class="btn btn-danger"
onclick="$('#confirmFinalizeAllianceSelection').modal('show');">
Finalize Alliance Selection
</button>
</div>
<button type="submit" class="btn btn-primary">Start Alliance Selection</button>
</form>
</div>
{{else}}
<div class="col-lg-3 ">
<legend>Alliance Selection</legend>
<div class="mb-2">
<button type="submit" class="btn btn-primary" form="alliancesForm">Update</button>
</div>
<div class="col-lg-5">
<form id="alliancesForm" action="" method="POST">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Alliance #</th>
<th>Captain</th>
<th>Pick 1</th>
<th>Pick 2</th>
{{if (index .Alliances 0).TeamIds | len | eq 4}}
<th>Pick 3</th>
{{end}}
</tr>
</thead>
<tbody>
{{range $i, $alliance := .Alliances}}
<tr>
<td class="col-lg-2">{{add $i 1}}</td>
{{range $j, $allianceTeamId := $alliance.TeamIds}}
{{if eq $allianceTeamId 0}}
<td class="col-lg-2">
<input type="text" class="form-control input-sm" name="selection{{$i}}_{{$j}}" value=""
{{if and (eq $i $.NextRow) (eq $j $.NextCol)}}autofocus{{end}}
oninput="$(this).parent().addClass('has-warning');" />
</td>
{{else}}
<td class="col-lg-2">
<input type="text" class="form-control input-sm" name="selection{{$i}}_{{$j}}"
value="{{$allianceTeamId}}" oninput="$(this).parent().addClass('has-warning');" />
</td>
{{end}}
{{end}}
</tr>
{{end}}
</tbody>
</table>
Hint: Press 'Enter' after entering each team number for easiest use.
<div class="card card-body bg-body-secondary mt-4">
<div class="row">
<div class="col-lg-8">
<legend>Selection Timer</legend>
</div>
<div class="col-lg-4 text-end">
<legend id="timer"></legend>
</div>
</div>
<p>Timer is hidden on the audience overlay until the Start/Show button below is pressed.</p>
<div class="row">
<label class="col-lg-5 control-label">Time limit in seconds<br />(0 = disabled)</label>
<div class="col-lg-3">
<input type="text" class="form-control" name="timeLimitSec" value="{{.TimeLimitSec}}"
onblur="setTimer(this);">
</div>
</div>
<div class="mt-3 row justify-content-center">
<div class="col-lg-8 text-center">
<button type="button" class="btn btn-success" onclick="startTimer();">Start/Show Timer</button>
<button type="button" class="btn btn-secondary" onclick="stopTimer();">Stop/Hide Timer</button>
</div>
</div>
</div>
</form>
<div class="mb-2">
<button type="button" class="btn btn-warning" onclick="$('#confirmResetAllianceSelection').modal('show');">
Reset Alliance Selection
</button>
</div>
<div>
<button type="button" class="btn btn-danger" onclick="$('#confirmFinalizeAllianceSelection').modal('show');">
Finalize Alliance Selection
</button>
</div>
<div class="col-lg-2">
</div>
<div class="col-lg-5">
<form id="alliancesForm" action="" method="POST">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Rank</th>
<th>Team</th>
<th>Alliance #</th>
<th>Captain</th>
<th>Pick 1</th>
<th>Pick 2</th>
{{if (index .Alliances 0).TeamIds | len | eq 4}}
<th>Pick 3</th>
{{end}}
</tr>
</thead>
<tbody>
{{range $team := .RankedTeams}}
{{if not $team.Picked}}
<tr>
<td>{{$team.Rank}}</td>
<td>{{$team.TeamId}}</td>
</tr>
{{range $i, $alliance := .Alliances}}
<tr>
<td class="col-lg-2">{{add $i 1}}</td>
{{range $j, $allianceTeamId := $alliance.TeamIds}}
{{if eq $allianceTeamId 0}}
<td class="col-lg-2">
<input type="text" class="form-control input-sm" name="selection{{$i}}_{{$j}}" value="" {{if and (eq $i
$.NextRow) (eq $j $.NextCol)}}autofocus{{end}} oninput="$(this).parent().addClass('has-warning');" />
</td>
{{else}}
<td class="col-lg-2">
<input type="text" class="form-control input-sm" name="selection{{$i}}_{{$j}}" value="{{$allianceTeamId}}"
oninput="$(this).parent().addClass('has-warning');" />
</td>
{{end}}
{{end}}
</tr>
{{end}}
</tbody>
</table>
</div>
Hint: Press 'Enter' after entering each team number for easiest use.
<div class="card card-body bg-body-secondary mt-4">
<div class="row">
<div class="col-lg-8">
<legend>Selection Timer</legend>
</div>
<div class="col-lg-4 text-end">
<legend id="timer"></legend>
</div>
</div>
<p>Timer is hidden on the audience overlay until the Start/Show button below is pressed.</p>
<div class="row">
<label class="col-lg-5 control-label">Time limit in seconds<br />(0 = disabled)</label>
<div class="col-lg-6">
<input type="radio" name="timeLimitSec" value="45" onclick="setTimer(this);"> 45 Seconds( 1st Round Picks ) </br>
<input type="radio" name="timeLimitSec" value="90" onclick="setTimer(this);"> 90 Seconds( 2+ Round Picks ) </br>
<input type="radio" name="timeLimitSec" value="120" onclick="setTimer(this);"> 120 Seconds( Break Time
between Rounds ) </br>
<input type="text" class="form-control" name="timeLimitSec" value="{{.TimeLimitSec}}"
onblur="setTimer(this);">
</div>
</div>
<div class="mt-3 row justify-content-center">
<div class="col-lg-8 text-center">
<button type="button" class="btn btn-success" onclick="startTimer();">Start/Show Timer</button>
<button type="button" class="btn btn-secondary" onclick="stopTimer();">Stop/Hide Timer</button>
</div>
</div>
</div>
</form>
</div>
<div class="col-lg-2">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Rank</th>
<th>Team</th>
</tr>
</thead>
<tbody>
{{range $team := .RankedTeams}}
{{if not $team.Picked}}
<tr>
<td>{{$team.Rank}}</td>
<td>{{$team.TeamId}}</td>
</tr>
{{end}}
{{end}}
</tbody>
</table>
</div>
{{end}}
</div>
<div id="confirmResetAllianceSelection" class="modal" style="top: 20%;">
Expand Down Expand Up @@ -176,9 +177,9 @@ <h4 class="modal-title">Confirm</h4>
<script src="/static/js/match_timing.js"></script>
<script src="/static/js/alliance_selection.js"></script>
<script>
$(function() {
$(function () {
var startTime = moment(new Date()).hour(13).minute(0).second(0);
newDateTimePicker("startTimePicker", startTime.toDate());
});
</script>
{{end}}
{{end}}
Loading

0 comments on commit 17d0bf9

Please sign in to comment.