ui: optimize problemId display

This commit is contained in:
undefined committed 2024-10-22 07:07:29 +08:00
1 parent 29b970e991
commit 7d9df55d09
3 files changed
+15 -10

No files matched your search

@@ -1,16 +1,15 @@
{% macro render_problem_title(pdoc, tdoc=none, show_tags=true, show_invisible_flag=true, invalid=false, inline=false, small=false, alphabetic=false) %} {% macro render_problem_title(pdoc, tdoc=none, show_tags=true, show_invisible_flag=true, invalid=false, inline=false, show_pid=true, small=false, alphabetic=false) %}
{%- if not invalid -%} {%- if not invalid -%}
{% set _linkArgs = { pid:pdoc.pid|default(pdoc.docId) } %} {% set _linkArgs = { pid:pdoc.pid|default(pdoc.docId) } %}
{% if tdoc %}{{ set(_linkArgs, 'query', {tid:tdoc.docId}) }}{% endif %} {% if tdoc %}{{ set(_linkArgs, 'query', {tid:tdoc.docId}) }}{% endif %}
<a href="{{ url('problem_detail', _linkArgs) }}"{% if small %} data-tooltip="{{ pdoc.title }}"{% endif %}> <a href="{{ url('problem_detail', _linkArgs) }}"{% if small %} data-tooltip="{{ pdoc.title }}"{% endif %}>
{%- endif -%} {%- endif -%}
{%- if pdoc.pid and pdoc.pid.includes('-') -%}<b>{{ pdoc.pid.split('-')[0] }}#</b>{%- endif -%} {% if show_pid %}
{%- if tdoc and alphabetic -%} <b>{%- if tdoc and alphabetic -%}{{ String.fromCharCode(65+tdoc.pids.indexOf(pdoc.docId)) }}
<b>{{ String.fromCharCode(65 + tdoc.pids.indexOf(pdoc.docId)) if tdoc.pids.includes(pdoc.docId) else '#' }}</b> {%- elif pdoc.pid and pdoc.pid.includes('-') -%}{{ pdoc.pid.split('-').join('#') }}
{%- else -%} {%- else -%}{{ pdoc.pid|default(pdoc.docId) }}{%- endif -%}</b>
<b>{{ (pdoc.pid.split('-')[1] if pdoc.pid.includes('-') else pdoc.pid) if pdoc.pid else ('P'+pdoc.docId) }}</b> {% endif %}
{%- endif -%} {%- if not small -%}{% if show_pid %}&nbsp;&nbsp;{% endif %}{{ pdoc.title }}{%- endif -%}
{%- if not small -%}&nbsp;&nbsp;{{ pdoc.title }}{%- endif -%}
{%- if not invalid -%} {%- if not invalid -%}
</a> </a>
{%- endif -%} {%- endif -%}
@@ -8,7 +8,7 @@
<div class="section__body typo no-media col--problem-name"> <div class="section__body typo no-media col--problem-name">
{%- for pdoc in pdocs -%} {%- for pdoc in pdocs -%}
<p> <p>
{{ problem.render_problem_title(pdoc, show_tags=false, show_invisible_flag=false) }} {{ problem.render_problem_title(pdoc, show_tags=false, show_invisible_flag=false, show_pid=false) }}
<span style="float: right">{{ datetimeSpan(pdoc._id)|safe }}</span> <span style="float: right">{{ datetimeSpan(pdoc._id)|safe }}</span>
</p> </p>
{%- endfor -%} {%- endfor -%}
@@ -45,7 +45,13 @@
</button> </button>
</form> </form>
{% endif %} {% endif %}
#{{ String.fromCharCode(65+tdoc.pids.indexOf(pdoc.docId)) if tdoc else pdoc.pid|default(pdoc.docId) }}. {{ pdoc.title }} {%- if tdoc -%}
{{ String.fromCharCode(65+tdoc.pids.indexOf(pdoc.docId)) }}
{%- elif pdoc.pid and pdoc.pid.includes('-') -%}
{{ pdoc.pid.split('-').join('#') }}
{%- else -%}
#{{ pdoc.pid|default(pdoc.docId) }}
{%- endif -%}. {{ pdoc.title }}
</h1> </h1>
{% if tdoc and tdoc.pids|length <= 26 %} {% if tdoc and tdoc.pids|length <= 26 %}
<div class="section__tools contest-problems"> <div class="section__tools contest-problems">