core&ui: add contest balloon list (#578)

Co-authored-by: undefined <i@undefined.moe>
This commit is contained in:
pandaandundefined authored and GitHub committed 2023-11-05 02:51:25 +08:00
1 parent 8e8c263477
commit 867cd069c5
15 files changed
+341 -8

No files matched your search

@@ -0,0 +1,48 @@
{% import "components/nothing.html" as nothing with context %}
{% extends "layout/basic.html" %}
{% block content %}
{{ set(UiContext, 'tdoc', tdoc) }}
<div class="row">
<div class="medium-9 columns">
<div class="section">
<div class="section__header">
<h1 class="section__title">{{ _('Balloon Status') }}</h1>
<div class="section__tools">
<button class="primary rounded button" name="set_color">{{ _('Set Color') }}</button>
</div>
</div>
{{ noscript_note.render() }}
<div class="section__body no-padding">
{% if not tdoc.balloon|length %}
{{ nothing.render('Please set the balloon color for each problem first.') }}
{% else %}
<table class="data-table record_main__table">
<colgroup>
<col class="col--status">
<col class="col--bid">
<col class="col--problem">
<col class="col--submit-by">
<col class="col--send-by">
<col class="col--awards">
</colgroup>
<thead>
<tr>
<th class="col--status record-status--border">{{ _('Status') }}</th>
<th class="col--bid">{{ _('#') }}</th>
<th class="col--problem">{{ _('Problem') }}</th>
<th class="col--submit-by">{{ _('Submit By') }}</th>
<th class="col--send-by">{{ _('Send By') }}</th>
<th class="col--awards">{{ _('Awards') }}</th>
</tr>
</thead>
{% include "partials/contest_balloon.html" %}
</table>
{% endif %}
</div>
</div>
</div>
<div class="medium-3 columns">
{% include 'partials/contest_sidebar_management.html' %}
</div>
</div>
{% endblock %}
@@ -0,0 +1,37 @@
{% import "components/user.html" as user with context %}
{% import "components/contest.html" as contest with context %}
<tbody data-fragment-id="constest_balloon-tbody">
{%- for bdoc in bdocs -%}
<tr data-bid="{{ bdoc.bid }}">
{% if bdoc.sent %}
<td class="col--status record-status--border pass">
<span class="icon record-status--icon pass"></span>
<span class="record-status--text pass">{{ _('Sent') }}</span>
</td>
{% else %}
<td class="col--status record-status--border pending">
<span class="icon record-status--icon pending"></span>
<span class="record-status--text pending">{{ _('Waiting') }}</span>
</td>
{% endif %}
<td class="col--bid">{{ bdoc._id.toHexString()|truncate(8,true,'') }}</td>
<td class="col--problem col--problem-name" style="color:{{ tdoc.balloon[bdoc.pid].color }}">
{% if not bdoc.sent %}
<form class="form--inline" method="post">
<input type="hidden" name="balloon" value="{{ bdoc._id.toHexString() }}">
<button type="submit" name="operation" value="done" class="link text-maroon lighter" data-balloon="{{ bdoc._id.toHexString() }}">
<span class="icon icon-send"></span>
{{ _('Send') }}
</button>
</form>
{% endif %}
<b>{{ String.fromCharCode(65+tdoc.pids.indexOf(bdoc.pid)) }}</b>&nbsp;&nbsp;({{ tdoc.balloon[bdoc.pid].name }})
</td>
<td class="col--submit-by" data-tooltip="{{ bdoc._id.getTimestamp().format() }}">{{ user.render_inline(udict[bdoc.uid], badge=false) }}</td>
<td class="col--send-by"{% if bdoc.sent %} data-tooltip="{{ bdoc.sentAt.format() }}"{% endif %}>
{% if bdoc.sent %}{{ user.render_inline(udict[bdoc.sent], avatar=false, badge=false) }}{% else %}-{% endif %}
</td>
<td class="col--awards">{% if bdoc.first %}{{ _('First of Problem') }}{% endif %}</td>
</tr>
{%- endfor -%}
</tbody>
@@ -26,6 +26,9 @@
<li class="menu__item"><a class="menu__link" href="{{ url('record_main', query={tid:tdoc.docId}) }}">
<span class="icon icon-flag"></span> {{ _('All Submissions') }}
</a></li>
<li class="menu__item"><a class="menu__link" href="{{ url('contest_balloon', tid=tdoc.docId) }}">
<span class="icon icon-balloon"></span> {{ _('Balloon Status') }}
</a></li>
<li class="menu__seperator"></li>
</ol>
</div>