contest.hbs 5.85 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
      {{#if teacher}}
        <div class="columns alogin">
          <div class="column is-8 is-offset-2">
58
59
60
61
62
63
            <a href="/group/">
              <div class="notification is-warning">
                <h3 class="title is-5">Gruppenverwaltung</h3>
                <p>Gruppen für die Wettbewerbsteilnahme anlegen und verwalten</p>
              </div>
            </a>
64
65
          </div>
        </div>
66
67

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

79
80
      <div class="columns" id="bare_content">
{{/if}}
81

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

87
            {{#if participation_start_date}}
88
              <p>
89
90
91
92
93
94
                {{#if duration}}  
                  {{#if time_left}}
                    Verbleibenden Zeit: {{time_left}}
                  {{else}}
                    Die Zeit ist abgelaufen. Du kannst nun die Aufgaben nicht mehr öffnen.
                  {{/if}}
95
96
                {{/if}}
              </p>
97

98
99
100
              {{#each contest.tasks}}
                <div style="margin: 10px;">
                  {{name}}
101
   
102
103
                  <ul>
                    {{#each subtasks}}
104
                    <li><a href="/task/{{id}}" class="button is-link is-outlined">{{linktext}}</a></li>
105
106
107
108
                    {{/each}}
                  </ul>
                </div>
              {{/each}}
109

110
111
112
113
              <hr>
              <p>
                Punktestand: {{ total_points }} ★ / {{ max_total_points }}&nbsp; ({{ relative_points }} %)
              </p>
114
115
                
            {{else}}
116

117
118
119
              {{#if can_start}}
                <p>
                  <form action="" method="post">
120
                    <input type="hidden" name="csrf_token" value="{{csrf_token}}">
121
                    <input class="button is-warning" type="submit" value="{{#if contest.duration}}⏱ &nbsp; {{/if}}Jetzt starten!">
122
123
                  </form>
                </p>
124
125
126
127
                
                {{#if contest.duration}}
                   <p>Der Wettbewerb kann nach dem Starten nicht mehr pausiert werden.</p>
                {{/if}}
128
129
130
131
132
133
              {{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}}
134
              {{/if}}
135
            {{/if}}
136
137
          </div>
        </div>
138
        
139
{{#if not_bare}}
140
141
142
143
144
145
      </div>
    </div>
    &nbsp;
    <footer class="footer">
      <div class="content has-text-centered">
        <p>
146
        </p>
147
148
      </div>
    </footer>
149
150

    <script>
151
      // Reload page content as soon as you come back from another task via the back button in order to show the newly achieved stars
152
      function reload_content(event) {
153
        var request = new XMLHttpRequest();
154
155
        request.open("GET","?bare&r=" + Math.random().toString(36).substr(2));
        request.setRequestHeader("X-Requested-With", "XMLHttpRequest");
156
157
158
159
160
161
162
163
        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();
164
      }
165
166

      window.onpageshow = reload_content;
167
    </script>
168
169
  </body>
</html>
170
{{/if}}