about summary refs log tree commit diff
path: root/templates/battleNew.html
blob: 30923e7b6ffc0798b5c10fda72f90029d7315e8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{{ define "battleNew" }}

{{ template "head" . }}
<body>
  {{ template "nav" . }}

  <span id="newbattle"></span>
  <h1><a href="#newbattle">New battle</a></h1>
  
  <p>A battle is a <b>collection</b> of fights intended to be fought with multiple bots. In case you just want to try out two bots, create a <a href="/battle/quick">quick</a> battle!</p>
  <br>
  <p>Select the values you find appropriate. Bots can be added to the battle later.</p>

  <br>

  <table>
    <form id="battle" method="POST" action="/battle/new">
      <tr>
        <td><label for="name">Name:</label></td>
        <td><input class="border" type="text" id="name" name="name" autofocus></td>
      </tr>

      <tr>
        <td>Archs:</td>
        <td>{{ range $idx, $arch := .archs }}{{ if $idx }},{{ end }}
          <input
            type="checkbox"
            class="check-with-label"
            name="arch-{{$arch.ID}}"
            id="arch-{{$arch.ID}}"
            form="battle"
            {{if eq $arch.Name "x86-64"}}checked{{end}}
            {{if eq $arch.Name "ARM"}}checked{{end}}/>
          <label class="label-for-check" for="arch-{{$arch.ID}}">{{$arch.Name}}</label>
          {{- end }}
        </td>
      </td>

      <tr>
        <td>Bits:</td>
        <td>
          {{ range $idx, $bit := .bits}}{{if $idx}},{{end}}
          <input
            type="checkbox"
            class="check-with-label"
            name="bit-{{$bit.ID}}"
            id="bit-{{$bit.ID}}"
            {{if eq $bit.Name "32"}}checked{{end}}
            {{if eq $bit.Name "64"}}checked{{end}}/>
          <label class="label-for-check" for="bit-{{$bit.ID}}">{{$bit.Name}}</label>
          {{- end }}
        </td>
      </td>

      <tr>
        <td>Public:</td>
        <td>
          <input
            type="checkbox"
            name="public"
            id="public"/>
        </td>
      </td>

      <tr>
        <td></td>
        <td><input class="border" type="submit" value="Create"></td>
      </tr>

      {{ if .res }}
      <tr>
        <td></td>
        <td>{{ .res }}</td>
      </tr>
      {{ end }}
    </form>
  </table>
</body>
{{ template "footer" . }}
{{ end }}