contest.hbs 5.6 KB
Newer Older
1
{{#if not_bare}}
2
3
4
5
6
7
8
<!DOCTYPE html>
<html lang="en" style="background-color: #fafafa;">
  <head>
    <meta charset="utf-8">
    <title>Jugendwettbewerb Informatik: Programmieren – einfacher als du denkst!</title>
    <link rel="stylesheet" href="/static/lib/bulma/bulma-0.7.5.css">
    <link rel="icon" href="/static/images/favicon.png" type="image/png">
9
10
11
12
13
14
15
    <style>
      ul {
      list-style-type: none;
      font-size:x-large;
      margin-left:20px;
      }
    </style>
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  </head>
  <body style="background-color: white;">
    <div class="container">
      <div class="columns">
        <div class="column is-two-thirds">
          <p>&nbsp;<p>
          <a href="/">
            <img style="float:left; margin: 0px 10px;" src="/static/images/klein.png">
          </a>
          <h1 class="title">Jugendwettbewerb Informatik</h1>
          <h2 class="subtitle">Programmieren – einfacher als du denkst!</h2>
        </div>
        <div class="column is-one-third">
          &nbsp;
          {{#if logged_in}}
31
            <div class="columns alogin">
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
              <div class="column is-four-fifths">
                Eingeloggt als <em>{{ username }}</em>
                {{#if firstname}}{{#if lastname}}
                  ({{firstname}} {{lastname}})
                {{/if}}{{/if}}
                {{#if teacher}}
                  [Lehrer]
                {{/if}}
                <br>
                <a href="/profile" class="button is-info is-small">👤 &nbsp; Profil</a>
                {{#if teacher}}
                  <a href="/group/" class="button is-info is-small">&nbsp; Gruppenverwaltung</a>
                {{/if}}
              </div>
              <div class="column"><a href="/logout" class="button is-small is-danger" type="submit">&nbsp; Logout</a></div>
            </div>
            <div class="columns alogin">
              <div class="column"></div>
50
            </div>
51
52
53
          {{/if}}
        </div>
      </div>
54

55
56
57
58
59
60
61
62
63
      {{#if teacher}}
        <div class="columns alogin">
          <div class="column is-8 is-offset-2">
            <div class="notification is-warning">
              <h3 class="title is-5">Gruppenverwaltung</h3>
              <a href="/group/">Gruppen für die Wettbewerbsteilnahme anlegen und verwalten</a>
            </div>
          </div>
        </div>
64
65
66
67
68
69
70
71
72

        <div class="columns alogin">
           <div class="column is-8 is-offset-2">
              <div class="notification is-info">
                 <h3 class="title is-5">Gruppenergebnisse</h3>
                 <a href="/contest/{{ contest.id }}/result/">Ergebnisse meiner Gruppen für diesen Wettbewerb einsehen</a>
              </div>
           </div>
        </div>
73
      {{/if}}
74

75
76
      <div class="columns" id="bare_content">
{{/if}}
77

78
79
        <div class="column is-8 is-offset-2">
          <div style="min-height: 400px; margin-bottom:100px;">
80
            <h3 class="title is-4">Wettbewerb: {{ contest.name }}</h3>
81
            {{#if contest.duration}}<h4 class="subtitle is-5">Dauer: {{contest.duration}} Minuten</h4>{{/if}}
82

83
            {{#if participation_start_date}}
84
85
86
87
88
              <p>
                {{#if time_left}}
                  Verbleibenden Zeit: {{time_left}}
                {{/if}}
              </p>
89

90
91
92
              {{#each contest.tasks}}
                <div style="margin: 10px;">
                  {{name}}
93
   
94
95
                  <ul>
                    {{#each subtasks}}
96
                    <li><a href="/task/{{id}}" class="button is-link is-outlined">{{linktext}}</a></li>
97
98
99
100
                    {{/each}}
                  </ul>
                </div>
              {{/each}}
101

102
103
104
105
              <hr>
              <p>
                Punktestand: {{ total_points }} ★ / {{ max_total_points }}&nbsp; ({{ relative_points }} %)
              </p>
106
107
                
            {{else}}
108

109
110
111
              {{#if can_start}}
                <p>
                  <form action="" method="post">
112
                    <input type="hidden" name="csrf_token" value="{{csrf_token}}">
113
                    <input class="button is-warning" type="submit" value="{{#if contest.duration}}⏱ &nbsp; {{/if}}Jetzt starten!">
114
115
                  </form>
                </p>
116
117
118
119
                
                {{#if contest.duration}}
                   <p>Der Wettbewerb kann nach dem Starten nicht mehr pausiert werden.</p>
                {{/if}}
120
121
122
123
124
125
              {{else}}
                <p>Du kannst diesen Wettbewerb im Moment nicht starten.</p>
                {{#if logged_in}}
                {{else}}
                   <p>Möglicherweise musst du dich zunächst <a href="/login">einloggen</a>.</p>
                {{/if}}
126
              {{/if}}
127
            {{/if}}
128
129
          </div>
        </div>
130
        
131
{{#if not_bare}}
132
133
134
135
136
137
      </div>
    </div>
    &nbsp;
    <footer class="footer">
      <div class="content has-text-centered">
        <p>
138
        </p>
139
140
      </div>
    </footer>
141
142

    <script>
143
      // Reload page content as soon as you come back from another task via the back button in order to show the newly achieved stars
144
      function reload_content(event) {
145
        var request = new XMLHttpRequest();
146
147
        request.open("GET","?bare&r=" + Math.random().toString(36).substr(2));
        request.setRequestHeader("X-Requested-With", "XMLHttpRequest");
148
149
150
151
152
153
154
155
        request.addEventListener('load', function(event) {
          if (request.status >= 200 && request.status < 300) {
            document.getElementById("bare_content").innerHTML = request.responseText;
          } else {
            console.warn(request.statusText, request.responseText);
          }
        });
        request.send();
156
      }
157
158

      window.onpageshow = reload_content;
159
    </script>
160
161
  </body>
</html>
162
{{/if}}