mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
ui: optimize problemId display
This commit is contained in:
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 -%}
|
||||
{% set _linkArgs = { pid:pdoc.pid|default(pdoc.docId) } %}
|
||||
{% if tdoc %}{{ set(_linkArgs, 'query', {tid:tdoc.docId}) }}{% endif %}
|
||||
<a href="{{ url('problem_detail', _linkArgs) }}"{% if small %} data-tooltip="{{ pdoc.title }}"{% endif %}>
|
||||
{%- endif -%}
|
||||
{%- if pdoc.pid and pdoc.pid.includes('-') -%}<b>{{ pdoc.pid.split('-')[0] }}#</b>{%- endif -%}
|
||||
{%- if tdoc and alphabetic -%}
|
||||
<b>{{ String.fromCharCode(65 + tdoc.pids.indexOf(pdoc.docId)) if tdoc.pids.includes(pdoc.docId) else '#' }}</b>
|
||||
{%- else -%}
|
||||
<b>{{ (pdoc.pid.split('-')[1] if pdoc.pid.includes('-') else pdoc.pid) if pdoc.pid else ('P'+pdoc.docId) }}</b>
|
||||
{%- endif -%}
|
||||
{%- if not small -%} {{ pdoc.title }}{%- endif -%}
|
||||
{% if show_pid %}
|
||||
<b>{%- if tdoc and alphabetic -%}{{ 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 -%}</b>
|
||||
{% endif %}
|
||||
{%- if not small -%}{% if show_pid %} {% endif %}{{ pdoc.title }}{%- endif -%}
|
||||
{%- if not invalid -%}
|
||||
</a>
|
||||
{%- endif -%}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<div class="section__body typo no-media col--problem-name">
|
||||
{%- for pdoc in pdocs -%}
|
||||
<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>
|
||||
</p>
|
||||
{%- endfor -%}
|
||||
|
||||
@@ -45,7 +45,13 @@
|
||||
</button>
|
||||
</form>
|
||||
{% 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>
|
||||
{% if tdoc and tdoc.pids|length <= 26 %}
|
||||
<div class="section__tools contest-problems">
|
||||
|
||||
Reference in new issue
Block a user