You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Hydro/templates/partials/problem_sidebar_normal.html

189 lines
8.6 KiB
HTML

5 years ago
{% import "components/user.html" as user with context %}
{% import "components/problem.html" as problem with context %}
<div class="section side section--problem-sidebar">
{% if page_name != 'problem_detail' and page_name != 'contest_detail_problem' %}
<div class="section__header">
<h1 class="section__title">{{ pdoc['title'] }}</h1>
</div>
{% endif %}
<div>
<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="{{ reverse_url('discussion_create_document_as_node', doc_type=pdoc['doc_type'], doc_id=pdoc['_id']) }}">
5 years ago
<span class="icon icon-add"></span> {{ _('Create a Discussion') }}
</a></li>
{% else %}
{% if not handler.hasPerm(perm.PERM_LOGGEDIN) %}
5 years ago
<li class="menu__item"><a class="menu__link" href="javascript:showSignInDialog();">
<span class="icon icon-add"></span> {{ _('Login to Create a Discussion') }}</a></li>
{% else %}
<li class="menu__item"><a class="menu__link disabled" href="javascript:;">
<span class="icon icon-add"></span> {{ _('No Permission to Create a Discussion') }}</a></li>
{% endif %}
{% endif %}
<li class="menu__seperator"></li>
{% endif %}
{% if page_name == 'problem_detail' %}
{% if handler.hasPerm(perm.PERM_SUBMIT_PROBLEM) %}
5 years ago
<li class="menu__item scratchpad--hide"><a class="menu__link highlight" name="problem-sidebar__open-scratchpad" href="javascript:;" data-global-hotkey="alt+e">
<span class="icon icon-enlarge"></span> {{ _('Open Scratchpad') }} (Alt+E)
</a></li>
<li class="menu__item non-scratchpad--hide"><a class="menu__link" name="problem-sidebar__quit-scratchpad" href="javascript:;" data-global-hotkey="alt+q">
<span class="icon icon-enlarge"></span> {{ _('Quit Scratchpad') }} (Alt+Q)
</a></li>
{% endif %}
{% else %}
<li class="menu__item"><a class="menu__link" href="/p/{{ pdoc.pid }}">
5 years ago
<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">
5 years ago
<span class="icon icon-send"></span> {{ _('Submit') }}
</a></li>
{% elif not handler.hasPerm(perm.PERM_LOGGEDIN) %}
5 years ago
<li class="menu__item scratchpad--hide"><a class="menu__link{% if page_name == 'problem_submit' %} active{% endif %}" href="javascript:showSignInDialog();">
<span class="icon icon-send"></span> {{ _('Login to Submit') }}
</a></li>
{% else %}
<li class="menu__item scratchpad--hide"><a class="menu__link disabled{% if page_name == 'problem_submit' %} active{% endif %}" href="javascript:;">
<span class="icon icon-send"></span> {{ _('No Permission to Submit') }}
</a></li>
{% endif %}
{% if handler.hasPerm(perm.PERM_VIEW_DISCUSSION) or handler.hasPerm(perm.PERM_VIEW_PROBLEM_SOLUTION) %}
5 years ago
<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="{{ reverse_url('discussion_node_document_as_node', doc_type=pdoc['doc_type'], doc_id=pdoc['_id']) }}">
5 years ago
<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">
5 years ago
<span class="icon icon-comment--text"></span> {{ _('Solutions') }}
</a></li>
{% endif %}
{% if page_name == 'problem_detail' and handler.hasPerm(perm.PERM_LOGGEDIN) %}
5 years ago
<li class="menu__seperator"></li>
<li class="menu__item"><a class="menu__link" name="problem-sidebar__copy-to" href="javascript:;">
<span class="icon icon-copy"></span> {{ _('Copy Problem') }}
</a></li>
{% endif %}
{% if user._id == pdoc.owner or handler.hasPerm(perm.PERM_EDIT_PROBLEM) %}
5 years ago
<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">
5 years ago
<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">
5 years ago
<span class="icon icon-wrench"></span> {{ _('Settings') }}
</a></li>
{% endif %}
</ol>
</div>
</div>
<div class="section side">
<div class="section__header">
<h1 class="section__title">{{ _('Information') }}</h1>
</div>
<div class="section__body typo">
<dl class="large horizontal">
{% if pdoc['_id']|string|length < 10 %}
5 years ago
<dt>{{ _('ID') }}</dt>
<dd>{{ pdoc['_id'] }}</dd>
5 years ago
{% endif %}
{% if page_name != 'discussion_node' and page_name != 'discussion_detail' %}
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
5 years ago
<dt>{{ _('Submission') }}</dt>
<dd>
{% if pdoc['psdoc']['status'] %}
<span class="icon record-status--icon {{ builtin.STATUS_CODES[pdoc['psdoc']['status']] }}"></span>
<a href="/r/{{ pdoc['psdoc']['rid'] }}" class="record-status--text {{ builtin.STATUS_CODES[pdoc['psdoc']['status']] }}">
{{ builtin.STATUS_TEXTS[pdoc['psdoc']['status']] }}
5 years ago
</a>
{% else %}
{{ _('(None)') }}
{% endif %}
</dd>
{% endif %}
{% endif %}
<dt>{{ _('Difficulty') }}</dt>
<dd>{{ pdoc['difficulty'] or _('(None)') }}</dd>
<dt>{{ _('Category') }}</dt>
<dd>
{% if pdoc['category'] %}
<span class="hasjs--hide" name="problem-sidebar__categories">
{% for category in pdoc['category'] %}
<a href="{{ reverse_url('problem_category', category=category) }}">{{ category }}</a>
{% if loop.index < pdoc['category']|length %}
{% if category in vj4.model.builtin.PROBLEM_CATEGORIES %}
{{ _('problem-category-delim') }}
{% else %}
{{ _('problem-subcategory-delim') }}
{% endif %}
{% endif %}
{% endfor %}
</span>
<span class="nojs--hide">
<a href="javascript:;" name="problem-sidebar__show-category">{{ _('page.problem_detail.sidebar.show_category') }}</a>
</span>
{% else %}
{{ _('(None)') }}
{% endif %}
</dd>
<dt>{{ _('Tags') }}</dt>
<dd>
{{ problem.render_problem_tags(pdoc, true) }}
</dd>
<dt>{{ _('# Submissions') }}</dt>
<dd><a href="/r?pid={{ pdoc['_id'] }}">{{ pdoc.nSubmit }}</a></dd>
5 years ago
{% if page_name != 'discussion_node' and page_name != 'discussion_detail' %}
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
5 years ago
<dt>{{ _('# My Submissions') }}</dt>
<dd><a href="/r?pid={{ pdoc['_id'] }}&uid_or_name={{ handler.user['_id'] }}">{{ pdoc['psdoc'].nSubmit|default(0) }}</a></dd>
5 years ago
{% endif %}
{% endif %}
<dt>{{ _('Accepted') }}</dt>
<dd>{{ pdoc.nAccept }}</dd>
5 years ago
<dt>{{ _('Accepted Ratio') }}</dt>
<dd>{% if pdoc.nSubmit > 0 %}{{ (100 * pdoc.nAccept / pdoc.nSubmit)|round|int }}%{% else %}{{ _('?') }}{% endif %}</dd>
5 years ago
{% if pdoc['num_be_copied'] %}
<dt>{{ _('Be Copied') }}</dt>
<dd>{{ pdoc['num_be_copied'] }}</dd>
{% endif %}
{% if pdoc['owner_uid'] != 0 %}
<dt>{{ _('Uploaded By') }}</dt>
<dd>{{ user.render_inline(owner_udoc, owner_dudoc, badge=false) }}</dd>
{% endif %}
</dl>
</div>
</div>
{% if page_name == 'problem_detail' and (tdocs or ctdocs) %}
<div class="section side">
<div class="section__header">
<h1 class="section__title">{{ _('Related') }}</h1>
</div>
<div class="section__body typo">
{% if tdocs %}
<p>{{ _('In following training plans') }}: </p>
{% for tdoc in tdocs %}
<p><a href="{{ reverse_url('training_detail', tid=tdoc['doc_id']) }}">{{ tdoc['title'] }}</a></p>
{% endfor %}
{% endif %}
{% if ctdocs %}
<p>{{ _('In following contests') }}: </p>
{% for tdoc in ctdocs %}
<p><a href="/c/{{ tdoc._id }}">{{ tdoc['title'] }}</a></p>
5 years ago
{% endfor %}
{% endif %}
{% if htdocs %}
<p>{{ _('In following homework') }}: </p>
{% for tdoc in htdocs %}
<p><a href="{{ reverse_url('homework_detail', tid=tdoc['doc_id']) }}">{{ tdoc['title'] }}</a></p>
{% endfor %}
{% endif %}
</div>
</div>
{% endif %}