Add UI for explicit publishing match schedule to TBA

This commit is contained in:
Kunal Mehta
2016-10-06 15:00:14 -07:00
parent fbd9bda712
commit 564fe33bb6
2 changed files with 34 additions and 0 deletions

View File

@@ -108,10 +108,14 @@ func ScheduleRepublishPostHandler(w http.ResponseWriter, r *http.Request) {
http.Error(w, "Failed to publish matches: "+err.Error(), 500)
return
}
} else {
http.Error(w, "TBA publishing is not enabled", 500)
return
}
http.Redirect(w, r, "/setup/schedule", 302)
}
// Saves the generated schedule to the database.
func ScheduleSavePostHandler(w http.ResponseWriter, r *http.Request) {
if !UserIsAdmin(w, r) {

View File

@@ -53,6 +53,15 @@
<button type="submit" class="btn btn-primary">Save Schedule</button>
</div>
</div>
{{if .EventSettings.TbaPublishingEnabled}}
<div class="form-group">
<div class="col-lg-12">
<button type="button" class="btn btn-info" onclick="$('#confirmPublishSchedule').modal('show');">
Publish Schedule to TBA
</button>
</div>
</div>
{{end}}
</fieldset>
</form>
</div>
@@ -135,6 +144,27 @@
</div>
</div>
</div>
<div id="confirmPublishSchedule" class="modal" style="top: 20%;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Confirm</h4>
</div>
<div class="modal-body">
<p>Are you sure you want to publish the schedule to The Blue Alliance? This will overwrite any
existing matches and their data.</p>
</div>
<div class="modal-footer">
<form class="form-horizontal" action="/setup/schedule/republish" method="POST">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-primary">Publish Schedule</button>
</form>
</div>
</div>
</div>
</div>
{{end}}
{{define "script"}}
<script>var numTeams = {{.NumTeams}};</script>