core&ui: add contest_problemlist page

This commit is contained in:
undefined committed 2022-11-30 17:44:17 +08:00
1 parent a364519a2e
commit a43dc22599
12 files changed
+291 -169

No files matched your search

@@ -107,3 +107,63 @@ $highlight-button-color = #F6DF45
.detail-button
width: auto
.page--contest_edit
.page--contest_create
label
&.checkbox
margin-top: 24px
.page--contest_problemlist
.col--status
width: rem(150px)
.col--submit-at
width: rem(150px)
.col--problem
border-left: 1px solid $table-border-color
+mobile()
.col--submit-at
display: none
.page--contest_scoreboard
.main
.row
max-width: 100vw !important;
.col--rank
width: rem(60px)
text-align: center
border-right: 1px solid $table-border-color
.col--user
min-width: rem(150px)
.col--solved, .col--time
width: rem(70px)
text-align: center
.col--total_score
width: rem(100px)
text-align: center
.col--problem
width: rem(100px)
border-left: 1px solid $table-border-color
text-align: center
.scoreboard--acm
.col--problem
width: rem(70px) !important
+mobile()
.col--user
width: auto
.col--problem
display: none
@@ -1,13 +0,0 @@
.page--contest_detail
.col--status
width: rem(150px)
.col--submit-at
width: rem(150px)
.col--problem
border-left: 1px solid $table-border-color
+mobile()
.col--submit-at
display: none
@@ -1,6 +0,0 @@
.page--contest_edit
.page--contest_create
label
&.checkbox
margin-top: 24px
@@ -1,36 +0,0 @@
.page--contest_scoreboard
.main
.row
max-width: 100vw !important;
.col--rank
width: rem(60px)
text-align: center
border-right: 1px solid $table-border-color
.col--user
min-width: rem(150px)
.col--solved, .col--time
width: rem(70px)
text-align: center
.col--total_score
width: rem(100px)
text-align: center
.col--problem
width: rem(100px)
border-left: 1px solid $table-border-color
text-align: center
.scoreboard--acm
.col--problem
width: rem(70px) !important
+mobile()
.col--user
width: auto
.col--problem
display: none
@@ -37,66 +37,6 @@
{% endif %}
</div>
</div>
<div class="section">
<div class="section__header">
<h1 class="section__title">{{ _('Problem') }}</h1>
</div>
{% if pdict %}
<div class="section__body no-padding">
<table class="data-table">
<colgroup>
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<col class="col--status">
<col class="col--submit-at">
{% endif %}
<col class="col--problem">
</colgroup>
<thead>
<tr>
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<th class="col--status record-status--border">{{ _('Status') }}</th>
<th class="col--submit-at">{{ _('Last Submit At') }}</th>
{% endif %}
<th class="col--problem">{{ _('Problem') }}</th>
</tr>
</thead>
<tbody>
{% set isAdmin = handler.user.own(tdoc) or handler.user.hasPerm(perm.PERM_VIEW_CONTEST_HIDDEN_SCOREBOARD) %}
{% set ntdoc = model.contest.isDone(tdoc) or (tsdoc.attend and not model.contest.isNotStarted(tdoc)) %}
{%- for pid in tdoc.pids -%}
<tr>
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
{% if psdict[pid] and psdict[pid].rid %}
{% set rdoc = rdict[psdict[pid].rid] %}
{% if model.contest.canShowSelfRecord.call(handler, tdoc) %}
{{ record.render_status_td(rdoc) }}
{% else %}
<td class="col--status record-status--border"><a href="{{ url('record_detail', rid=rdoc._id) }}">{{ _('Submitted') }}</a></td>
{% endif %}
<td class="col--submit-at">{{ datetimeSpan(rdoc._id)|safe }}</td>
{% else %}
<td class="col--status record-status--border">{{ _('No Submissions') }}</td>
<td class="col--submit-at">-</td>
{% endif %}
{% endif %}
<td class="col--problem col--problem-name">
{% if isAdmin and not ntdoc %}
{{ problem.render_problem_title(pdict[pid], show_invisible_flag=false, show_tags=false) }}
{% else %}
{{ problem.render_problem_title(pdict[pid], tdoc=tdoc, show_invisible_flag=false, show_tags=false) }}
{% endif %}
</td>
</tr>
{%- endfor -%}
</tbody>
</table>
</div>
{% elif tsdoc.attend %}
{{ nothing.render('This contest is not live.') }}
{% else %}
{{ nothing.render('Please attend contest to see the problems.') }}
{% endif %}
</div>
</div>
<div class="medium-3 columns">
{% set owner_udoc = udict[tdoc.owner] %}
@@ -108,7 +108,7 @@
<div class="columns">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
{% if page_name == 'contest_edit' %}
<button type="submit" class="rounded primary button">
<button name="operation" value="update" type="submit" class="rounded primary button">
{{ _('Update') }}
</button>
{% if handler.user.own(tdoc) or handler.user.hasPerm(perm.PERM_EDIT_CONTEST) %}
@@ -117,7 +117,7 @@
</button>
{% endif %}
{% else %}
<button type="submit" class="rounded primary button">
<button name="operation" value="update" type="submit" class="rounded primary button">
{{ _('Create') }}
</button>
{% endif %}
@@ -0,0 +1,100 @@
{% extends "layout/basic.html" %}
{% import "components/contest.html" as contest with context %}
{% import "components/record.html" as record with context %}
{% import "components/problem.html" as problem with context %}
{% 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">{{ _('Problem') }}</h1>
</div>
<div class="section__body no-padding">
<table class="data-table">
<colgroup>
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<col class="col--status">
<col class="col--submit-at">
{% endif %}
<col class="col--problem">
</colgroup>
<thead>
<tr>
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<th class="col--status record-status--border">{{ _('Status') }}</th>
<th class="col--submit-at">{{ _('Last Submit At') }}</th>
{% endif %}
<th class="col--problem">{{ _('Problem') }}</th>
</tr>
</thead>
<tbody>
{%- for pid in tdoc.pids -%}
<tr>
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
{% if psdict[pid] and psdict[pid].rid %}
{% set rdoc = rdict[psdict[pid].rid] %}
{% if model.contest.canShowSelfRecord.call(handler, tdoc) %}
{{ record.render_status_td(rdoc) }}
{% else %}
<td class="col--status record-status--border"><a href="{{ url('record_detail', rid=rdoc._id) }}">{{ _('Submitted') }}</a></td>
{% endif %}
<td class="col--submit-at">{{ datetimeSpan(rdoc._id)|safe }}</td>
{% else %}
<td class="col--status record-status--border">{{ _('No Submissions') }}</td>
<td class="col--submit-at">-</td>
{% endif %}
{% endif %}
<td class="col--problem col--problem-name">
{{ problem.render_problem_title(pdict[pid], tdoc=tdoc, show_invisible_flag=false, show_tags=false) }}
</td>
</tr>
{%- endfor -%}
</tbody>
</table>
</div>
</div>
<div class="section">
<div class="section__body no-padding">
{% if not rdocs.length %}
{{ nothing.render('Oh, there is no task in the queue!') }}
{% else %}
<table class="data-table record_main__table">
<colgroup>
<col class="col--status">
<col class="col--problem">
<col class="col--submit-by">
<col class="col--time">
<col class="col--memory">
<col class="col--lang">
<col class="col--submit-at">
</colgroup>
<thead>
<tr>
<th class="col--status record-status--border">{{ _('Status') }}</th>
<th class="col--problem">{{ _('Problem') }}</th>
<th class="col--submit-by">{{ _('Submit By') }}</th>
<th class="col--time">{{ _('Time') }}</th>
<th class="col--memory">{{ _('Memory') }}</th>
<th class="col--lang">{{ _('Language') }}</th>
<th class="col--submit-at">{{ _('Submit At') }}</th>
</tr>
</thead>
<tbody>
{%- for rdoc in rdocs -%}
{% set udoc = udict[rdoc['uid']] %}
{% set pdoc = pdict[rdoc['pid']] %}
{% include 'record_main_tr.html' %}
{%- endfor -%}
</tbody>
</table>
{% endif %}
</div>
</div>
</div>
<div class="medium-3 columns">
{% set owner_udoc = udict[tdoc.owner] %}
{% include "partials/contest_sidebar.html" %}
</div>
</div>
{% endblock %}