Updated ref display for 2015 rules.

This commit is contained in:
Patrick Fairbank
2015-03-21 21:30:51 -07:00
parent 4e68720127
commit eead22ecef
3 changed files with 6 additions and 27 deletions

View File

@@ -15,9 +15,8 @@ import (
"text/template"
)
var rules = []string{"G3", "G5", "G10", "G11", "G12", "G14", "G15", "G16", "G17", "G18", "G19", "G21", "G22",
"G23", "G24", "G25", "G26", "G26-1", "G27", "G28", "G29", "G30", "G31", "G32", "G34", "G35", "G36", "G37",
"G38", "G39", "G40", "G41", "G42"}
var rules = []string{"G4", "G5", "G6", "G6-1", "G16", "G17", "G18", "G19", "G20", "G21", "G22", "G23", "G24",
"G26", "G30", "G31", "G33", "G34", }
// Renders the referee interface for assigning fouls.
func RefereeDisplayHandler(w http.ResponseWriter, r *http.Request) {
@@ -140,7 +139,6 @@ func RefereeDisplayWebsocketHandler(w http.ResponseWriter, r *http.Request) {
Alliance string
TeamId int
Rule string
IsTechnical bool
}{}
err = mapstructure.Decode(data, &args)
if err != nil {

View File

@@ -6,7 +6,6 @@
var websocket;
var foulAlliance;
var foulTeam;
var foulIsTech;
var foulRule;
// Handles a click on a team button.
@@ -16,12 +15,6 @@ var setFoulTeam = function(teamButton) {
setSelections();
};
// Handles a click on the non-tech/tech foul buttons.
var setFoulIsTech = function(isTech) {
foulIsTech = isTech;
setSelections();
};
// Handles a click on a rule button.
var setFoulRule = function(ruleButton) {
foulRule = $(ruleButton).attr("data-rule");
@@ -34,9 +27,6 @@ var setSelections = function() {
$(teamButton).attr("data-selected", $(teamButton).attr("data-team") == foulTeam);
});
$("#foul").attr("data-selected", !foulIsTech);
$("#techFoul").attr("data-selected", foulIsTech);
$("[data-rule]").each(function(i, ruleButton) {
$(ruleButton).attr("data-selected", $(ruleButton).attr("data-rule") == foulRule);
});
@@ -47,21 +37,19 @@ var setSelections = function() {
// Resets the buttons to their default selections.
var clearFoul = function() {
foulTeam = "";
foulIsTech = false;
foulRule = "";
setSelections();
};
// Sends the foul to the server to add it to the list.
var commitFoul = function() {
websocket.send("addFoul", {Alliance: foulAlliance, TeamId: parseInt(foulTeam), Rule: foulRule,
IsTechnical: foulIsTech});
websocket.send("addFoul", {Alliance: foulAlliance, TeamId: parseInt(foulTeam), Rule: foulRule});
};
// Removes the foul with the given parameters from the list.
var deleteFoul = function(alliance, team, rule, timeSec, isTech) {
var deleteFoul = function(alliance, team, rule, timeSec) {
websocket.send("deleteFoul", {Alliance: alliance, TeamId: parseInt(team), Rule: rule,
TimeInMatchSec: timeSec, IsTechnical: isTech});
TimeInMatchSec: timeSec});
};
// Cycles through no card, yellow card, and red card.

View File

@@ -56,12 +56,6 @@
<a class="btn btn-lg btn-info btn-referee" data-alliance="blue" data-team="{{.Blue3.Id}}"
onclick="setFoulTeam(this);">{{.Blue3.Id}}</a>
</div>
<div class="row">
<a class="btn btn-lg btn-default btn-referee btn-referee-wide" id="foul"
onclick="setFoulIsTech(false);">Foul</a>
<a class="btn btn-lg btn-default btn-referee btn-referee-wide" id="techFoul"
onclick="setFoulIsTech(true);">Tech Foul</a>
</div>
<div class="row">
{{range $rule := .Rules}}
<a class="btn btn-lg btn-warning btn-referee" data-rule="{{$rule}}"
@@ -97,10 +91,9 @@
{{define "foul"}}
<tr class="row-{{.color}}">
<td>{{.foul.TeamId}}</td>
<td>{{if .foul.IsTechnical}}Technical {{end}}Foul</td>
<td>{{.foul.Rule}}</td>
<td><a class="btn btn-sm btn-danger" onclick="deleteFoul('{{.color}}', {{.foul.TeamId}}, '{{.foul.Rule}}',
{{.foul.TimeInMatchSec}}, {{.foul.IsTechnical}});">Delete</a></td>
{{.foul.TimeInMatchSec}});">Delete</a></td>
</tr>
{{end}}
{{define "card"}}