feat(contest/standings): wider table when has > 8 problems
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2023-02-16 15:10:24 +08:00
parent b952c2f00b
commit 72ec5e63f4
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
6 changed files with 45 additions and 12 deletions

View File

@ -8,6 +8,8 @@ Auth::check() || redirectToLogin();
UOJContest::init(UOJRequest::get('id')) || UOJResponse::page404();
UOJContest::cur()->userCanView(Auth::user(), ['ensure' => true, 'check-register' => true]);
$PageContainerClass = 'container';
$contest = UOJContest::info();
$is_manager = UOJContest::cur()->userCanManage(Auth::user());
@ -235,7 +237,13 @@ if ($cur_tab == 'dashboard') {
} else {
$reply_question = null;
}
} elseif ($cur_tab == 'standings') {
$PageContainerClass = 'container-fluid';
} elseif ($cur_tab == 'after_contest_standings') {
$PageContainerClass = 'container-fluid';
} elseif ($cur_tab == 'self_reviews') {
$PageContainerClass = 'container-fluid';
$self_reviews_update_form = new UOJForm('self_reviews_update');
$self_reviews_update_form->config['ctrl_enter_submit'] = true;
$self_reviews_update_form->addHidden('self_reviews_update__username', '', function ($username, &$vdata) {
@ -471,7 +479,14 @@ function echoSelfReviews() {
] + UOJContest::cur()->queryResult());
}
?>
<?php echoUOJPageHeader($tabs_info[$cur_tab]['name'] . ' - ' . UOJContest::info('name') . ' - ' . UOJLocale::get('contests::contest')) ?>
<?php
echoUOJPageHeader($tabs_info[$cur_tab]['name'] . ' - ' . UOJContest::info('name') . ' - ' . UOJLocale::get('contests::contest'), [
'PageContainerClass' => $PageContainerClass,
]);
?>
<div class="text-center d-md-none mb-3">
<h1><?= $contest['name'] ?></h1>
@ -493,7 +508,7 @@ function echoSelfReviews() {
<div class="row">
<div <?php if ($cur_tab == 'standings' || $cur_tab == 'after_contest_standings' || $cur_tab == 'self_reviews') : ?> class="col-12" <?php else : ?> class="col-md-9" <?php endif ?>>
<?= HTML::tablist($tabs_info, $cur_tab, 'nav-pills') ?>
<?= HTML::tablist($tabs_info, $cur_tab, 'nav-pills container uoj-contest-nav') ?>
<?php if ($cur_tab == 'standings' || $cur_tab == 'after_contest_standings' || $cur_tab == 'self_reviews') : ?>
<div class="d-none d-md-block text-center">
<h1 class="mt-2 mb-3"><?= $contest['name'] ?></h1>

View File

@ -40,8 +40,8 @@ foreach ($contest_data['people'] as $person) {
?>
<?php if ($contest['extra_config']['basic_rule'] === 'ACM') : ?>
<div class="text-warning">
ACM 比赛的赛后总结暂时不支持显示附加信息。
<div class="text-warning-emphasis text-center">
ACM 比赛的赛后总结暂时不支持显示罚时、附加题等信息。
</div>
<?php endif ?>
@ -74,8 +74,8 @@ foreach ($contest_data['people'] as $person) {
standings,
1,
'<tr>' +
'<th style="width:2em">#</th>' +
'<th style="width:8em">' + uojLocale('username') + '</th>' +
'<th style="width:3em">#</th>' +
'<th style="width:14em">' + uojLocale('username') + '</th>' +
'<th style="width:5em">' + uojLocale('contests::total score') + '</th>' +
$.map(problems, function(col, idx) {
return '<th style="width:10em">' + '<a href="/contest/' + contest_id + '/problem/' + col + '" class="text-decoration-none">' + String.fromCharCode('A'.charCodeAt(0) + idx) + '</a>' + '</th>';

View File

@ -4,7 +4,7 @@
</h4>
<?php endif ?>
<div id="standings"></div>
<div id="standings" class="container"></div>
<script type="text/javascript">
var contest_rule = <?= json_encode($contest['extra_config']['basic_rule']) ?>;
@ -19,5 +19,9 @@
var after_contest = <?= json_encode(isset($after_contest) && $after_contest) ?>;
var first_accepted = {};
if (problems.length > 8) {
$('#standings').removeClass('container');
}
$(document).ready(showStandings());
</script>

View File

@ -9,6 +9,9 @@ if (!isset($PageMainTitleOnSmall)) {
if (!isset($ShowPageHeader)) {
$ShowPageHeader = true;
}
if (!isset($PageContainerClass)) {
$PageContainerClass = 'container';
}
?>
<!DOCTYPE html>
<html lang="<?= UOJLocale::locale() ?>">
@ -245,4 +248,4 @@ if (!isset($ShowPageHeader)) {
<?php uojIncludeView($PageNav, array('REQUIRE_LIB' => $REQUIRE_LIB)) ?>
<?php endif ?>
<div class="uoj-content container flex-fill">
<div class="uoj-content <?= $PageContainerClass ?> flex-fill">

View File

@ -488,3 +488,17 @@ form.form-horizontal {
.white-space-pre {
white-space: pre !important;
}
/* Contest Nav */
.uoj-content.container-fluid .uoj-contest-nav {
padding-left: 0.75rem !important;
padding-right: 0.75rem !important;
}
@media (max-width: 1200px) {
.uoj-content.container-fluid .uoj-contest-nav {
padding-left: 0 !important;
padding-right: 0 !important;
}
}

View File

@ -1762,10 +1762,7 @@ function setACMStandingsTH(th, i, meta) {
if (i == -3) {
return $(th).css('width', '3em').text('#');
} else if (i == -2) {
if (problems.length <= 10) {
$(th).css('width', '14em');
}
return $(th).text(uojLocale('username'));
return $(th).css('width', '14em').text(uojLocale('username'));
} else if (i == -1) {
return $(th).css('width', '5em').text(uojLocale('contests::total score'));
}