使用url()来构建url

This commit is contained in:
masnn committed 2020-06-12 13:37:19 +08:00
1 parent 0efac48bde
commit 86f67a0ec3
61 files changed
+262 -275

No files matched your search

+14 -14
View File
@@ -10,7 +10,7 @@
<ol class="menu">
{% if page_name == 'discussion_node' or page_name == 'discussion_detail' %}
{% if handler.hasPerm(perm.PERM_CREATE_DISCUSSION) %}
<li class="menu__item"><a class="menu__link highlight" href="/discuss/problem/{{ pdoc.docId }}/create">
<li class="menu__item"><a class="menu__link highlight" href="{{ url('discussion_create', type='problem', name=pdoc.docId) }}">
<span class="icon icon-add"></span> {{ _('Create a Discussion') }}
</a></li>
{% else %}
@@ -34,12 +34,12 @@
</a></li>
{% endif %}
{% else %}
<li class="menu__item"><a class="menu__link" href="/p/{{ pdoc.pid }}">
<li class="menu__item"><a class="menu__link" href="{{ url('problem_detail', pid=pdoc.pid) }}">
<span class="icon icon-flag"></span> {{ _('View Problem') }}
</a></li>
{% endif %}
{% if handler.hasPerm(perm.PERM_SUBMIT_PROBLEM) %}
<li class="menu__item scratchpad--hide"><a class="menu__link{% if page_name == 'problem_submit' %} active{% endif %}" href="/p/{{ pdoc.pid }}/submit">
<li class="menu__item scratchpad--hide"><a class="menu__link{% if page_name == 'problem_submit' %} active{% endif %}" href="{{ url('problem_submit', pid=pdoc.pid) }}">
<span class="icon icon-send"></span> {{ _('Submit') }}
</a></li>
{% elif not handler.hasPerm(perm.PERM_LOGGEDIN) %}
@@ -55,21 +55,21 @@
<li class="menu__seperator"></li>
{% endif %}
{% if handler.hasPerm(perm.PERM_VIEW_DISCUSSION) %}
<li class="menu__item"><a class="menu__link{% if page_name == 'discussion_node' or page_name == 'discussion_detail' %} active{% endif %}" href="/discuss/problem/{{ pdoc.docId }}">
<li class="menu__item"><a class="menu__link{% if page_name == 'discussion_node' or page_name == 'discussion_detail' %} active{% endif %}" href="{{ url('discussion_node', type='problem', name=pdoc.docId) }}">
<span class="icon icon-comment--text"></span> {{ _('Discussions') }}
</a></li>
{% endif %}
{% if handler.hasPerm(perm.PERM_VIEW_PROBLEM_SOLUTION) %}
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_solution' %} active{% endif %}" href="/p/{{ pdoc.pid }}/solution">
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_solution' %} active{% endif %}" href="{{ url('problem_solution', pid=pdoc.pid) }}">
<span class="icon icon-comment--text"></span> {{ _('Solutions') }}
</a></li>
{% endif %}
{% if user._id == pdoc.owner or handler.hasPerm(perm.PERM_EDIT_PROBLEM) %}
<li class="menu__seperator"></li>
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_edit' %} active{% endif %}" href="/p/{{ pdoc.pid }}/edit">
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_edit' %} active{% endif %}" href="{{ url('problem_edit', pid=pdoc.pid) }}">
<span class="icon icon-edit"></span> {{ _('Edit') }}
</a></li>
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_settings' %} active{% endif %}" href="/p/{{ pdoc.pid }}/settings">
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_settings' %} active{% endif %}" href="{{ url('problem_settings', pid=pdoc.pid) }}">
<span class="icon icon-wrench"></span> {{ _('Settings') }}
</a></li>
{% endif %}
@@ -89,9 +89,9 @@
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
<dt>{{ _('Submission') }}</dt>
<dd>
{% if pdoc.psdoc['status'] %}
{% if pdoc.psdoc.status %}
<span class="icon record-status--icon {{ model.builtin.STATUS_CODES[pdoc['psdoc']['status']] }}"></span>
<a href="/r/{{ pdoc['psdoc']['rid'] }}" class="record-status--text {{ model.builtin.STATUS_CODES[pdoc['psdoc']['status']] }}">
<a href="{{ url('record_detail', rid=pdoc.psdoc.rid) }}" class="record-status--text {{ model.builtin.STATUS_CODES[pdoc['psdoc']['status']] }}">
{{ model.builtin.STATUS_TEXTS[pdoc['psdoc']['status']] }}
</a>
{% else %}
@@ -107,7 +107,7 @@
{% if pdoc['category'] %}
<span class="hasjs--hide" name="problem-sidebar__categories">
{% for category in pdoc['category'] %}
<a href="/p/category/{{ category }}">{{ category }}</a>
<a href="{{ url('problem_category', category=category) }}">{{ category }}</a>
{% if loop.index < pdoc['category']|length %}
{{ _('problem-subcategory-delim') }}
{% endif %}
@@ -125,11 +125,11 @@
{{ problem.render_problem_tags(pdoc, true) }}
</dd>
<dt>{{ _('# Submissions') }}</dt>
<dd><a href="/r?pid={{ pdoc.docId }}">{{ pdoc.nSubmit }}</a></dd>
<dd><a href="{{ url('record_main', query={pid:pdoc.docId}) }}">{{ pdoc.nSubmit }}</a></dd>
{% if page_name != 'discussion_node' and page_name != 'discussion_detail' %}
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
<dt>{{ _('# My Submissions') }}</dt>
<dd><a href="/r?pid={{ pdoc.docId }}&uid_or_name={{ handler.user._id }}">{{ pdoc['psdoc'].nSubmit|default(0) }}</a></dd>
<dd><a href="{{ url('record_main', query={pid:pdoc.docId, uidOrName:handler.user._id}) }}">{{ pdoc['psdoc'].nSubmit|default(0) }}</a></dd>
{% endif %}
{% endif %}
<dt>{{ _('Accepted') }}</dt>
@@ -150,13 +150,13 @@
{% if tdocs %}
<p>{{ _('In following training plans') }}: </p>
{% for tdoc in tdocs %}
<p><a href="/t/{{ tdoc.docId }}">{{ tdoc.title }}</a></p>
<p><a href="{{ url('training_detail', tid=tdoc.docId) }}">{{ tdoc.title }}</a></p>
{% endfor %}
{% endif %}
{% if ctdocs %}
<p>{{ _('In following contests') }}: </p>
{% for tdoc in ctdocs %}
<p><a href="/c/{{ tdoc.docId }}">{{ tdoc.title }}</a></p>
<p><a href="{{ url('contest_detail', tid=tdoc.docId) }}">{{ tdoc.title }}</a></p>
{% endfor %}
{% endif %}
</div>