contest.hbs 6.55 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
      


<div class="columns">
<div class="column is-8 is-offset-2">
   <h3 class="title is-4">{{#if duration}}Wettbewerb:{{else}}Trainingsaufgaben:{{/if}} {{ contest.name }}</h3>
   {{#if contest.duration}}<h4 class="subtitle is-5">Dauer: {{contest.duration}} Minuten</h4>{{/if}}
</div>
</div>

{{#if teacher}}
<div class="columns">
<div class="column is-6 is-offset-3">
   <a href="/contest/{{ contest.id }}/result/">
      <div class="notification is-info">
         <h3 class="title is-5">Gruppenergebnisse</h3>
         <p>Ergebnisse meiner Gruppen für diesen Wettbewerb einsehen</p>
      </div>
   </a>
</div>
</div>
100
{{/if}}
101

102
103
104
105
<div class="columns" id="bare_content">
{{/if}}
         <div class="column is-6 is-offset-3">
           <div style="min-height: 400px; margin-bottom:100px;">
106
              
107
108
            <!--  <h3 class="title is-4">{{#if duration}}Wettbewerb:{{else}}Trainingsaufgaben:{{/if}} {{ contest.name }}</h3>
            {{#if contest.duration}}<h4 class="subtitle is-5">Dauer: {{contest.duration}} Minuten</h4>{{/if}} -->
109

110
            {{#if participation_start_date}}
111
              <p>
112
                 {{#if duration}}  
113
114
115
116
117
                  {{#if time_left}}
                    Verbleibenden Zeit: {{time_left}}
                  {{else}}
                    Die Zeit ist abgelaufen. Du kannst nun die Aufgaben nicht mehr öffnen.
                  {{/if}}
118
119
                {{/if}}
              </p>
120

121
122
123
              {{#each contest.tasks}}
                <div style="margin: 10px;">
                  {{name}}
124
   
125
126
                  <ul>
                    {{#each subtasks}}
127
                    <li><a href="/task/{{id}}" class="button is-link is-outlined">{{linktext}}</a></li>
128
129
130
131
                    {{/each}}
                  </ul>
                </div>
              {{/each}}
132

133
134
135
136
              <hr>
              <p>
                Punktestand: {{ total_points }} ★ / {{ max_total_points }}&nbsp; ({{ relative_points }} %)
              </p>
137
138
                
            {{else}}
139

140
141
142
              {{#if can_start}}
                <p>
                  <form action="" method="post">
143
                    <input type="hidden" name="csrf_token" value="{{csrf_token}}">
144
                    <input class="button is-warning" type="submit" value="{{#if contest.duration}}⏱ &nbsp; {{/if}}Jetzt starten!">
145
146
                  </form>
                </p>
147
148
149
150
                
                {{#if contest.duration}}
                   <p>Der Wettbewerb kann nach dem Starten nicht mehr pausiert werden.</p>
                {{/if}}
151
152
153
154
155
156
              {{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}}
157
              {{/if}}
158
            {{/if}}
159
160
          </div>
        </div>
161
        
162
{{#if not_bare}}
163
164
165
166
167
168
      </div>
    </div>
    &nbsp;
    <footer class="footer">
      <div class="content has-text-centered">
        <p>
169
        </p>
170
171
      </div>
    </footer>
172
173

    <script>
174
      // Reload page content as soon as you come back from another task via the back button in order to show the newly achieved stars
175
      function reload_content(event) {
176
        var request = new XMLHttpRequest();
177
178
        request.open("GET","?bare&r=" + Math.random().toString(36).substr(2));
        request.setRequestHeader("X-Requested-With", "XMLHttpRequest");
179
180
181
182
183
184
185
186
        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();
187
      }
188
189

      window.onpageshow = reload_content;
190
    </script>
191
192
  </body>
</html>
193
{{/if}}