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.
 
 
 
 

64 lines
2.2 KiB

<% this.title = '比赛' %>
<% include header %>
<div class="padding">
<% if (contests.length) { %>
<% if (user && user.is_admin) { %>
<form class="ui mini form">
<div class="inline fields" style="margin-bottom: 25px; white-space: nowrap; ">
<a href="<%= syzoj.utils.makeUrl(['contest', 0, 'edit']) %>" class="ui mini labeled icon right floated button" style="margin-left: auto; ">
<i class="ui icon write"></i>
添加比赛
</a>
</div>
</form>
<% } %>
<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();
let tag = '';
%>
<tr>
<% if (now < contest.start_time) { %>
<% tag = '<span class="ui header"><div class="ui mini red 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 grey 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 class="font-content"><%- contest.subtitle %></td>
</tr>
<% } %>
</tbody>
</table>
<% } else { %>
<div class="ui placeholder segment">
<div class="ui icon header">
<i class="calendar icon" style="margin-bottom: 20px; "></i>
暂无比赛
</div>
<% if (user && user.is_admin) { %>
<a href="<%= syzoj.utils.makeUrl(['contest', 0, 'edit']) %>" class="ui primary labeled icon button">
<i class="ui icon write"></i>
添加第一场比赛
</a>
<% } %>
</div>
<% } %>
<br>
<% include page %>
</div>
<% include footer %>