-
Notifications
You must be signed in to change notification settings - Fork 0
/
contest_list.html
46 lines (46 loc) · 1.23 KB
/
contest_list.html
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
{{define "content"}}
<div class="col-sm-12">
<div class="bs-component">
<div class="well">
<h1>Contests</h1>
</div>
</div>
<table id="contests" class="table table-striped table-hover ">
<thead>
<tr>
<th>#</th>
<th>Title</th>
<th>Status</th>
<th>Details</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<script type="text/javascript">
$(function() {
list = JSON.parse({{.List}});
var wrapTd = function(s) {
return '<td>' + s + '</td>';
};
list.forEach(function(v) {
var line = $();
line = line.add(wrapTd(v.id));
line = line.add(wrapTd(v.title));
if (v.status == 0) {
line = line.add(wrapTd('<span class="label label-success">Succuess</span>'));
line = line.add(wrapTd('<a href="/contests/' + v.id + '">Detail</a>'));
} else if (v.status == 2) {
line = line.add(wrapTd('<span class="label label-info">Verifying...</span>'));
line = line.add(wrapTd('-'));
} else {
line = line.add(wrapTd('<span class="label label-primary">Running...</span>'));
line = line.add(wrapTd('-'));
}
line = line.wrapAll('<tr />').parent();
$("#contests > tbody").append(line);
});
});
</script>
</div>
{{end}}