算法评测平台前端。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.6 KiB

8 years ago
<% this.title = '比赛' %>
<% include header %>
<div class="padding">
<% if (user && user.is_admin) { %>
<div class="ui grid">
<div class="row">
<div class="column">
<a href="<%= syzoj.utils.makeUrl(['contest', 0, 'edit']) %>" class="ui mini right floated button">添加比赛</a>
</div>
</div>
</div>
<% } %>
<table class="ui very basic center aligned table">
<thead>
<tr>
<th>比赛名称</th>
<th>开始时间</th>
<th>结束时间</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<%
for (let contest of contests) {
let now = syzoj.utils.getCurrentDate();
8 years ago
let tag = '';
%>
<tr>
<% if (now < contest.start_time) { %>
<% tag = '<span class="ui header"><div class="ui mini grey label">未开始</div></span>' %>
<% } else if (now >= contest.start_time && now < contest.end_time) { %>
<% tag = '<span class="ui header"><div class="ui mini green label">进行中</div></span>' %>
<% } else { %>
<% tag = '<span class="ui header"><div class="ui mini red label">已结束</div></span>' %>
<% } %>
<td><a href="<%= syzoj.utils.makeUrl(['contest', contest.id]) %>"><%= contest.title %> <%- tag %></a></td>
<td><%= syzoj.utils.formatDate(contest.start_time) %></td>
<td><%= syzoj.utils.formatDate(contest.end_time) %></td>
<td><%- contest.information %></td>
</tr>
<% } %>
</tbody>
</table>
<br>
<% include page %>
</div>
<% include footer %>