template: problem_list

This commit is contained in:
masnn committed 2020-04-03 20:56:20 +08:00
1 parent fc26af30ef
commit 2e23d05a59
28 files changed
+357 -270

No files matched your search

+7 -22
View File
@@ -8,7 +8,7 @@
{% else %}
<table class="data-table">
<colgroup>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
<col class="col--status">
{% endif %}
<col class="col--name">
@@ -18,7 +18,7 @@
</colgroup>
<thead>
<tr>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
<th class="col--status record-status--border">{{ _('Status') }}</th>
{% endif %}
<th class="col--name">{{ _('Problem') }}</th>
@@ -29,9 +29,9 @@
</thead>
<tbody>
{% for pdoc in pdocs %}
{% with psdoc = psdict[pdoc['doc_id']] %}
{% set psdoc = psdict[pdoc['_id']] %}
<tr>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if psdoc['rid'] %}
{{ record.render_status_td(psdoc, rid_key='rid') }}
{% else %}
@@ -40,27 +40,12 @@
{% endif %}
{% endif %}
<td class="col--name col--problem-name">
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
<form class="form--inline" action="{{ reverse_url('problem_main') }}" method="post">
<input type="hidden" name="pid" value="{{ pdoc['doc_id'] }}">
<input type="hidden" name="operation" value="{% if not psdoc['star'] %}star{% else %}unstar{% endif %}">
<input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
<button class="star{% if psdoc['star'] %} activated{% endif %}" type="submit">
<span class="starred--hide"><span class="icon icon-star--outline" data-tooltip="{{ _('Star') }}"></span></span>
<span class="starred--show"><span class="icon icon-star" data-tooltip="{{ _('Unstar') }}"></span></span>
</button>
</form>
{% endif %}
{{ problem.render_problem_title(
pdoc,
rp=vj4.job.rp.get_rp_expect(pdoc) if (not psdoc or psdoc['status'] != vj4.constant.record.STATUS_ACCEPTED) else none
) }}
{{ problem.render_problem_title(pdoc) }}
</td>
<td class="col--submit_n">{{ pdoc['num_submit'] }}</td>
<td class="col--ac_rate">{{ (100 * pdoc['num_accept'] / pdoc['num_submit'])|round|int if pdoc['num_submit'] > 0 else _('?') }}</td>
<td class="col--submit_n">{{ pdoc['nSubmit'] }}</td>
<td class="col--ac_rate">{{ (100 * pdoc['nAccept'] / pdoc['nSubmit'])|round|int if pdoc['nSubmit'] > 0 else _('?') }}</td>
<td class="col--difficulty">{{ pdoc['difficulty'] or _('(None)') }}</td>
</tr>
{% endwith %}
{% endfor %}
</tbody>
</table>