Skip to content
Snippets Groups Projects
Commit 2ed33079 authored by Ophestra's avatar Ophestra
Browse files

ugly hack to format in team sizes

parent cefb7ffa
No related branches found
No related tags found
No related merge requests found
......@@ -14,28 +14,57 @@
<div class="contact-form">
<form action="#">
<div class="row">
{{/* {{if .Team}}*/}}
{{/* <div class="col-md-12">*/}}
{{/* <input name="teamName" type="text" placeholder="Takım Adınız">*/}}
{{/* </div>*/}}
{{/* <div class="col-md-6">*/}}
{{/* <input type="text" placeholder="Takım Kaptanınız">*/}}
{{/* </div>*/}}
{{/* {{end}}*/}}
{{if .team_size.A}}
<div class="col-md-12">
<label>
<input name="teamName" type="text" placeholder="Takım Adınız">
</label>
</div>
<div class="col-md-6">
<label>
<input type="text" placeholder="Takım Kaptanınız">
</label>
</div>
{{end}}
<div class="col-md-6">
<input type="text" placeholder="Adınız">
<label>
<input type="text" placeholder="Adınız">
</label>
</div>
<div class="col-md-6">
<input type="text" placeholder="Soyadınız">
<label>
<input type="text" placeholder="Soyadınız">
</label>
</div>
{{/* {{range $i := loop 1 .TeamSize}}*/}}
{{/* <div class="col-md-6">*/}}
{{/* <input type="text" placeholder="Player {{ $i }} Name + UID">*/}}
{{/* </div>*/}}
{{/* {{ end }}*/}}
{{if .team_size.A}}
<div class="col-md-6">
<label>
<input type="text" placeholder="Player 1 Name + UID">
</label>
</div>
{{ end }}
{{if .team_size.B}}
<div class="col-md-6">
<label>
<input type="text" placeholder="Player 2 Name + UID">
</label>
</div>
{{ end }}
{{if .team_size.C}}
<div class="col-md-6">
<label>
<input type="text" placeholder="Player 3 Name + UID">
</label>
</div>
{{ end }}
{{if .team_size.D}}
<div class="col-md-6">
<label>
<input type="text" placeholder="Player 4 Name + UID">
</label>
</div>
{{ end }}
</div>
<button>Gönder</button>
</form>
......
......@@ -8,6 +8,7 @@ import (
"github.com/google/uuid"
"log"
"net/http"
"strconv"
)
func registerRoutes() {
......@@ -44,6 +45,33 @@ func registerRoutes() {
authText, authRef := getAuthButton(user)
var tsn int
if n, err := strconv.Atoi(t.Attributes["size"]); err != nil {
log.Printf("error parsing team size of team %s: %s", t.ID.String(), err)
context.String(http.StatusInternalServerError, "Internal Server Error")
return
} else {
tsn = n
}
ts := struct {
A bool
B bool
C bool
D bool
}{}
if tsn > 0 {
ts.A = true
}
if tsn > 1 {
ts.B = true
}
if tsn > 2 {
ts.C = true
}
if tsn > 3 {
ts.D = true
}
sy, sm, sd := t.StartTime.Date()
dy, dm, dd := t.Deadline.Date()
context.HTML(http.StatusOK, "form.tmpl", gin.H{
......@@ -56,6 +84,7 @@ func registerRoutes() {
TeamSizeString: t.Attributes["size"],
Prize: t.Attributes["prize"],
},
"team_size": ts,
})
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment