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.function
@registry.render_with("widgets/relative-time.html") @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} return {"time": time, "format": format, "rel_format": rel, "abs_format": abs}

View file

@ -10,10 +10,11 @@ from . import registry
@registry.function @registry.function
def gravatar(profile, size=80, default=None, profile_image=None, email=None): def gravatar(profile, size=80, default=None, profile_image=None, email=None):
if profile_image: if not profile.is_muted:
return profile_image if profile_image:
if profile and profile.profile_image_url: return profile_image
return profile.profile_image_url if profile and profile.profile_image_url:
return profile.profile_image_url
if profile: if profile:
email = email or profile.email email = email or profile.email
if default is None: 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 */ /* User-Agent Style */
html { html {
background-color: #181a1b !important; background-color: #181a1b !important;
@ -2535,7 +2537,6 @@ ul.pagination a:hover {
color: rgb(232, 230, 227); color: rgb(232, 230, 227);
background-image: initial; background-image: initial;
background-color: rgb(163, 62, 18); background-color: rgb(163, 62, 18);
border-color: initial;
} }
ul.pagination > li > a, ul.pagination > li > a,
ul.pagination > li > span { ul.pagination > li > span {
@ -2818,36 +2819,22 @@ a.voted {
.actionbar .bookmarked { .actionbar .bookmarked {
color: rgb(248, 248, 80); color: rgb(248, 248, 80);
} }
#submissions-table { .submission-row {
box-shadow: rgba(0, 0, 0, 0.1) 0px 2px 4px;
background-image: initial; background-image: initial;
background-color: rgb(24, 26, 27); background-color: rgb(24, 26, 27);
} }
.submission-row { .submission-row .sub-result .language {
border-left-color: rgb(62, 68, 70); background-color: rgb(41, 44, 46);
border-right-color: rgb(62, 68, 70);
} }
.submission-row:hover { .submission-row .sub-info .name:hover {
background-image: initial; text-decoration-color: 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-testcase { .submission-row .sub-testcase {
color: rgb(178, 172, 162); color: rgb(178, 172, 162);
} }
.submission-row .sub-usage { .submission-row .sub-user-img {
border-left-color: rgb(62, 68, 70); background-color: rgb(43, 47, 49);
} }
#statistics-table tr:not(:first-child) td { #statistics-table tr:not(:first-child) td {
border-top-color: rgb(48, 52, 54) !important; border-top-color: rgb(48, 52, 54) !important;
@ -3778,3 +3765,6 @@ div.mermaid .actor {
.google-symbols { .google-symbols {
font-family: 'Google Symbols' !important; font-family: 'Google Symbols' !important;
} }
.material-icons-extended {
font-family: 'Material Icons Extended' !important;
}

View file

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

View file

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

View file

@ -1,45 +1,58 @@
{% set can_view = submission.is_accessible_by(profile) %} {% 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="sub-user-img">
<div class="score"> <img src="{{gravatar(submission.user)}}">
{%- if submission.is_graded -%} </div>
{%- if submission.status in ('IE', 'CE', 'AB') -%} <div class="sub-details">
--- <div class="sub-info{% if submission.status == 'G' %} sub-info-grading{% endif %}">
{%- else -%} {{ link_user(submission.user) }}
{{ submission.case_points|floatformat(0) }} / {{ submission.case_total|floatformat(0) }} {% if show_problem %}
{%- endif -%} <span></span>
{%- else -%} <div class="name"><a href="{{ url('problem_detail', submission.problem.code) }}">{{ problem_name }}</a></div>
<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>
{% endif %} {% endif %}
</div> </div>
</div> <div class="sub-result">
<div class="sub-info{% if submission.status == 'G' %} sub-info-grading{% endif %}"> <div class="state {{ submission._result_class if in_hidden_subtasks_contest else submission.result_class }}">
{% if show_problem %} {% if in_hidden_subtasks_contest and submission.is_graded %}
<div class="name"><a href="{{ url('problem_detail', submission.problem.code) }}">{{ problem_name }}</a></div> <span>
{% endif %} {% set ns = namespace(is_first=False) %}
<div> {% for batch in submission.batches %}
{{ link_user(submission.user) }} {% if batch.id %}
<span class="time">{{ relative_time(submission.date) }}</span> {{ '+' 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 %} {% if not request.in_contest_mode and submission.contest_object_id %}
<a href="{{ url('contest_view', submission.contest_object.key) }}" <a href="{{ url('contest_view', submission.contest_object.key) }}"
class="submission-contest"> class="submission-contest">
@ -49,34 +62,6 @@
</div> </div>
</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"> <div class="sub-usage">
{% if submission.status in ('QU', 'P', 'G', 'CE', 'IE', 'AB') or in_hidden_subtasks_contest %} {% if submission.status in ('QU', 'P', 'G', 'CE', 'IE', 'AB') or in_hidden_subtasks_contest %}
<div class="time">---</div> <div class="time">---</div>
@ -91,4 +76,21 @@
{% endif %} {% endif %}
<div class="memory">{{ (submission.memory_bytes|filesizeformat(True)).replace('i', '') }}</div> <div class="memory">{{ (submission.memory_bytes|filesizeformat(True)).replace('i', '') }}</div>
{% endif %} {% 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> </div>