template: problem_detail

This commit is contained in:
masnn committed 2020-04-03 22:37:30 +08:00
1 parent 2e23d05a59
commit ffa193b5dd
43 files changed
+265 -242

No files matched your search

+4 -4
View File
@@ -18,7 +18,7 @@
<div>
<ol class="menu">
{% if page_name == 'discussion_node' %}
{% if handler.has_perm(vj4.model.builtin.PERM_CREATE_DISCUSSION) %}
{% if handler.has_perm(perm.PERM_CREATE_DISCUSSION) %}
<li class="menu__item"><a class="menu__link highlight" href="{{ reverse_url('discussion_create_document_as_node', doc_type=tdoc['doc_type'], doc_id=tdoc['doc_id']) }}">
<span class="icon icon-add"></span> {{ _('Create a Discussion') }}
</a></li>
@@ -40,7 +40,7 @@
{% endif %}
{% if not attended and not handler.is_done(tdoc) %}
<li class="menu__item">
{% if handler.has_perm(vj4.model.builtin.PERM_ATTEND_CONTEST) and handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if handler.has_perm(perm.PERM_ATTEND_CONTEST) and handler.has_perm(perm.PERM_LOGGEDIN) %}
<form action="{{ reverse_url('contest_detail', tid=tdoc['doc_id']) }}" method="POST">
<input type="hidden" name="operation" value="attend">
<input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
@@ -68,12 +68,12 @@
<span class="icon icon-statistics"></span> {{ _('Scoreboard (Hidden)') }}
</a></li>
{% endif %}
{% if handler.own(tdoc, vj4.model.builtin.PERM_EDIT_CONTEST_SELF) or handler.has_perm(vj4.model.builtin.PERM_EDIT_CONTEST) %}
{% if handler.own(tdoc, perm.PERM_EDIT_CONTEST_SELF) or handler.has_perm(perm.PERM_EDIT_CONTEST) %}
<li class="menu__item"><a class="menu__link" href="{{ reverse_url('contest_edit', tid=tdoc['doc_id']) }}">
<span class="icon icon-edit"></span> {{ _('Edit Contest') }}
</a></li>
{% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_READ_RECORD_CODE) %}
{% if handler.has_perm(perm.PERM_READ_RECORD_CODE) %}
<li class="menu__item"><a class="menu__link" href="{{ reverse_url('contest_code', tid=tdoc['doc_id']) }}">
<span class="icon icon-download"></span> {{ _('Export All Code') }}
</a></li>
+1 -1
View File
@@ -1,5 +1,5 @@
{% import "components/form.html" as form with context %}
{% if ddoc['highlight'] or handler.has_perm(vj4.model.builtin.PERM_HIGHLIGHT_DISCUSSION) %}
{% if ddoc['highlight'] or handler.has_perm(perm.PERM_HIGHLIGHT_DISCUSSION) %}
{{ form.form_checkbox(label='Highlight', name='highlight', value=ddoc['highlight']|default(false)) }}
{% endif %}
{{ form.form_text(label='Title', name='title', value=ddoc['title']|default(''), autofocus=true, required=true) }}
+3 -3
View File
@@ -24,7 +24,7 @@
{% endif %}
{% if not attended and not handler.is_done(tdoc) %}
<li class="menu__item">
{% if handler.has_perm(vj4.model.builtin.PERM_ATTEND_HOMEWORK) and handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if handler.has_perm(perm.PERM_ATTEND_HOMEWORK) and handler.has_perm(perm.PERM_LOGGEDIN) %}
<form action="{{ reverse_url('homework_detail', tid=tdoc['doc_id']) }}" method="POST">
<input type="hidden" name="operation" value="attend">
<input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
@@ -52,12 +52,12 @@
<span class="icon icon-statistics"></span> {{ _('Scoreboard (Hidden)') }}
</a></li>
{% endif %}
{% if handler.own(tdoc, vj4.model.builtin.PERM_EDIT_HOMEWORK_SELF) or handler.has_perm(vj4.model.builtin.PERM_EDIT_HOMEWORK) %}
{% if handler.own(tdoc, perm.PERM_EDIT_HOMEWORK_SELF) or handler.has_perm(perm.PERM_EDIT_HOMEWORK) %}
<li class="menu__item"><a class="menu__link" href="{{ reverse_url('homework_edit', tid=tdoc['doc_id']) }}">
<span class="icon icon-edit"></span> {{ _('Edit Homework') }}
</a></li>
{% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_READ_RECORD_CODE) %}
{% if handler.has_perm(perm.PERM_READ_RECORD_CODE) %}
<li class="menu__item"><a class="menu__link" href="{{ reverse_url('homework_code', tid=tdoc['doc_id']) }}">
<span class="icon icon-download"></span> {{ _('Export All Code') }}
</a></li>
+4 -4
View File
@@ -2,13 +2,13 @@
<div class="dialog__content">
<div class="dialog--signin__bg">
<div class="dialog--signin__side">
<h1>{{ _('Don\'t have an account?') }}</h1>
<h1>{{ _("Don\'t have an account?") }}</h1>
<p>{{ _('By signing up a Vijos universal account, you can submit code and join discussions in all online judging services provided by us.') }}</p>
<div><a href="{{ reverse_url('user_register') }}" class="inverse rounded button">{{ _('Sign Up Now') }}</a></div>
<div><a href="/register" class="inverse rounded button">{{ _('Sign Up Now') }}</a></div>
</div>
</div>
<div class="dialog--signin__main">
<form action="{{ reverse_url('user_login') }}" method="post">
<form action="/login" method="post">
<div class="dialog--signin__close-container supplementary">
<a name="dialog--signin__close" href="javascript:;">{{ _('CLOSE') }}</a>
</div>
@@ -36,7 +36,7 @@
</div></div>
<div class="row"><div class="columns">
<div class="supplementary text-center">
<a href="{{ reverse_url('user_lostpass') }}">{{ _('Forgot password or username?') }}</a>
<a href="/lostpass">{{ _('Forgot password or username?') }}</a>
</div>
</div></div>
</form>
+19 -35
View File
@@ -1,6 +1,6 @@
{% macro nav_item(target_page_name, target_page_prefix) %}
{% macro nav_item(target_page_url, target_page_name, target_page_prefix) %}
<li class="nav__list-item">
<a href="{{ reverse_url(target_page_name) }}" class="nav__item{% if page_name.startsWith(target_page_prefix) %} nav--active{% endif %}">
<a href="{{ target_page_url }}" class="nav__item{% if page_name.startsWith(target_page_prefix) %} nav--active{% endif %}">
{{ _(target_page_name) }}
</a>
</li>
@@ -9,80 +9,64 @@
<nav class="nav slideout-menu" id="menu">
<div class="row"><div class="columns clearfix">
<ol class="nav__list nav__list--main clearfix">
<li class="nav__list-item"><a href="{{ reverse_url('domain_main', domain_id=vj4.model.builtin.DOMAIN_ID_SYSTEM) }}" class="nav__logo">&nbsp;</a></li>
{{ nav_item('domain_main', 'domain_main') }}
<li class="nav__list-item"><a href="/" class="nav__logo">&nbsp;</a></li>
{{ nav_item('/', 'domain_main', 'domain_main') }}
{% if handler.has_perm(perm.PERM_VIEW_PROBLEM) %}
{{ nav_item('problem_main', 'problem') }}
{{ nav_item('/p', 'problem_main', 'problem') }}
{% endif %}
{% if handler.has_perm(perm.PERM_VIEW_TRAINING) %}
{{ nav_item('training_main', 'training') }}
{{ nav_item('/t', 'training_main', 'training') }}
{% endif %}
{% if handler.has_perm(perm.PERM_VIEW_DISCUSSION) %}
{{ nav_item('discussion_main', 'discussion') }}
{{ nav_item('/d', 'discussion_main', 'discussion') }}
{% endif %}
{% if handler.has_perm(perm.PERM_VIEW_CONTEST) %}
{{ nav_item('contest_main', 'contest') }}
{{ nav_item('/c', 'contest_main', 'contest') }}
{% endif %}
{% if handler.has_perm(perm.PERM_VIEW_HOMEWORK) %}
{{ nav_item('homework_main', 'homework') }}
{{ nav_item('/h', 'homework_main', 'homework') }}
{% endif %}
{% if handler.has_perm(perm.PERM_EDIT_DESCRIPTION) or handler.has_perm(perm.PERM_EDIT_PERM) %}
{{ nav_item('domain_manage', 'domain_manage') }}
{{ nav_item('/d', 'domain_manage', 'domain_manage') }}
{% endif %}
</ol>
<ol class="nav__list nav__list--secondary clearfix">
{% if not handler.has_perm(perm.PERM_LOGGEDIN) %}
<li class="nav__list-item"><a href="{{ reverse_url('user_login') }}" class="nav__item" name="nav_login">{{ _('Login') }}</a></li>
<li class="nav__list-item"><a href="{{ reverse_url('user_register') }}" class="nav__item--round">{{ _('Sign Up') }}</a></li>
<li class="nav__list-item"><a href="/login" class="nav__item" name="nav_login">{{ _('Login') }}</a></li>
<li class="nav__list-item"><a href="/register" class="nav__item--round">{{ _('Sign Up') }}</a></li>
{% else %}
<li class="nav__list-item" data-dropdown-pos="bottom right" data-dropdown-target="#menu-nav-user" data-dropdown-trigger-desktop-only>
<a href="{{ reverse_url('user_detail', uid=handler.user['_id']) }}" class="nav__item">{{ handler.user.uname }} <span class="icon icon-expand_more nojs--hide"></span></a>
<a href="/user/{{ handler.user._id }}" class="nav__item">{{ handler.user.uname }} <span class="icon icon-expand_more nojs--hide"></span></a>
<ol class="dropdown-target menu" id="menu-nav-user">
<li class="menu__item">
<a href="{{ reverse_url('user_detail', uid=handler.user['_id']) }}" class="menu__link">
<a href="/user/{{ handler.user._id }}" class="menu__link">
<span class="icon icon-account--circle"></span> {{ _('My Profile') }}
</a>
</li>
<li class="menu__item">
<a href="{{ reverse_url('home_messages') }}" class="menu__link">
<a href="/home/messages" class="menu__link">
<span class="icon icon-comment--multiple"></span> {{ _('home_messages') }}
</a>
</li>
<li class="menu__seperator"></li>
<li class="menu__item">
<a href="{{ reverse_url('home_account') }}" class="menu__link">
<a href="/home/account" class="menu__link">
<span class="icon icon-wrench"></span> {{ _('home_account') }}
</a>
</li>
<li class="menu__item">
<a href="{{ reverse_url('home_domain_account') }}" class="menu__link">
<span class="icon icon-web"></span> @ {{ handler.domain['name'] }}
</a>
</li>
<li class="menu__item">
<a href="{{ reverse_url('home_preference') }}" class="menu__link">
<a href="/home/preference" class="menu__link">
<span class="icon icon-sliders"></span> {{ _('home_preference') }}
</a>
</li>
<li class="menu__item">
<a href="{{ reverse_url('home_security') }}" class="menu__link">
<a href="/home/security" class="menu__link">
<span class="icon icon-security"></span> {{ _('home_security') }}
</a>
</li>
<li class="menu__seperator"></li>
<li class="menu__item">
<a href="{{ reverse_url('home_file') }}" class="menu__link">
<span class="icon icon-file"></span> {{ _('My Files') }}
</a>
</li>
<li class="menu__item">
<a href="{{ reverse_url('home_domain') }}" class="menu__link">
<span class="icon icon-web"></span> {{ _('My Domains') }}
</a>
</li>
<li class="menu__seperator"></li>
<li class="menu__item">
<a href="{{ reverse_url('user_logout') }}" class="menu__link" name="nav_logout">
<a href="/logout" class="menu__link" name="nav_logout">
<span class="icon icon-logout"></span> {{ _('Logout') }}
</a>
</li>
+6 -6
View File
@@ -1,14 +1,14 @@
{% if tdoc %}
{% if tdoc['doc_type'] == vj4.model.document.TYPE_CONTEST %}
{% include "partials/problem_sidebar_contest.html" %}
{% with owner_udoc=udoc, owner_dudoc=dudoc %}
{% include "partials/contest_sidebar.html" %}
{% endwith %}
{% set owner_udoc=udoc %}
{% set owner_dudoc=dudoc %}
{% include "partials/contest_sidebar.html" %}
{% else %}
{% include "partials/problem_sidebar_homework.html" %}
{% with owner_udoc=udoc, owner_dudoc=dudoc %}
{% include "partials/homework_sidebar.html" %}
{% endwith %}
{% set owner_udoc=udoc %}
{% set owner_dudoc=dudoc %}
{% include "partials/homework_sidebar.html" %}
{% endif %}
{% else %}
{% include "partials/problem_sidebar_normal.html" %}
@@ -24,11 +24,11 @@
<span class="icon icon-send"></span> {{ _('Submit') }}
</a></li>
{% elif handler.is_done(tdoc) %}
<li class="menu__item scratchpad--hide"><a class="menu__link" href="{{ reverse_url('problem_detail', pid=pdoc['_id']) }}">
<li class="menu__item scratchpad--hide"><a class="menu__link" href="/p/{{ pdoc.pid }}">
<span class="icon icon-send"></span> {{ _('Open in Problem Set') }}
</a></li>
{% endif %}
{% if handler.own(pdoc, vj4.model.builtin.PERM_EDIT_PROBLEM_SELF) or handler.has_perm(vj4.model.builtin.PERM_EDIT_PROBLEM) %}
{% if handler.own(pdoc, perm.PERM_EDIT_PROBLEM_SELF) or handler.has_perm(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="{{ reverse_url('problem_edit', pid=pdoc['_id']) }}">
<span class="icon icon-edit"></span> {{ _('Edit') }}
@@ -24,11 +24,11 @@
<span class="icon icon-send"></span> {{ _('Submit') }}
</a></li>
{% elif handler.is_done(tdoc) %}
<li class="menu__item scratchpad--hide"><a class="menu__link" href="{{ reverse_url('problem_detail', pid=pdoc['_id']) }}">
<li class="menu__item scratchpad--hide"><a class="menu__link" href="/p/{{ pdoc.pid }}">
<span class="icon icon-send"></span> {{ _('Open in Problem Set') }}
</a></li>
{% endif %}
{% if handler.own(pdoc, vj4.model.builtin.PERM_EDIT_PROBLEM_SELF) or handler.has_perm(vj4.model.builtin.PERM_EDIT_PROBLEM) %}
{% if handler.own(pdoc, perm.PERM_EDIT_PROBLEM_SELF) or handler.has_perm(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="{{ reverse_url('problem_edit', pid=pdoc['_id']) }}">
<span class="icon icon-edit"></span> {{ _('Edit') }}
@@ -9,7 +9,7 @@
<div>
<ol class="menu">
{% if page_name == 'discussion_node' or page_name == 'discussion_detail' %}
{% if handler.has_perm(vj4.model.builtin.PERM_CREATE_DISCUSSION) %}
{% if handler.has_perm(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']) }}">
<span class="icon icon-add"></span> {{ _('Create a Discussion') }}
</a></li>
@@ -25,7 +25,7 @@
<li class="menu__seperator"></li>
{% endif %}
{% if page_name == 'problem_detail' %}
{% if handler.has_perm(vj4.model.builtin.PERM_SUBMIT_PROBLEM) %}
{% if handler.has_perm(perm.PERM_SUBMIT_PROBLEM) %}
<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>
@@ -34,11 +34,11 @@
</a></li>
{% endif %}
{% else %}
<li class="menu__item"><a class="menu__link" href="{{ reverse_url('problem_detail', pid=pdoc['_id']) }}">
<li class="menu__item"><a class="menu__link" href="/p/{{ pdoc.pid }}">
<span class="icon icon-flag"></span> {{ _('View Problem') }}
</a></li>
{% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_SUBMIT_PROBLEM) %}
{% if handler.has_perm(perm.PERM_SUBMIT_PROBLEM) %}
<li class="menu__item scratchpad--hide"><a class="menu__link{% if page_name == 'problem_submit' %} active{% endif %}" href="{{ reverse_url('problem_submit', pid=pdoc['_id']) }}">
<span class="icon icon-send"></span> {{ _('Submit') }}
</a></li>
@@ -51,15 +51,15 @@
<span class="icon icon-send"></span> {{ _('No Permission to Submit') }}
</a></li>
{% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_VIEW_DISCUSSION) or handler.has_perm(vj4.model.builtin.PERM_VIEW_PROBLEM_SOLUTION) %}
{% if handler.has_perm(perm.PERM_VIEW_DISCUSSION) or handler.has_perm(perm.PERM_VIEW_PROBLEM_SOLUTION) %}
<li class="menu__seperator"></li>
{% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_VIEW_DISCUSSION) %}
{% if handler.has_perm(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']) }}">
<span class="icon icon-comment--text"></span> {{ _('Discussions') }}
</a></li>
{% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_VIEW_PROBLEM_SOLUTION) %}
{% if handler.has_perm(perm.PERM_VIEW_PROBLEM_SOLUTION) %}
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_solution' %} active{% endif %}" href="{{ reverse_url('problem_solution', pid=pdoc['_id']) }}">
<span class="icon icon-comment--text"></span> {{ _('Solutions') }}
</a></li>
@@ -70,7 +70,7 @@
<span class="icon icon-copy"></span> {{ _('Copy Problem') }}
</a></li>
{% endif %}
{% if handler.own(pdoc, vj4.model.builtin.PERM_EDIT_PROBLEM_SELF) or handler.has_perm(vj4.model.builtin.PERM_EDIT_PROBLEM) %}
{% if handler.user._id == pdoc.owner or handler.has_perm(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="{{ reverse_url('problem_edit', pid=pdoc['_id']) }}">
<span class="icon icon-edit"></span> {{ _('Edit') }}