增加了比赛列表页

This commit is contained in:
hohoTT
2015-08-22 20:42:21 +08:00
parent 0bf84d1c40
commit 48d48a0f30
5 changed files with 64 additions and 53 deletions

View File

@@ -0,0 +1,12 @@
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
公告
</h3></div>
<div class="panel-body">
{% for item in announcements %}
<p>{{ forloop.counter }}.&nbsp;&nbsp;<a href="/announcement/{{ item.id }}/" target="_blank">{{ item.title }}</a></p>
{% endfor %}
</div>
</div>

View File

@@ -1,6 +1,6 @@
{% extends "oj_base.html" %}
{% block body %}
{% load problem %}
{% load contest %}
<div class="container main">
<div class="row">
<div class="col-lg-9">
@@ -18,11 +18,9 @@
<table class="table table-striped">
<thead>
<tr>
<th></th>
<th>#</th>
<th>比赛名称</th>
<th>开始时间</th>
<th>比赛模式</th>
<th>比赛类型</th>
<th>状态</th>
</tr>
@@ -30,19 +28,9 @@
<tbody>
{% for item in contests %}
<tr>
<th><span class="glyphicon glyphicon-ok ac-flag"></span></th>
<th scope="row"><a href="/contest/{{ item.id }}/">{{ item.id }}</a></th>
<td><a href="/contest/{{ item.id }}/">{{ item.title }}</a></td>
<td>{{ item.start_time }}</td>
{% ifequal item.mode 0 %}
<td>acm模式</td>
{% endifequal %}
{% ifequal item.mode 1 %}
<td>AC数量模式</td>
{% endifequal %}
{% ifequal item.mode 2 %}
<td>AC总分排名模式</td>
{% endifequal %}
{% ifequal item.contest_type 0 %}
<td>小组赛</td>
@@ -54,27 +42,26 @@
<td>公开赛(密码保护)</td>
{% endifequal %}
{% if now < item_start_time %}
<td>比赛还未开始</td>
{% elif item.start_time <= now and now <= item_end_time %}
<td>比赛正在进行</td>
{% else %}
<td>比赛已结束</td>
{% endif %}
<td class="{{ item|contest_status_color }}">{{ item|contest_status }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="form-group">
<label>仅显示当前可参加的比赛
<input id="join" type="checkbox" {% if join %}checked{% endif %} onchange="if(this.checked){location.href='/contests/?join=True'}else{location.href='/contests/'}">
</label>
</div>
<nav>
<ul class="pager">
{% if previous_page %}
<li class="previous"><a
href="/problems/{{ previous_page }}/{% if keyword %}?keyword={{ keyword }}{% endif %}{% if tag %}?tag={{ tag }}{% endif %}">
<li class="previous">
<a href="/contests/{{ previous_page }}/{% if keyword %}?keyword={{ keyword }}{% endif %}{% if join %}?join={{ join }}{% endif %}">
<span aria-hidden="true">&larr;</span> 上一页</a></li>
{% endif %}
{% if next_page %}
<li class="next"><a
href="/problems/{{ next_page }}/{% if keyword %}?keyword={{ keyword }}{% endif %}{% if tag %}?tag={{ tag }}{% endif %}">下一页 <span
<li class="next">
<a href="/contests/{{ next_page }}/{% if keyword %}?keyword={{ keyword }}{% endif %}{% if join %}?join={{ join }}{% endif %}">下一页 <span
aria-hidden="true">&rarr;</span></a></li>
{% endif %}
</ul>
@@ -83,24 +70,12 @@
</div>
<div class="col-lg-3">
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
公告
</h3></div>
<div class="panel-body">
{% for item in announcements %}
{{ forloop.counter }}.&nbsp;&nbsp;<a href="/announcement/{{ item.id }}/" target="_blank">{{ item.title }}</a>
<br>
{% endfor %}
</div>
</div>
{% include "oj/announcement/_announcement_panel.html" %}
</div>
</div>
</div>
{% endblock %}
{% block js_block %}
<script src="/static/js/app/oj/problem/problem_list.js"></script>
{% endblock %}

View File

@@ -55,18 +55,7 @@
</div>
<div class="col-lg-3">
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
公告
</h3></div>
<div class="panel-body">
{% for item in announcements %}
{{ forloop.counter }}.&nbsp;&nbsp;<a href="/announcement/{{ item.id }}/" target="_blank">{{ item.title }}</a>
{% endfor %}
</div>
</div>
{% include "oj/announcement/_announcement_panel.html" %}
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">