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

165 lines
7.8 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' %}
4 years ago
{% if handler.user.hasPerm(perm.PERM_CREATE_DISCUSSION) %}
<li class="menu__item"><a class="menu__link highlight" href="{{ url('discussion_create', type='problem', name=pdoc.docId) }}">
5 years ago
<span class="icon icon-add"></span> {{ _('Create a Discussion') }}
</a></li>
{% else %}
4 years ago
{% if not handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
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' %}
4 years ago
{% if handler.user.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="{{ url('problem_detail', pid=pdoc.pid) }}">
5 years ago
<span class="icon icon-flag"></span> {{ _('View Problem') }}
</a></li>
{% endif %}
4 years ago
{% if handler.user.hasPerm(perm.PERM_SUBMIT_PROBLEM) %}
<li class="menu__item scratchpad--hide"><a class="menu__link{% if page_name == 'problem_submit' %} active{% endif %}" href="{{ url('problem_submit', pid=pdoc.pid) }}">
5 years ago
<span class="icon icon-send"></span> {{ _('Submit') }}
</a></li>
4 years ago
{% elif not handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
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 %}
4 years ago
{% if handler.user.hasPerm(perm.PERM_VIEW_DISCUSSION) or handler.user.hasPerm(perm.PERM_VIEW_PROBLEM_SOLUTION) %}
5 years ago
<li class="menu__seperator"></li>
{% endif %}
4 years ago
{% if handler.user.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="{{ url('discussion_node', type='problem', name=pdoc.docId) }}">
5 years ago
<span class="icon icon-comment--text"></span> {{ _('Discussions') }}
</a></li>
{% endif %}
4 years ago
{% if handler.user.hasPerm(perm.PERM_VIEW_PROBLEM_SOLUTION) %}
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_solution' %} active{% endif %}" href="{{ url('problem_solution', pid=pdoc.pid) }}">
5 years ago
<span class="icon icon-comment--text"></span> {{ _('Solutions') }}
</a></li>
{% endif %}
4 years ago
{% if user._id == pdoc.owner or handler.user.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="{{ url('problem_edit', pid=pdoc.pid) }}">
5 years ago
<span class="icon icon-edit"></span> {{ _('Edit') }}
5 years ago
</a></li>
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_settings' %} active{% endif %}" href="{{ url('problem_settings', pid=pdoc.pid) }}">
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">
<dt>{{ _('ID') }}</dt>
<dd>{{ pdoc.docId }}</dd>
5 years ago
{% if page_name != 'discussion_node' and page_name != 'discussion_detail' %}
4 years ago
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
5 years ago
<dt>{{ _('Submission') }}</dt>
<dd>
{% if pdoc.psdoc.status %}
<span class="icon record-status--icon {{ model.builtin.STATUS_CODES[pdoc['psdoc']['status']] }}"></span>
<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']] }}
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="{{ url('problem_category', category=category) }}">{{ category }}</a>
5 years ago
{% if loop.index < pdoc['category']|length %}
{{ _('problem-subcategory-delim') }}
5 years ago
{% 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="{{ url('record_main', query={pid:pdoc.docId}) }}">{{ pdoc.nSubmit }}</a></dd>
5 years ago
{% if page_name != 'discussion_node' and page_name != 'discussion_detail' %}
4 years ago
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
5 years ago
<dt>{{ _('# My Submissions') }}</dt>
<dd><a href="{{ url('record_main', query={pid:pdoc.docId, uidOrName: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
<dt>{{ _('Uploaded By') }}</dt>
<dd>{{ user.render_inline(owner_udoc, badge=false) }}</dd>
5 years ago
</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="{{ url('training_detail', tid=tdoc.docId) }}">{{ tdoc.title }}</a></p>
5 years ago
{% endfor %}
{% endif %}
{% if ctdocs %}
<p>{{ _('In following contests') }}: </p>
{% for tdoc in ctdocs %}
<p><a href="{{ url('contest_detail', tid=tdoc.docId) }}">{{ tdoc.title }}</a></p>
5 years ago
{% endfor %}
{% endif %}
</div>
</div>
{% endif %}