Submission css

This commit is contained in:
cuom1999 2024-02-02 22:23:05 -06:00
parent 24a9969738
commit 2a4d4e3bc1
6 changed files with 142 additions and 140 deletions

View file

@ -23,5 +23,5 @@ registry.filter(localtime_wrapper(time))
@registry.function
@registry.render_with("widgets/relative-time.html")
def relative_time(time, format=_("N j, Y, g:i a"), rel=_("{time}"), abs=_("on {time}")):
def relative_time(time, format=_("N j, Y, g:i a"), rel=_("{time}"), abs=_("{time}")):
return {"time": time, "format": format, "rel_format": rel, "abs_format": abs}

View file

@ -10,10 +10,11 @@ from . import registry
@registry.function
def gravatar(profile, size=80, default=None, profile_image=None, email=None):
if profile_image:
return profile_image
if profile and profile.profile_image_url:
return profile.profile_image_url
if not profile.is_muted:
if profile_image:
return profile_image
if profile and profile.profile_image_url:
return profile.profile_image_url
if profile:
email = email or profile.email
if default is None:

View file

@ -1,3 +1,5 @@
/*! Dark reader generated CSS | Licensed under MIT https://github.com/darkreader/darkreader/blob/main/LICENSE */
/* User-Agent Style */
html {
background-color: #181a1b !important;
@ -2535,7 +2537,6 @@ ul.pagination a:hover {
color: rgb(232, 230, 227);
background-image: initial;
background-color: rgb(163, 62, 18);
border-color: initial;
}
ul.pagination > li > a,
ul.pagination > li > span {
@ -2818,36 +2819,22 @@ a.voted {
.actionbar .bookmarked {
color: rgb(248, 248, 80);
}
#submissions-table {
.submission-row {
box-shadow: rgba(0, 0, 0, 0.1) 0px 2px 4px;
background-image: initial;
background-color: rgb(24, 26, 27);
}
.submission-row {
border-left-color: rgb(62, 68, 70);
border-right-color: rgb(62, 68, 70);
.submission-row .sub-result .language {
background-color: rgb(41, 44, 46);
}
.submission-row:hover {
background-image: initial;
background-color: rgb(31, 34, 35);
}
.submission-row:first-of-type {
border-top-color: rgb(62, 68, 70);
}
.submission-row > div {
border-bottom-color: rgb(62, 68, 70);
}
.submission-row .sub-result {
border-bottom-color: rgb(48, 52, 54);
border-right-color: rgb(62, 68, 70);
}
.submission-row .sub-result .score {
color: rgb(232, 230, 227);
.submission-row .sub-info .name:hover {
text-decoration-color: initial;
}
.submission-row .sub-testcase {
color: rgb(178, 172, 162);
}
.submission-row .sub-usage {
border-left-color: rgb(62, 68, 70);
.submission-row .sub-user-img {
background-color: rgb(43, 47, 49);
}
#statistics-table tr:not(:first-child) td {
border-top-color: rgb(48, 52, 54) !important;
@ -3778,3 +3765,6 @@ div.mermaid .actor {
.google-symbols {
font-family: 'Google Symbols' !important;
}
.material-icons-extended {
font-family: 'Material Icons Extended' !important;
}

View file

@ -5,64 +5,58 @@
width: 20%;
}
#submissions-table {
background: white;
}
.submission-row {
display: flex;
border-left: #ccc 1px solid;
border-right: #ccc 1px solid;
transition: background-color linear 0.2s;
&:hover {
background: #F2F2F2;
}
&:first-of-type {
border-top: #ccc 1px solid;
border-top-left-radius: $widget_border_radius;
border-top-right-radius: $widget_border_radius;
.sub-result {
border-top-left-radius: $widget_border_radius;
}
}
> div {
padding: 7px 5px;
vertical-align: middle;
border-bottom: #ccc 1px solid;
display: flex;
flex-direction: column;
justify-content: center;
}
margin-bottom: 15px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
align-items: center;
padding: 10px;
background: white;
.sub-result {
min-width: 80px;
width: 80px;
text-align: center;
border-bottom-color: white;
border-right: #ccc 1px solid;
display: flex;
align-items: center;
font-size: 0.9em;
font-weight: 600;
gap: 10px;
.state {
font-size: 0.7em;
font-weight: bold;
padding-top: 0.5em;
font-size: 0.9em;
padding: 5px 10px;
border-radius: 15px;
}
.language {
background-color: #e1e1e1;
border-radius: 5px;
padding: 2px 8px;
}
.score {
font-size: 1.3em;
color: #000;
font-size: 1.2em;
}
}
.sub-details {
flex-grow: 1;
overflow: hidden;
}
.sub-info {
flex: 1;
padding-left: 20px !important;
display: flex;
gap: 5px;
font-size: 1.2em;
margin-bottom: 5px;
.name {
font-weight: 700;
font-size: 1.2em;
}
.name:hover {
text-decoration: underline;
}
}
@ -78,16 +72,31 @@
}
.sub-usage {
min-width: 70px;
width: 70px;
margin-left: auto;
white-space: nowrap;
text-align: center;
border-left: #ccc 1px solid;
text-align: right;
display: flex;
flex-direction: column;
gap: 4px;
.time {
font-weight: bold;
}
}
.sub-user-img {
flex-shrink: 0;
width: 50px;
height: 50px;
background-color: #ddd;
border-radius: 50%;
overflow: hidden;
margin-right: 15px;
img {
width: 100%;
height: auto;
}
}
}
.sub-prop .fa {

View file

@ -9,7 +9,7 @@
{%- endif -%}
{% endwith %}
•
{{ relative_time(post.publish_on, abs=_('on {time}'), rel=_('{time}')) -}}
{{ relative_time(post.publish_on) }}
{%- if post.sticky %} •
<i title="Sticky" class="fa fa-star fa-fw"></i>{% endif -%}
{% if post.is_organization_private and show_organization_private_icon %}

View file

@ -1,45 +1,58 @@
{% set can_view = submission.is_accessible_by(profile) %}
<div class="sub-result {{ submission._result_class if in_hidden_subtasks_contest else submission.result_class }}">
<div class="score">
{%- if submission.is_graded -%}
{%- if submission.status in ('IE', 'CE', 'AB') -%}
---
{%- else -%}
{{ submission.case_points|floatformat(0) }} / {{ submission.case_total|floatformat(0) }}
{%- endif -%}
{%- else -%}
<i class="fa fa-spinner fa-pulse"></i>
{%- endif -%}
</div>
<div class="state">
{% if in_hidden_subtasks_contest and submission.is_graded %}
<span>
{% set ns = namespace(is_first=False) %}
{% for batch in submission.batches %}
{% if batch.id %}
{{ '+' if ns.is_first else '' }}
{% set ns.is_first = True %}
<span class={{'green' if batch.AC else 'red'}}>
{{ batch.points|floatformat(0) }}
</span>
{% endif %}
{% endfor %}
</span>
{% else %}
{% if not in_hidden_subtasks_contest or submission.status in ('IE', 'CE', 'AB') %}
<span title="{{ submission.long_status }}" class="status">{{ submission.short_status }}</span> |
{% endif %}
<span class="language">{{ submission.language.short_display_name }}</span>
<div class="sub-user-img">
<img src="{{gravatar(submission.user)}}">
</div>
<div class="sub-details">
<div class="sub-info{% if submission.status == 'G' %} sub-info-grading{% endif %}">
{{ link_user(submission.user) }}
{% if show_problem %}
<span></span>
<div class="name"><a href="{{ url('problem_detail', submission.problem.code) }}">{{ problem_name }}</a></div>
{% endif %}
</div>
</div>
<div class="sub-info{% if submission.status == 'G' %} sub-info-grading{% endif %}">
{% if show_problem %}
<div class="name"><a href="{{ url('problem_detail', submission.problem.code) }}">{{ problem_name }}</a></div>
{% endif %}
<div>
{{ link_user(submission.user) }}
<span class="time">{{ relative_time(submission.date) }}</span>
<div class="sub-result">
<div class="state {{ submission._result_class if in_hidden_subtasks_contest else submission.result_class }}">
{% if in_hidden_subtasks_contest and submission.is_graded %}
<span>
{% set ns = namespace(is_first=False) %}
{% for batch in submission.batches %}
{% if batch.id %}
{{ '+' if ns.is_first else '' }}
{% set ns.is_first = True %}
<span class={{'green' if batch.AC else 'red'}}>
{{ batch.points|floatformat(0) }}
</span>
{% endif %}
{% endfor %}
</span>
{% else %}
{% if not in_hidden_subtasks_contest or submission.status in ('IE', 'CE', 'AB') %}
<span title="{{ submission.long_status }}" class="status">{{ submission.short_status }}</span>
{% endif %}
{% endif %}
</div>
<div class="score">
{%- if submission.is_graded -%}
{%- if submission.status in ('IE', 'CE', 'AB') -%}
---
{%- else -%}
{{ submission.case_points|floatformat(0) }} / {{ submission.case_total|floatformat(0) }}
{%- endif -%}
{%- else -%}
<i class="fa fa-spinner fa-pulse"></i>
{% if submission.status == 'G' and not in_hidden_subtasks_contest %}
<span class="sub-testcase">
{%- if submission.current_testcase > 0 -%}
{{ _('%(point)s / #%(case)s', point=submission.points|floatformat(1), case=submission.current_testcase-1) }}
{%- endif -%}
</span>
{% endif %}
{%- endif -%}
</div>
<div class="language">
{{ submission.language.short_display_name }}
</div>
<span class="time">{{ relative_time(submission.date, format=_("d/m/Y"))}}</span>
{% if not request.in_contest_mode and submission.contest_object_id %}
<a href="{{ url('contest_view', submission.contest_object.key) }}"
class="submission-contest">
@ -49,34 +62,6 @@
</div>
</div>
{% if submission.status == 'G' and not in_hidden_subtasks_contest %}
<div class="sub-testcase">
{%- if submission.current_testcase > 0 -%}
{{ _('Point %(point)s / Case #%(case)s', point=submission.points|floatformat(1), case=submission.current_testcase) }}
{%- else -%}
...
{%- endif -%}
</div>
{% endif %}
{% if can_view %}
<div class="sub-prop"><div>
<a href="{{ url('submission_status', submission.id) }}">
<i class="fa fa-eye fa-fw"></i><span class="label">{{ _('view') }}</span>
</a>
{% if perms.judge.rejudge_submission %} ·
<a href="#" onclick="rejudge_submission({{ submission.id }}, event);return false">
<i class="fa fa-refresh fa-fw"></i><span class="label">{{ _('rejudge') }}</span>
</a>
{% endif %}
{% if perms.judge.change_submission %} ·
<a href="{{ url('admin:judge_submission_change', submission.id) }}">
<i class="fa fa-cog fa-fw"></i><span class="label">{{ _('admin') }}</span>
</a>
{% endif %}
</div></div>
{% endif %}
<div class="sub-usage">
{% if submission.status in ('QU', 'P', 'G', 'CE', 'IE', 'AB') or in_hidden_subtasks_contest %}
<div class="time">---</div>
@ -91,4 +76,21 @@
{% endif %}
<div class="memory">{{ (submission.memory_bytes|filesizeformat(True)).replace('i', '') }}</div>
{% endif %}
{% if can_view %}
<div class="sub-prop"><div>
<a href="{{ url('submission_status', submission.id) }}">
<i class="fa fa-eye fa-fw"></i><span class="label">{{ _('view') }}</span>
</a>
{% if perms.judge.rejudge_submission %} ·
<a href="#" onclick="rejudge_submission({{ submission.id }}, event);return false">
<i class="fa fa-refresh fa-fw"></i><span class="label">{{ _('rejudge') }}</span>
</a>
{% endif %}
{% if perms.judge.change_submission %} ·
<a href="{{ url('admin:judge_submission_change', submission.id) }}">
<i class="fa fa-cog fa-fw"></i><span class="label">{{ _('admin') }}</span>
</a>
{% endif %}
</div></div>
{% endif %}
</div>