template: problem_list

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

No files matched your search

+2 -2
View File
@@ -1,8 +1,8 @@
{% extends "layout/mail.html" %} {% extends "layout/mail.html" %}
{% block title %}{{ _('P{0} - {1} Accepted!').format(pdoc['doc_id'], pdoc['title']) }}{% endblock %} {% block title %}{{ _('P{0} - {1} Accepted!').format(pdoc['_id'], pdoc['title']) }}{% endblock %}
{% block content %} {% block content %}
<p>{{ _('Congratulations! Your submission is accepted.') }}</p> <p>{{ _('Congratulations! Your submission is accepted.') }}</p>
<p>{{ _('Problem') }}: <a href="{{ url_prefix }}{{ reverse_url('problem_detail', domain_id=pdoc['domain_id'], pid=pdoc['doc_id']) }}">P{{ pdoc['doc_id'] }} {{ pdoc['title'] }}</a></p> <p>{{ _('Problem') }}: <a href="{{ url_prefix }}{{ reverse_url('problem_detail', domain_id=pdoc['domain_id'], pid=pdoc['_id']) }}">P{{ pdoc['_id'] }} {{ pdoc['title'] }}</a></p>
<p>{{ _('Code') }}:</p> <p>{{ _('Code') }}:</p>
<pre> <pre>
{{ rdoc['code'] }} {{ rdoc['code'] }}
+11 -6
View File
@@ -14,15 +14,20 @@
</style> </style>
</head> </head>
<body> <body>
<div class="code-content" style="text-align: center"><pre style="font-size: 18px; line-height: 125%; display: inline-block; text-align: left; white-space: pre-wrap; word-wrap: break-word;"><span style="color: #75715e">#include &lt;string.h&gt;</span> <div class="code-content" style="text-align: center">
<pre style="font-size: 18px; line-height: 125%; display: inline-block; text-align: left; white-space: pre-wrap; word-wrap: break-word;">
<span style="color: #75715e">#include &lt;string.h&gt;</span>
<span style="color: #66d9ef">int</span> <span style="color: #a6e22e">main</span><span style="color: #f8f8f2">()</span> <span style="color: #f8f8f2">{</span> <span style="color: #66d9ef">int</span> <span style="color: #a6e22e">main</span><span style="color: #f8f8f2">()</span> <span style="color: #f8f8f2">{</span>
<span style="color: #66d9ef">char</span> <span style="color: #f8f8f2">answer[</span><span style="color: #ae81ff">42</span><span style="color: #f8f8f2">];</span> <span style="color: #66d9ef">char</span> <span style="color: #f8f8f2">answer[</span><span style="color: #ae81ff">42</span><span style="color: #f8f8f2">];</span>
<span style="color: #f8f8f2">strcpy(answer,</span> <span style="color: #e6db74">&quot;twd2 will tell you the answer to life the universe and everything,&quot;</span><span style="color: #f8f8f2">);</span> <span style="color: #f8f8f2">strcpy(answer,</span> <span style="color: #e6db74">&quot;masnn will tell you the answer to life the universe and everything,&quot;</span><span style="color: #f8f8f2">);</span>
<span style="color: #f8f8f2">strcpy(answer,</span> <span style="color: #e6db74">&quot;but first of all, he is very sorry that Vijos meets some issues now.&quot;</span><span style="color: #f8f8f2">);</span> <span style="color: #f8f8f2">strcpy(answer,</span> <span style="color: #e6db74">&quot;but first of all, she is very sorry that Hydro meets some issues now.&quot;</span><span style="color: #f8f8f2">);</span>
<span style="color: #f8f8f2">strcpy(answer,</span> <span style="color: #e6db74">&quot;please <a href="javascript:window.location.reload()" style="color: #e6db74" title="Try again">wait patiently</a>, or <a style="color: #e6db74" href="mailto:twd2@163.com">contact twd2</a> impatiently about this error.&quot;</span><span style="color: #f8f8f2">);</span> <span style="color: #f8f8f2">strcpy(answer,</span> <span style="color: #e6db74">&quot;please <a href="javascript:window.location.reload()" style="color: #e6db74" title="Try again">wait patiently</a>, or <a style="color: #e6db74" href="mailto:masnn0@outlook.com">contact masnn</a> impatiently about this error.&quot;</span><span style="color: #f8f8f2">);</span>
<span style="color: #66d9ef">return</span> <span style="color: #ae81ff">0</span><span style="color: #f8f8f2">;</span> <span style="color: #66d9ef">return</span> <span style="color: #ae81ff">0</span><span style="color: #f8f8f2">;</span>
<span style="color: #f8f8f2">}</span> <span style="color: #f8f8f2">}</span>
</pre></div> <span style="color: #75715e">/*</span>
<span style="color: #75715e">{{error.stack}}</span>
<span style="color: #75715e">*/</span>
</pre>
</div>
</body> </body>
</html> </html>
+64 -64
View File
@@ -1,12 +1,12 @@
{% macro form_begin() %} {% macro form_begin(args) %}
{% set label = kwargs.pop('label') %} {% set label = args.pop('label') %}
{% set columns = kwargs.pop('columns') %} {% set columns = args.pop('columns') %}
{% set last_column = kwargs.pop('last_column', true) %} {% set last_column = args.pop('last_column', true) %}
{% set required = kwargs.pop('required', false) %} {% set required = args.pop('required', false) %}
{% set hotkeys = kwargs.pop('hotkeys', none) %} {% set hotkeys = args.pop('hotkeys', none) %}
{% set row = kwargs.pop('row', true) %} {% set row = args.pop('row', true) %}
{% set no_label = kwargs.pop('no_label', false) %} {% set no_label = args.pop('no_label', false) %}
{% set label_wrap = kwargs.pop('label_wrap', true) %} {% set label_wrap = args.pop('label_wrap', true) %}
{% if row %} {% if row %}
<div class="row"> <div class="row">
{% endif %} {% endif %}
@@ -26,11 +26,11 @@
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
{% macro form_end() %} {% macro form_end(args) %}
{% set help_text = kwargs.pop('help_text', none) %} {% set help_text = args.pop('help_text', none) %}
{% set row = kwargs.pop('row', true) %} {% set row = args.pop('row', true) %}
{% set no_label = kwargs.pop('no_label', false) %} {% set no_label = args.pop('no_label', false) %}
{% set label_wrap = kwargs.pop('label_wrap', true) %} {% set label_wrap = args.pop('label_wrap', true) %}
{% if not no_label and label_wrap %} {% if not no_label and label_wrap %}
</label> </label>
{% endif %} {% endif %}
@@ -43,12 +43,12 @@
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
{% macro form_attr(form_class) %} {% macro form_attr(form_class, args) %}
{% set disabled = kwargs.pop('disabled', false) %} {% set disabled = args.pop('disabled', false) %}
{% set required = kwargs.pop('required', false) %} {% set required = args.pop('required', false) %}
{% set autofocus = kwargs.pop('autofocus', false) %} {% set autofocus = args.pop('autofocus', false) %}
{% set date = kwargs.pop('date', false) %} {% set date = args.pop('date', false) %}
{% set time = kwargs.pop('time', false) %} {% set time = args.pop('time', false) %}
class="{{ form_class }}{% if extra_class %} {{ extra_class }}{% endif %}" class="{{ form_class }}{% if extra_class %} {{ extra_class }}{% endif %}"
{% if disabled %}disabled{% endif %} {% if disabled %}disabled{% endif %}
{% if required %}required{% endif %} {% if required %}required{% endif %}
@@ -57,19 +57,19 @@
{% if time %}data-pick-time{% endif %} {% if time %}data-pick-time{% endif %}
{% endmacro %} {% endmacro %}
{% macro container_attr(container_class) %} {% macro container_attr(container_class, args) %}
{% set extra_class = kwargs.pop('extra_class', none) %} {% set extra_class = args.pop('extra_class', none) %}
class="{{ container_class }}{% if extra_class %} {{ extra_class }}{% endif %}" class="{{ container_class }}{% if extra_class %} {{ extra_class }}{% endif %}"
{% endmacro %} {% endmacro %}
{% macro select(options, name='', value='') %} {% macro select(options, name='', value='', args) %}
<div <div
name="form_item_{{ name }}" name="form_item_{{ name }}"
{{ container_attr('select-container', **kwargs) }} {{ container_attr('select-container', args) }}
> >
<select <select
name="{{ name }}" name="{{ name }}"
{{ form_attr('select', **kwargs) }} {{ form_attr('select', args) }}
> >
{% for k, v in options %} {% for k, v in options %}
<option value="{{ k }}"{% if value == k %} selected{% endif %}> <option value="{{ k }}"{% if value == k %} selected{% endif %}>
@@ -80,16 +80,16 @@
</div> </div>
{% endmacro %} {% endmacro %}
{% macro form_select(columns=5) %} {% macro form_select(columns=5, args) %}
{{ form_begin(columns=columns, **kwargs) }} {{ form_begin({columns:columns}|assign(args)) }}
{{ select(columns=columns, **kwargs) }} {{ select({columns:columns}|assign(args)) }}
{{ form_end(columns=columns, **kwargs) }} {{ form_end({columns:columns}|assign(args)) }}
{% endmacro %} {% endmacro %}
{% macro radio(options, name='', value='') %} {% macro radio(options, name='', value='', args) %}
<div <div
name="form_item_{{ name }}" name="form_item_{{ name }}"
{{ container_attr('radiobox-container', **kwargs) }} {{ container_attr('radiobox-container', args) }}
> >
{% for k, v in options %} {% for k, v in options %}
<label class="radiobox"> <label class="radiobox">
@@ -97,7 +97,7 @@
value="{{ k }}" value="{{ k }}"
type="radio" type="radio"
name="{{ name }}" name="{{ name }}"
{{ form_attr('radiobox__input', **kwargs) }} {{ form_attr('radiobox__input', args) }}
{% if value == k %} checked{% endif %} {% if value == k %} checked{% endif %}
/> {{ _(v) }} /> {{ _(v) }}
</label> </label>
@@ -105,16 +105,16 @@
</div> </div>
{% endmacro %} {% endmacro %}
{% macro form_radio(columns=5) %} {% macro form_radio(columns=5, args) %}
{{ form_begin(columns=columns, label_wrap=false, **kwargs) }} {{ form_begin({columns:columns, label_wrap:false}|assign(args)) }}
{{ radio(columns=columns, **kwargs) }} {{ radio({columns:columns}|assign(args)) }}
{{ form_end(columns=columns, label_wrap=false, **kwargs) }} {{ form_end({columns:columns, label_warp:false}|assign(args)) }}
{% endmacro %} {% endmacro %}
{% macro image_radio(options, name='', value='', image_class='') %} {% macro image_radio(options, name='', value='', image_class='', args) %}
<div <div
name="form_item_{{ name }}" name="form_item_{{ name }}"
{{ container_attr('radiobox-container with-image', **kwargs) }} {{ container_attr('radiobox-container with-image', args) }}
> >
{% for k, v in options %} {% for k, v in options %}
<label class="radiobox with-image"> <label class="radiobox with-image">
@@ -122,7 +122,7 @@
value="{{ k }}" value="{{ k }}"
type="radio" type="radio"
name="{{ name }}" name="{{ name }}"
{{ form_attr('radiobox__input', **kwargs) }} {{ form_attr('radiobox__input', args) }}
{% if value == k %} checked{% endif %} {% if value == k %} checked{% endif %}
/> />
<div class="radiobox__image-container" data-tooltip="{{ _(v) }}"> <div class="radiobox__image-container" data-tooltip="{{ _(v) }}">
@@ -133,69 +133,69 @@
</div> </div>
{% endmacro %} {% endmacro %}
{% macro form_image_radio(columns=8) %} {% macro form_image_radio(columns=8, args) %}
{{ form_begin(columns=columns, label_wrap=false, **kwargs) }} {{ form_begin({columns:columns, label_warp:false}|assign(args)) }}
{{ image_radio(columns=columns, **kwargs) }} {{ image_radio({columns:columns}|assign(args)) }}
{{ form_end(columns=columns, label_wrap=false, **kwargs) }} {{ form_end({columns:columns, label_warp:false}|assign(args)) }}
{% endmacro %} {% endmacro %}
{% macro text(name='', value='', placeholder='', type='text') %} {% macro text(name='', value='', placeholder='', type='text', args) %}
<div <div
name="form_item_{{ name }}" name="form_item_{{ name }}"
{{ container_attr('textbox-container', **kwargs) }} {{ container_attr('textbox-container', args) }}
> >
<input <input
type="{{ type }}" type="{{ type }}"
name="{{ name }}" name="{{ name }}"
value="{{ value }}" value="{{ value }}"
placeholder="{{ placeholder }}" placeholder="{{ placeholder }}"
{{ form_attr('textbox', **kwargs) }} {{ form_attr('textbox', args) }}
> >
</div> </div>
{% endmacro %} {% endmacro %}
{% macro form_text(columns=5) %} {% macro form_text(columns=5, args) %}
{{ form_begin(columns=columns, **kwargs) }} {{ form_begin({columns:columns}|assign(args)) }}
{{ text(columns=columns, **kwargs) }} {{ text({columns:columns}|assign(args)) }}
{{ form_end(columns=columns, **kwargs) }} {{ form_end({columns:columns}|assign(args)) }}
{% endmacro %} {% endmacro %}
{% macro textarea(name='', value='', placeholder='') %} {% macro textarea(name='', value='', placeholder='', args) %}
{% set markdown = kwargs.pop('markdown', false) %} {% set markdown = args.pop('markdown', false) %}
<div <div
name="form_item_{{ name }}" name="form_item_{{ name }}"
{{ container_attr('textarea-container', **kwargs) }} {{ container_attr('textarea-container', args) }}
> >
<textarea <textarea
name="{{ name }}" name="{{ name }}"
placeholder="{{ placeholder }}" placeholder="{{ placeholder }}"
{% if markdown %}data-markdown{% endif %} {% if markdown %}data-markdown{% endif %}
{{ form_attr('textbox', **kwargs) }} {{ form_attr('textbox', args) }}
>{{ value }}</textarea> >{{ value }}</textarea>
</div> </div>
{% endmacro %} {% endmacro %}
{% macro form_textarea(columns=8) %} {% macro form_textarea(columns=8) %}
{{ form_begin(columns=columns, **kwargs) }} {{ form_begin({columns:columns}|assign(args)) }}
{{ textarea(columns=columns, **kwargs) }} {{ textarea({columns:columns}|assign(args)) }}
{{ form_end(columns=columns, **kwargs) }} {{ form_end({columns:columns}|assign(args)) }}
{% endmacro %} {% endmacro %}
{% macro checkbox(label='', name='', value=false) %} {% macro checkbox(label='', name='', value=false, args) %}
<div <div
name="form_item_{{ name }}" name="form_item_{{ name }}"
{{ container_attr('checkbox-container', **kwargs) }} {{ container_attr('checkbox-container', args) }}
> >
<label class="checkbox"> <label class="checkbox">
<input type="checkbox" name="{{ name }}"{% if value %} checked{% endif %} <input type="checkbox" name="{{ name }}"{% if value %} checked{% endif %}
{{ form_attr('checkbox', **kwargs) }} {{ form_attr('checkbox', args) }}
>{{ _(label) }} >{{ _(label) }}
</label> </label>
</div> </div>
{% endmacro %} {% endmacro %}
{% macro form_checkbox(columns=5) %} {% macro form_checkbox(columns=5, args) %}
{{ form_begin(columns=columns, no_label=True, **kwargs) }} {{ form_begin({columns:columns, no_label:true}|assign(args)) }}
{{ checkbox(columns=columns, **kwargs) }} {{ checkbox({columns:columns}|assign(args)) }}
{{ form_end(columns=columns, no_label=True, **kwargs) }} {{ form_end({columns:columns, no_label:true}|assign(args)) }}
{% endmacro %} {% endmacro %}
+4 -4
View File
@@ -2,15 +2,15 @@
{%- if not invalid %} {%- if not invalid %}
<a <a
{%- if tdoc is none %} {%- if tdoc is none %}
href="{{ reverse_url('problem_detail', domain_id=pdoc['domain_id'], pid=pdoc['doc_id']) }}" href="{{ reverse_url('problem_detail', domain_id=pdoc['domain_id'], pid=pdoc['_id']) }}"
{%- elif tdoc['doc_type'] == vj4.model.document.TYPE_CONTEST %} {%- elif tdoc['doc_type'] == vj4.model.document.TYPE_CONTEST %}
href="{{ reverse_url('contest_detail_problem', domain_id=pdoc['domain_id'], pid=pdoc['doc_id'], tid=tdoc['doc_id']) }}" href="{{ reverse_url('contest_detail_problem', domain_id=pdoc['domain_id'], pid=pdoc['_id'], tid=tdoc['doc_id']) }}"
{%- elif tdoc['doc_type'] == vj4.model.document.TYPE_HOMEWORK %} {%- elif tdoc['doc_type'] == vj4.model.document.TYPE_HOMEWORK %}
href="{{ reverse_url('homework_detail_problem', domain_id=pdoc['domain_id'], pid=pdoc['doc_id'], tid=tdoc['doc_id']) }}" href="{{ reverse_url('homework_detail_problem', domain_id=pdoc['domain_id'], pid=pdoc['_id'], tid=tdoc['doc_id']) }}"
{%- endif %} {%- endif %}
> >
{%- endif %} {%- endif %}
{% if pdoc['doc_id']|string|length < 10 %}P{{ pdoc['doc_id'] }} {% endif %}{{ pdoc['title'] }} {% if pdoc['_id']|string|length < 10 %}P{{ pdoc['_id'] }} {% endif %}{{ pdoc['title'] }}
{%- if not invalid %} {%- if not invalid %}
</a> </a>
{%- endif %} {%- endif %}
+1 -1
View File
@@ -1,6 +1,6 @@
{% macro render_item(icon_name, page_name, label=none) %} {% macro render_item(icon_name, page_name, label=none) %}
<li class="menu__item" id="menu-item-{{ page_name }}"> <li class="menu__item" id="menu-item-{{ page_name }}">
{% set target_url = reverse_url(page_name, **kwargs) %} {% set target_url = reverse_url(page_name, args) %}
<a href="{{ target_url }}" class="menu__link{% if handler.request.path_qs == target_url %} active{% endif %}"> <a href="{{ target_url }}" class="menu__link{% if handler.request.path_qs == target_url %} active{% endif %}">
{% if icon_name %} {% if icon_name %}
<span class="icon icon-{{ icon_name }}"></span> <span class="icon icon-{{ icon_name }}"></span>
+3 -3
View File
@@ -24,7 +24,7 @@
<div class="section__body no-padding"> <div class="section__body no-padding">
<table class="data-table"> <table class="data-table">
<colgroup> <colgroup>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% if handler.has_perm(perm.PERM_LOGGEDIN) %}
<col class="col--status"> <col class="col--status">
<col class="col--submit-at"> <col class="col--submit-at">
{% endif %} {% endif %}
@@ -32,7 +32,7 @@
</colgroup> </colgroup>
<thead> <thead>
<tr> <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> <th class="col--status record-status--border">{{ _('Status') }}</th>
<th class="col--submit-at">{{ _('Last Submit At') }}</th> <th class="col--submit-at">{{ _('Last Submit At') }}</th>
{% endif %} {% endif %}
@@ -42,7 +42,7 @@
<tbody> <tbody>
{% for pid in tdoc['pids'] %} {% for pid in tdoc['pids'] %}
<tr> <tr>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if psdict[pid] and psdict[pid]['rid'] %} {% if psdict[pid] and psdict[pid]['rid'] %}
{% with rdoc=rdict[psdict[pid]['rid']] %} {% with rdoc=rdict[psdict[pid]['rid']] %}
{% if handler.can_show_record(tdoc) %} {% if handler.can_show_record(tdoc) %}
+1 -1
View File
@@ -37,7 +37,7 @@
<li> <li>
{{ _('{0} views').format(ddoc['views']) }} {{ _('{0} views').format(ddoc['views']) }}
</li> </li>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% if handler.has_perm(perm.PERM_LOGGEDIN) %}
<li><form class="form--inline" method="post"> <li><form class="form--inline" method="post">
<input type="hidden" name="operation" value="{% if not dsdoc['star'] %}star{% else %}unstar{% endif %}"> <input type="hidden" name="operation" value="{% if not dsdoc['star'] %}star{% else %}unstar{% endif %}">
<input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}"> <input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
+1 -1
View File
@@ -26,7 +26,7 @@
{% if handler.has_perm(vj4.model.builtin.PERM_CREATE_DISCUSSION) %} {% if handler.has_perm(vj4.model.builtin.PERM_CREATE_DISCUSSION) %}
<p><a href="{{ reverse_url('discussion_create', doc_id=vnode['doc_id']) }}" class="expanded primary button">{{ _('Create a Discussion') }}</a></p> <p><a href="{{ reverse_url('discussion_create', doc_id=vnode['doc_id']) }}" class="expanded primary button">{{ _('Create a Discussion') }}</a></p>
{% else %} {% else %}
{% if not handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% if not handler.has_perm(perm.PERM_LOGGEDIN) %}
<p><a href="javascript:showSignInDialog();" class="expanded primary button">{{ _('Login to Create a Discussion') }}</a></p> <p><a href="javascript:showSignInDialog();" class="expanded primary button">{{ _('Login to Create a Discussion') }}</a></p>
{% else %} {% else %}
<p><a href="javascript:;" class="disabled expanded primary button">{{ _('No Permission to Create a Discussion') }}</a></p> <p><a href="javascript:;" class="disabled expanded primary button">{{ _('No Permission to Create a Discussion') }}</a></p>
+1 -1
View File
@@ -139,7 +139,7 @@
<span class="icon training-status--icon done"></span> <span class="icon training-status--icon done"></span>
<span class="training-status--text done">{{ _('Completed') }} 100%</span> <span class="training-status--text done">{{ _('Completed') }} 100%</span>
{% endif %} {% endif %}
{% elif handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% elif handler.has_perm(perm.PERM_LOGGEDIN) %}
<span class="icon training-status--icon outside"></span> <span class="training-status--text outside">{{ _('Not Enrolled') }}</span> <span class="icon training-status--icon outside"></span> <span class="training-status--text outside">{{ _('Not Enrolled') }}</span>
{% endif %} {% endif %}
</li> </li>
+2 -2
View File
@@ -7,9 +7,9 @@
</div> </div>
<div class="error__text-container"> <div class="error__text-container">
<h1>{{ _('Oops!') }}</h1> <h1>{{ _('Oops!') }}</h1>
<p>{{ _(error.message).format(*error.args) }}</p> <p>{{ _(error.message).format(error.args) }}</p>
<p>{{ _('Technical Information') }}:</p> <p>{{ _('Technical Information') }}:</p>
<p>{{ _('Type') }}: {{ error.__class__.__name__ }}</p> <p>{{ _('Type') }}: {{ error.code }}</p>
<p>{{ _('Arguments') }}: <p>{{ _('Arguments') }}:
<ol> <ol>
{% for arg in error.args %} {% for arg in error.args %}
+3 -3
View File
@@ -23,7 +23,7 @@
<div class="section__body no-padding"> <div class="section__body no-padding">
<table class="data-table"> <table class="data-table">
<colgroup> <colgroup>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% if handler.has_perm(perm.PERM_LOGGEDIN) %}
<col class="col--status"> <col class="col--status">
<col class="col--submit-at"> <col class="col--submit-at">
{% endif %} {% endif %}
@@ -31,7 +31,7 @@
</colgroup> </colgroup>
<thead> <thead>
<tr> <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> <th class="col--status record-status--border">{{ _('Status') }}</th>
<th class="col--submit-at">{{ _('Last Submit At') }}</th> <th class="col--submit-at">{{ _('Last Submit At') }}</th>
{% endif %} {% endif %}
@@ -41,7 +41,7 @@
<tbody> <tbody>
{% for pid in tdoc['pids'] %} {% for pid in tdoc['pids'] %}
<tr> <tr>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if psdict[pid] and psdict[pid]['rid'] %} {% if psdict[pid] and psdict[pid]['rid'] %}
{% with rdoc=rdict[psdict[pid]['rid']] %} {% with rdoc=rdict[psdict[pid]['rid']] %}
{% if handler.can_show_record(tdoc) %} {% if handler.can_show_record(tdoc) %}
+3 -3
View File
@@ -23,7 +23,7 @@
<span class="icon icon-add"></span> {{ _('Create a Discussion') }} <span class="icon icon-add"></span> {{ _('Create a Discussion') }}
</a></li> </a></li>
{% else %} {% else %}
{% if not handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% if not handler.has_perm(perm.PERM_LOGGEDIN) %}
<li class="menu__item"><a class="menu__link" href="javascript:showSignInDialog();"> <li class="menu__item"><a class="menu__link" href="javascript:showSignInDialog();">
<span class="icon icon-add"></span> {{ _('Login to Create a Discussion') }}</a></li> <span class="icon icon-add"></span> {{ _('Login to Create a Discussion') }}</a></li>
{% else %} {% else %}
@@ -40,7 +40,7 @@
{% endif %} {% endif %}
{% if not attended and not handler.is_done(tdoc) %} {% if not attended and not handler.is_done(tdoc) %}
<li class="menu__item"> <li class="menu__item">
{% if handler.has_perm(vj4.model.builtin.PERM_ATTEND_CONTEST) and handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% if handler.has_perm(vj4.model.builtin.PERM_ATTEND_CONTEST) and handler.has_perm(perm.PERM_LOGGEDIN) %}
<form action="{{ reverse_url('contest_detail', tid=tdoc['doc_id']) }}" method="POST"> <form action="{{ reverse_url('contest_detail', tid=tdoc['doc_id']) }}" method="POST">
<input type="hidden" name="operation" value="attend"> <input type="hidden" name="operation" value="attend">
<input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}"> <input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
@@ -48,7 +48,7 @@
<span class="icon icon-add"></span> {{ _('Attend Contest') }} <span class="icon icon-add"></span> {{ _('Attend Contest') }}
</button> </button>
</form> </form>
{% elif not handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% elif not handler.has_perm(perm.PERM_LOGGEDIN) %}
<a class="menu__link" href="javascript:showSignInDialog()"> <a class="menu__link" href="javascript:showSignInDialog()">
<span class="icon icon-add"></span> {{ _('Login to Attend Contest') }} <span class="icon icon-add"></span> {{ _('Login to Attend Contest') }}
</a> </a>
+3 -3
View File
@@ -55,8 +55,8 @@
<li class="footer__extra-link-item" data-dropdown-target="#menu-footer-lang"> <li class="footer__extra-link-item" data-dropdown-target="#menu-footer-lang">
<span><span class="icon icon-global"></span> Language <span class="icon icon-expand_less"></span></span> <span><span class="icon icon-global"></span> Language <span class="icon icon-expand_less"></span></span>
<ol class="dropdown-target menu" id="menu-footer-lang"> <ol class="dropdown-target menu" id="menu-footer-lang">
{% for code, name in vj4.util.locale.VIEW_LANGS.items() %} {% for item in builtin.VIEW_LANGS %}
<li class="menu__item"><a class="menu__link" href="/lang/{{ code }}">{{ name }}</a></li> <li class="menu__item"><a class="menu__link" href="/lang/{{ item.code }}">{{ item.name }}</a></li>
{% endfor %} {% endfor %}
</ol> </ol>
</li> </li>
@@ -64,7 +64,7 @@
</div> </div>
<div class="footer__extra-right"> <div class="footer__extra-right">
<ol class="clearfix"> <ol class="clearfix">
{% for html in vj4.model.builtin.FOOTER_EXTRA_HTMLS %} {% for html in builtin.FOOTER_EXTRA_HTMLS %}
<li class="footer__extra-link-item">{{ html|safe }}</li> <li class="footer__extra-link-item">{{ html|safe }}</li>
{% endfor %} {% endfor %}
</ol> </ol>
+2 -2
View File
@@ -24,7 +24,7 @@
{% endif %} {% endif %}
{% if not attended and not handler.is_done(tdoc) %} {% if not attended and not handler.is_done(tdoc) %}
<li class="menu__item"> <li class="menu__item">
{% if handler.has_perm(vj4.model.builtin.PERM_ATTEND_HOMEWORK) and handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% if handler.has_perm(vj4.model.builtin.PERM_ATTEND_HOMEWORK) and handler.has_perm(perm.PERM_LOGGEDIN) %}
<form action="{{ reverse_url('homework_detail', tid=tdoc['doc_id']) }}" method="POST"> <form action="{{ reverse_url('homework_detail', tid=tdoc['doc_id']) }}" method="POST">
<input type="hidden" name="operation" value="attend"> <input type="hidden" name="operation" value="attend">
<input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}"> <input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
@@ -32,7 +32,7 @@
<span class="icon icon-add"></span> {{ _('Claim Homework') }} <span class="icon icon-add"></span> {{ _('Claim Homework') }}
</button> </button>
</form> </form>
{% elif not handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% elif not handler.has_perm(perm.PERM_LOGGEDIN) %}
<a class="menu__link" href="javascript:showSignInDialog()"> <a class="menu__link" href="javascript:showSignInDialog()">
<span class="icon icon-add"></span> {{ _('Login to Claim Homework') }} <span class="icon icon-add"></span> {{ _('Login to Claim Homework') }}
</a> </a>
+9 -11
View File
@@ -1,6 +1,6 @@
{% macro nav_item(target_page_name, target_page_prefix) %} {% macro nav_item(target_page_name, target_page_prefix) %}
<li class="nav__list-item"> <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="{{ reverse_url(target_page_name) }}" class="nav__item{% if page_name.startsWith(target_page_prefix) %} nav--active{% endif %}">
{{ _(target_page_name) }} {{ _(target_page_name) }}
</a> </a>
</li> </li>
@@ -9,36 +9,34 @@
<nav class="nav slideout-menu" id="menu"> <nav class="nav slideout-menu" id="menu">
<div class="row"><div class="columns clearfix"> <div class="row"><div class="columns clearfix">
<ol class="nav__list nav__list--main clearfix"> <ol class="nav__list nav__list--main clearfix">
{% if domain_id == vj4.model.builtin.DOMAIN_ID_SYSTEM %}
<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> <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>
{% endif %}
{{ nav_item('domain_main', 'domain_main') }} {{ nav_item('domain_main', 'domain_main') }}
{% if handler.has_perm(vj4.model.builtin.PERM_VIEW_PROBLEM) %} {% if handler.has_perm(perm.PERM_VIEW_PROBLEM) %}
{{ nav_item('problem_main', 'problem') }} {{ nav_item('problem_main', 'problem') }}
{% endif %} {% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_VIEW_TRAINING) %} {% if handler.has_perm(perm.PERM_VIEW_TRAINING) %}
{{ nav_item('training_main', 'training') }} {{ nav_item('training_main', 'training') }}
{% endif %} {% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_VIEW_DISCUSSION) %} {% if handler.has_perm(perm.PERM_VIEW_DISCUSSION) %}
{{ nav_item('discussion_main', 'discussion') }} {{ nav_item('discussion_main', 'discussion') }}
{% endif %} {% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_VIEW_CONTEST) %} {% if handler.has_perm(perm.PERM_VIEW_CONTEST) %}
{{ nav_item('contest_main', 'contest') }} {{ nav_item('contest_main', 'contest') }}
{% endif %} {% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_VIEW_HOMEWORK) %} {% if handler.has_perm(perm.PERM_VIEW_HOMEWORK) %}
{{ nav_item('homework_main', 'homework') }} {{ nav_item('homework_main', 'homework') }}
{% endif %} {% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_EDIT_DESCRIPTION) or handler.has_perm(vj4.model.builtin.PERM_EDIT_PERM) %} {% if handler.has_perm(perm.PERM_EDIT_DESCRIPTION) or handler.has_perm(perm.PERM_EDIT_PERM) %}
{{ nav_item('domain_manage', 'domain_manage') }} {{ nav_item('domain_manage', 'domain_manage') }}
{% endif %} {% endif %}
</ol> </ol>
<ol class="nav__list nav__list--secondary clearfix"> <ol class="nav__list nav__list--secondary clearfix">
{% if not handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% 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_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="{{ reverse_url('user_register') }}" class="nav__item--round">{{ _('Sign Up') }}</a></li>
{% else %} {% else %}
<li class="nav__list-item" data-dropdown-pos="bottom right" data-dropdown-target="#menu-nav-user" data-dropdown-trigger-desktop-only> <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.domain_user['display_name']|default(handler.user['uname'], true) }} <span class="icon icon-expand_more nojs--hide"></span></a> <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>
<ol class="dropdown-target menu" id="menu-nav-user"> <ol class="dropdown-target menu" id="menu-nav-user">
<li class="menu__item"> <li class="menu__item">
<a href="{{ reverse_url('user_detail', uid=handler.user['_id']) }}" class="menu__link"> <a href="{{ reverse_url('user_detail', uid=handler.user['_id']) }}" class="menu__link">
+7 -22
View File
@@ -8,7 +8,7 @@
{% else %} {% else %}
<table class="data-table"> <table class="data-table">
<colgroup> <colgroup>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% if handler.has_perm(perm.PERM_LOGGEDIN) %}
<col class="col--status"> <col class="col--status">
{% endif %} {% endif %}
<col class="col--name"> <col class="col--name">
@@ -18,7 +18,7 @@
</colgroup> </colgroup>
<thead> <thead>
<tr> <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> <th class="col--status record-status--border">{{ _('Status') }}</th>
{% endif %} {% endif %}
<th class="col--name">{{ _('Problem') }}</th> <th class="col--name">{{ _('Problem') }}</th>
@@ -29,9 +29,9 @@
</thead> </thead>
<tbody> <tbody>
{% for pdoc in pdocs %} {% for pdoc in pdocs %}
{% with psdoc = psdict[pdoc['doc_id']] %} {% set psdoc = psdict[pdoc['_id']] %}
<tr> <tr>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if psdoc['rid'] %} {% if psdoc['rid'] %}
{{ record.render_status_td(psdoc, rid_key='rid') }} {{ record.render_status_td(psdoc, rid_key='rid') }}
{% else %} {% else %}
@@ -40,27 +40,12 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
<td class="col--name col--problem-name"> <td class="col--name col--problem-name">
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {{ problem.render_problem_title(pdoc) }}
<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
) }}
</td> </td>
<td class="col--submit_n">{{ pdoc['num_submit'] }}</td> <td class="col--submit_n">{{ pdoc['nSubmit'] }}</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--ac_rate">{{ (100 * pdoc['nAccept'] / pdoc['nSubmit'])|round|int if pdoc['nSubmit'] > 0 else _('?') }}</td>
<td class="col--difficulty">{{ pdoc['difficulty'] or _('(None)') }}</td> <td class="col--difficulty">{{ pdoc['difficulty'] or _('(None)') }}</td>
</tr> </tr>
{% endwith %}
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
@@ -16,24 +16,24 @@
<span class="icon icon-enlarge"></span> {{ _('Quit Scratchpad') }} (Alt+Q) <span class="icon icon-enlarge"></span> {{ _('Quit Scratchpad') }} (Alt+Q)
</a></li> </a></li>
{% else %} {% else %}
<li class="menu__item"><a class="menu__link" href="{{ reverse_url('contest_detail_problem', tid=tdoc['doc_id'], pid=pdoc['doc_id']) }}"> <li class="menu__item"><a class="menu__link" href="{{ reverse_url('contest_detail_problem', tid=tdoc['doc_id'], pid=pdoc['_id']) }}">
<span class="icon icon-flag"></span> {{ _('View Problem') }} <span class="icon icon-flag"></span> {{ _('View Problem') }}
</a></li> </a></li>
{% endif %} {% endif %}
<li class="menu__item scratchpad--hide"><a class="menu__link{% if page_name == 'contest_detail_problem_submit' %} active{% endif %}" href="{{ reverse_url('contest_detail_problem_submit', tid=tdoc['doc_id'], pid=pdoc['doc_id']) }}"> <li class="menu__item scratchpad--hide"><a class="menu__link{% if page_name == 'contest_detail_problem_submit' %} active{% endif %}" href="{{ reverse_url('contest_detail_problem_submit', tid=tdoc['doc_id'], pid=pdoc['_id']) }}">
<span class="icon icon-send"></span> {{ _('Submit') }} <span class="icon icon-send"></span> {{ _('Submit') }}
</a></li> </a></li>
{% elif handler.is_done(tdoc) %} {% elif handler.is_done(tdoc) %}
<li class="menu__item scratchpad--hide"><a class="menu__link" href="{{ reverse_url('problem_detail', pid=pdoc['doc_id']) }}"> <li class="menu__item scratchpad--hide"><a class="menu__link" href="{{ reverse_url('problem_detail', pid=pdoc['_id']) }}">
<span class="icon icon-send"></span> {{ _('Open in Problem Set') }} <span class="icon icon-send"></span> {{ _('Open in Problem Set') }}
</a></li> </a></li>
{% endif %} {% 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, vj4.model.builtin.PERM_EDIT_PROBLEM_SELF) or handler.has_perm(vj4.model.builtin.PERM_EDIT_PROBLEM) %}
<li class="menu__seperator"></li> <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['doc_id']) }}"> <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') }} <span class="icon icon-edit"></span> {{ _('Edit') }}
</a></li> </a></li>
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_settings' %} active{% endif %}" href="{{ reverse_url('problem_settings', pid=pdoc['doc_id']) }}"> <li class="menu__item"><a class="menu__link{% if page_name == 'problem_settings' %} active{% endif %}" href="{{ reverse_url('problem_settings', pid=pdoc['_id']) }}">
<span class="icon icon-wrench"></span> {{ _('Settings') }} <span class="icon icon-wrench"></span> {{ _('Settings') }}
</a></li> </a></li>
{% endif %} {% endif %}
@@ -16,24 +16,24 @@
<span class="icon icon-enlarge"></span> {{ _('Quit Scratchpad') }} (Alt+Q) <span class="icon icon-enlarge"></span> {{ _('Quit Scratchpad') }} (Alt+Q)
</a></li> </a></li>
{% else %} {% else %}
<li class="menu__item"><a class="menu__link" href="{{ reverse_url('homework_detail_problem', tid=tdoc['doc_id'], pid=pdoc['doc_id']) }}"> <li class="menu__item"><a class="menu__link" href="{{ reverse_url('homework_detail_problem', tid=tdoc['doc_id'], pid=pdoc['_id']) }}">
<span class="icon icon-flag"></span> {{ _('View Problem') }} <span class="icon icon-flag"></span> {{ _('View Problem') }}
</a></li> </a></li>
{% endif %} {% endif %}
<li class="menu__item scratchpad--hide"><a class="menu__link{% if page_name == 'homework_detail_problem_submit' %} active{% endif %}" href="{{ reverse_url('homework_detail_problem_submit', tid=tdoc['doc_id'], pid=pdoc['doc_id']) }}"> <li class="menu__item scratchpad--hide"><a class="menu__link{% if page_name == 'homework_detail_problem_submit' %} active{% endif %}" href="{{ reverse_url('homework_detail_problem_submit', tid=tdoc['doc_id'], pid=pdoc['_id']) }}">
<span class="icon icon-send"></span> {{ _('Submit') }} <span class="icon icon-send"></span> {{ _('Submit') }}
</a></li> </a></li>
{% elif handler.is_done(tdoc) %} {% elif handler.is_done(tdoc) %}
<li class="menu__item scratchpad--hide"><a class="menu__link" href="{{ reverse_url('problem_detail', pid=pdoc['doc_id']) }}"> <li class="menu__item scratchpad--hide"><a class="menu__link" href="{{ reverse_url('problem_detail', pid=pdoc['_id']) }}">
<span class="icon icon-send"></span> {{ _('Open in Problem Set') }} <span class="icon icon-send"></span> {{ _('Open in Problem Set') }}
</a></li> </a></li>
{% endif %} {% 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, vj4.model.builtin.PERM_EDIT_PROBLEM_SELF) or handler.has_perm(vj4.model.builtin.PERM_EDIT_PROBLEM) %}
<li class="menu__seperator"></li> <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['doc_id']) }}"> <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') }} <span class="icon icon-edit"></span> {{ _('Edit') }}
</a></li> </a></li>
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_settings' %} active{% endif %}" href="{{ reverse_url('problem_settings', pid=pdoc['doc_id']) }}"> <li class="menu__item"><a class="menu__link{% if page_name == 'problem_settings' %} active{% endif %}" href="{{ reverse_url('problem_settings', pid=pdoc['_id']) }}">
<span class="icon icon-wrench"></span> {{ _('Settings') }} <span class="icon icon-wrench"></span> {{ _('Settings') }}
</a></li> </a></li>
{% endif %} {% endif %}
+16 -16
View File
@@ -10,11 +10,11 @@
<ol class="menu"> <ol class="menu">
{% if page_name == 'discussion_node' or page_name == 'discussion_detail' %} {% if page_name == 'discussion_node' or page_name == 'discussion_detail' %}
{% if handler.has_perm(vj4.model.builtin.PERM_CREATE_DISCUSSION) %} {% if handler.has_perm(vj4.model.builtin.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['doc_id']) }}"> <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') }} <span class="icon icon-add"></span> {{ _('Create a Discussion') }}
</a></li> </a></li>
{% else %} {% else %}
{% if not handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% if not handler.has_perm(perm.PERM_LOGGEDIN) %}
<li class="menu__item"><a class="menu__link" href="javascript:showSignInDialog();"> <li class="menu__item"><a class="menu__link" href="javascript:showSignInDialog();">
<span class="icon icon-add"></span> {{ _('Login to Create a Discussion') }}</a></li> <span class="icon icon-add"></span> {{ _('Login to Create a Discussion') }}</a></li>
{% else %} {% else %}
@@ -34,15 +34,15 @@
</a></li> </a></li>
{% endif %} {% endif %}
{% else %} {% else %}
<li class="menu__item"><a class="menu__link" href="{{ reverse_url('problem_detail', pid=pdoc['doc_id']) }}"> <li class="menu__item"><a class="menu__link" href="{{ reverse_url('problem_detail', pid=pdoc['_id']) }}">
<span class="icon icon-flag"></span> {{ _('View Problem') }} <span class="icon icon-flag"></span> {{ _('View Problem') }}
</a></li> </a></li>
{% endif %} {% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_SUBMIT_PROBLEM) %} {% if handler.has_perm(vj4.model.builtin.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['doc_id']) }}"> <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') }} <span class="icon icon-send"></span> {{ _('Submit') }}
</a></li> </a></li>
{% elif not handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% elif not handler.has_perm(perm.PERM_LOGGEDIN) %}
<li class="menu__item scratchpad--hide"><a class="menu__link{% if page_name == 'problem_submit' %} active{% endif %}" href="javascript:showSignInDialog();"> <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') }} <span class="icon icon-send"></span> {{ _('Login to Submit') }}
</a></li> </a></li>
@@ -55,16 +55,16 @@
<li class="menu__seperator"></li> <li class="menu__seperator"></li>
{% endif %} {% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_VIEW_DISCUSSION) %} {% if handler.has_perm(vj4.model.builtin.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['doc_id']) }}"> <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') }} <span class="icon icon-comment--text"></span> {{ _('Discussions') }}
</a></li> </a></li>
{% endif %} {% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_VIEW_PROBLEM_SOLUTION) %} {% if handler.has_perm(vj4.model.builtin.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['doc_id']) }}"> <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') }} <span class="icon icon-comment--text"></span> {{ _('Solutions') }}
</a></li> </a></li>
{% endif %} {% endif %}
{% if page_name == 'problem_detail' and handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% if page_name == 'problem_detail' and handler.has_perm(perm.PERM_LOGGEDIN) %}
<li class="menu__seperator"></li> <li class="menu__seperator"></li>
<li class="menu__item"><a class="menu__link" name="problem-sidebar__copy-to" href="javascript:;"> <li class="menu__item"><a class="menu__link" name="problem-sidebar__copy-to" href="javascript:;">
<span class="icon icon-copy"></span> {{ _('Copy Problem') }} <span class="icon icon-copy"></span> {{ _('Copy Problem') }}
@@ -72,10 +72,10 @@
{% endif %} {% 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, vj4.model.builtin.PERM_EDIT_PROBLEM_SELF) or handler.has_perm(vj4.model.builtin.PERM_EDIT_PROBLEM) %}
<li class="menu__seperator"></li> <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['doc_id']) }}"> <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') }} <span class="icon icon-edit"></span> {{ _('Edit') }}
</a></li> </a></li>
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_settings' %} active{% endif %}" href="{{ reverse_url('problem_settings', pid=pdoc['doc_id']) }}"> <li class="menu__item"><a class="menu__link{% if page_name == 'problem_settings' %} active{% endif %}" href="{{ reverse_url('problem_settings', pid=pdoc['_id']) }}">
<span class="icon icon-wrench"></span> {{ _('Settings') }} <span class="icon icon-wrench"></span> {{ _('Settings') }}
</a></li> </a></li>
{% endif %} {% endif %}
@@ -89,12 +89,12 @@
</div> </div>
<div class="section__body typo"> <div class="section__body typo">
<dl class="large horizontal"> <dl class="large horizontal">
{% if pdoc['doc_id']|string|length < 10 %} {% if pdoc['_id']|string|length < 10 %}
<dt>{{ _('ID') }}</dt> <dt>{{ _('ID') }}</dt>
<dd>{{ pdoc['doc_id'] }}</dd> <dd>{{ pdoc['_id'] }}</dd>
{% endif %} {% endif %}
{% if page_name != 'discussion_node' and page_name != 'discussion_detail' %} {% if page_name != 'discussion_node' and page_name != 'discussion_detail' %}
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% if handler.has_perm(perm.PERM_LOGGEDIN) %}
<dt>{{ _('Submission') }}</dt> <dt>{{ _('Submission') }}</dt>
<dd> <dd>
{% if pdoc['psdoc']['status'] %} {% if pdoc['psdoc']['status'] %}
@@ -141,11 +141,11 @@
{{ problem.render_problem_tags(pdoc, true) }} {{ problem.render_problem_tags(pdoc, true) }}
</dd> </dd>
<dt>{{ _('# Submissions') }}</dt> <dt>{{ _('# Submissions') }}</dt>
<dd><a href="{{ reverse_url('record_main') }}?pid={{ pdoc['doc_id'] }}">{{ pdoc['num_submit'] }}</a></dd> <dd><a href="{{ reverse_url('record_main') }}?pid={{ pdoc['_id'] }}">{{ pdoc['num_submit'] }}</a></dd>
{% if page_name != 'discussion_node' and page_name != 'discussion_detail' %} {% if page_name != 'discussion_node' and page_name != 'discussion_detail' %}
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% if handler.has_perm(perm.PERM_LOGGEDIN) %}
<dt>{{ _('# My Submissions') }}</dt> <dt>{{ _('# My Submissions') }}</dt>
<dd><a href="{{ reverse_url('record_main') }}?pid={{ pdoc['doc_id'] }}&uid_or_name={{ handler.user['_id'] }}">{{ pdoc['psdoc']['num_submit']|default(0) }}</a></dd> <dd><a href="{{ reverse_url('record_main') }}?pid={{ pdoc['_id'] }}&uid_or_name={{ handler.user['_id'] }}">{{ pdoc['psdoc']['num_submit']|default(0) }}</a></dd>
{% endif %} {% endif %}
{% endif %} {% endif %}
<dt>{{ _('Accepted') }}</dt> <dt>{{ _('Accepted') }}</dt>
+5 -5
View File
@@ -29,11 +29,11 @@
</div> </div>
<script> <script>
var Context = {{ { var Context = {{ {
'problemId': pdoc['doc_id'], 'problemId': pdoc['_id'],
'socketUrl': '{}-conn'.format(reverse_url('problem_pretest', pid=pdoc['doc_id'])), 'socketUrl': '{}-conn'.format(reverse_url('problem_pretest', pid=pdoc['_id'])),
'postPretestUrl': reverse_url('problem_pretest', pid=pdoc['doc_id']), 'postPretestUrl': reverse_url('problem_pretest', pid=pdoc['_id']),
'postSubmitUrl': reverse_url('problem_submit', pid=pdoc['doc_id']) if not tdoc else reverse_url('contest_detail_problem_submit' if tdoc['doc_type'] == vj4.model.document.TYPE_CONTEST else 'homework_detail_problem_submit', tid=tdoc['doc_id'], pid=pdoc['doc_id']), 'postSubmitUrl': reverse_url('problem_submit', pid=pdoc['_id']) if not tdoc else reverse_url('contest_detail_problem_submit' if tdoc['doc_type'] == vj4.model.document.TYPE_CONTEST else 'homework_detail_problem_submit', tid=tdoc['doc_id'], pid=pdoc['_id']),
'getSubmissionsUrl': reverse_url('problem_submit', pid=pdoc['doc_id']) if not tdoc else reverse_url('contest_detail_problem_submit' if tdoc['doc_type'] == vj4.model.document.TYPE_CONTEST else 'homework_detail_problem_submit', tid=tdoc['doc_id'], pid=pdoc['doc_id']), 'getSubmissionsUrl': reverse_url('problem_submit', pid=pdoc['_id']) if not tdoc else reverse_url('contest_detail_problem_submit' if tdoc['doc_type'] == vj4.model.document.TYPE_CONTEST else 'homework_detail_problem_submit', tid=tdoc['doc_id'], pid=pdoc['_id']),
'getRecordDetailUrl': reverse_url('record_detail', rid='{rid}'), 'getRecordDetailUrl': reverse_url('record_detail', rid='{rid}'),
'code_lang': handler.get_setting('code_lang'), 'code_lang': handler.get_setting('code_lang'),
'code_template': handler.get_code_template(), 'code_template': handler.get_code_template(),
+24 -12
View File
@@ -3,11 +3,11 @@
{% extends "layout/basic.html" %} {% extends "layout/basic.html" %}
{% block content %} {% block content %}
<script> <script>
var Context = {{ { var Context = {
'getProblemUrlWithCategory': reverse_url('problem_category', category='{category}'), getProblemUrlWithCategory: "/p?category={{category}}",
'getProblemUrlWithoutCategory': reverse_url('problem_main'), getProblemUrlWithoutCategory: "/p",
'currentCategory': category, currentCategory: "{{category}}"
}|json|safe }}; };
</script> </script>
<div class="row"> <div class="row">
<div class="medium-9 columns"> <div class="medium-9 columns">
@@ -22,20 +22,28 @@
<div class="section__header"> <div class="section__header">
<h1 class="section__title">{{ _('Categories') }}</h1> <h1 class="section__title">{{ _('Categories') }}</h1>
</div> </div>
<div class="section__body"><ul class="group-list" data-widget-cf-container> <div class="section__body">
{% for category, sub_categories in categories.items() %} <ul class="group-list" data-widget-cf-container>
{% for category in builtin.CATEGORIES %}
{% for sub_categories in category %}
<li class="group-list__item"> <li class="group-list__item">
<h2 class="section__title"><a href="{{ reverse_url('problem_category', category=category|urlencode) }}">{{ category }}</a></h2> <h2 class="section__title">
<a href="{{ reverse_url('problem_category', category=category|urlencode) }}">{{ category }}</a>
</h2>
{% if sub_categories | length > 0 %} {% if sub_categories | length > 0 %}
<ol class="chip-list"> <ol class="chip-list">
{% for sub_category in sub_categories %} {% for sub_category in sub_categories %}
<li class="chip-list__item"><a class="typo-a" href="{{ reverse_url('problem_category', category=(category|urlencode + ',' + sub_category|urlencode)) }}">{{ sub_category }}</a></li> <li class="chip-list__item">
<a class="typo-a" href="{{ reverse_url('problem_category', category=(category|urlencode + ',' + sub_category|urlencode)) }}">{{ sub_category }}</a>
</li>
{% endfor %} {% endfor %}
</ol> </ol>
{% endif %} {% endif %}
</li> </li>
{% endfor %} {% endfor %}
</ul></div> {% endfor %}
</ul>
</div>
<div class="section__body"> <div class="section__body">
{% include "partials/problem_lucky.html" %} {% include "partials/problem_lucky.html" %}
</div> </div>
@@ -61,10 +69,14 @@
</div> </div>
<ol class="menu"> <ol class="menu">
<li class="menu__item"> <li class="menu__item">
<a href="{{ reverse_url('problem_create') }}" class="menu__link"><span class="icon icon-add"></span> {{ _('Create Problem') }}</a> <a href="{{ reverse_url('problem_create') }}" class="menu__link">
<span class="icon icon-add"></span>
{{ _('Create Problem') }}</a>
</li> </li>
<li class="menu__item"> <li class="menu__item">
<a href="{{ reverse_url('problem_copy') }}" class="menu__link"><span class="icon icon-copy"></span> {{ _('Copy Problem') }}</a> <a href="{{ reverse_url('problem_copy') }}" class="menu__link">
<span class="icon icon-copy"></span>
{{ _('Copy Problem') }}</a>
</li> </li>
</ol> </ol>
<div class="section__body"> <div class="section__body">
+2 -2
View File
@@ -7,10 +7,10 @@
<h1 class="section__title">{{ _('Dataset') }}</h1> <h1 class="section__title">{{ _('Dataset') }}</h1>
</div> </div>
<div class="section__body"> <div class="section__body">
<iframe src="{{ reverse_url('problem_upload', pid=pdoc['doc_id']) }}" frameborder="0" style="width: 100%; height: 100px;"></iframe> <iframe src="{{ reverse_url('problem_upload', pid=pdoc['_id']) }}" frameborder="0" style="width: 100%; height: 100px;"></iframe>
<p class="help-text">{{ _('Hint') }}: <a href="{{ reverse_url('wiki_help') }}#upload">{{ _('Dataset Format') }}</a>, {{ _('An example of dataset') }}: <a href="https://github.com/vijos/jd4/blob/master/jd4/testdata/aplusb-legacy.zip?raw=true">{{ _('Download') }}</a></p> <p class="help-text">{{ _('Hint') }}: <a href="{{ reverse_url('wiki_help') }}#upload">{{ _('Dataset Format') }}</a>, {{ _('An example of dataset') }}: <a href="https://github.com/vijos/jd4/blob/master/jd4/testdata/aplusb-legacy.zip?raw=true">{{ _('Download') }}</a></p>
{% if pdoc and (handler.own(pdoc, vj4.model.builtin.PERM_READ_PROBLEM_DATA_SELF) or handler.has_perm(vj4.model.builtin.PERM_READ_PROBLEM_DATA) or handler.has_priv(vj4.model.builtin.PRIV_READ_PROBLEM_DATA)) %} {% if pdoc and (handler.own(pdoc, vj4.model.builtin.PERM_READ_PROBLEM_DATA_SELF) or handler.has_perm(vj4.model.builtin.PERM_READ_PROBLEM_DATA) or handler.has_priv(vj4.model.builtin.PRIV_READ_PROBLEM_DATA)) %}
<p><a href="{{ reverse_url('problem_data', pid=pdoc['doc_id']) }}" class="expanded button">{{ _('Download Dataset') }}</a></p> <p><a href="{{ reverse_url('problem_data', pid=pdoc['_id']) }}" class="expanded button">{{ _('Download Dataset') }}</a></p>
{% endif %} {% endif %}
</div> </div>
</div> </div>
+1 -1
View File
@@ -81,7 +81,7 @@
<dd><a href="{{ reverse_url('record_pretest_data', rid=rdoc['_id']) }}"><span class="icon icon-download"></span> {{ _('Download') }}</a></dd> <dd><a href="{{ reverse_url('record_pretest_data', rid=rdoc['_id']) }}"><span class="icon icon-download"></span> {{ _('Download') }}</a></dd>
{% elif rdoc['type'] == vj4.constant.record.TYPE_SUBMISSION and pdoc and (handler.own(pdoc, vj4.model.builtin.PERM_READ_PROBLEM_DATA_SELF) or handler.has_perm(vj4.model.builtin.PERM_READ_PROBLEM_DATA) or handler.has_priv(vj4.model.builtin.PRIV_READ_PROBLEM_DATA)) %} {% elif rdoc['type'] == vj4.constant.record.TYPE_SUBMISSION and pdoc and (handler.own(pdoc, vj4.model.builtin.PERM_READ_PROBLEM_DATA_SELF) or handler.has_perm(vj4.model.builtin.PERM_READ_PROBLEM_DATA) or handler.has_priv(vj4.model.builtin.PRIV_READ_PROBLEM_DATA)) %}
<dt>{{ _('Problem Data') }}</dt> <dt>{{ _('Problem Data') }}</dt>
<dd><a href="{{ reverse_url('problem_data', pid=pdoc['doc_id']) }}"><span class="icon icon-download"></span> {{ _('Download') }}</a></dd> <dd><a href="{{ reverse_url('problem_data', pid=pdoc['_id']) }}"><span class="icon icon-download"></span> {{ _('Download') }}</a></dd>
{% endif %} {% endif %}
<dt>{{ _('Language') }}</dt> <dt>{{ _('Language') }}</dt>
<dd> <dd>
+87
View File
@@ -0,0 +1,87 @@
{% macro form_begin(kwargs) %}
{% set label = kwargs.pop('label') %}
{% set columns = kwargs.pop('columns') %}
{% set last_column = kwargs.pop('last_column', true) %}
{% set required = kwargs.pop('required', false) %}
{% set hotkeys = kwargs.pop('hotkeys', none) %}
{% set row = kwargs.pop('row', true) %}
{% set no_label = kwargs.pop('no_label', false) %}
{% set label_wrap = kwargs.pop('label_wrap', true) %}
{% if row %}
<div class="row">
{% endif %}
<div
class="{% if columns %}medium-{{ columns }} {% endif %}columns form__item{% if last_column %} end{% endif %}"
{% if hotkeys %}data-hotkey="{{ hotkeys }}"{% endif %}
>
{% if not no_label %}
<label>
{{ _(label) }}
{% if required %}
({{ _('required') }})
{% endif %}
{% if not label_wrap %}
</label>
{% endif %}
{% endif %}
{% endmacro %}
{% macro form_end(kwargs) %}
{% set help_text = kwargs.pop('help_text', none) %}
{% set row = kwargs.pop('row', true) %}
{% set no_label = kwargs.pop('no_label', false) %}
{% set label_wrap = kwargs.pop('label_wrap', true) %}
{% if not no_label and label_wrap %}
</label>
{% endif %}
{% if help_text %}
<p class="help-text">{{ _(help_text)|safe }}</p>
{% endif %}
</div>
{% if row %}
</div>
{% endif %}
{% endmacro %}
{% macro form_attr(form_class, kwargs) %}
{% set disabled = kwargs.pop('disabled', false) %}
{% set required = kwargs.pop('required', false) %}
{% set autofocus = kwargs.pop('autofocus', false) %}
{% set date = kwargs.pop('date', false) %}
{% set time = kwargs.pop('time', false) %}
class="{{ form_class }}{% if extra_class %} {{ extra_class }}{% endif %}"
{% if disabled %}disabled{% endif %}
{% if required %}required{% endif %}
{% if autofocus %}autofocus data-autofocus{% endif %}
{% if date %}data-pick-date{% endif %}
{% if time %}data-pick-time{% endif %}
{% endmacro %}
{% macro container_attr(container_class, kwargs) %}
{% set extra_class = kwargs.pop('extra_class', none) %}
class="{{ container_class }}{% if extra_class %} {{ extra_class }}{% endif %}"
{% endmacro %}
{% macro select(options, name='', value='', kwargs) %}
<div
name="form_item_{{ name }}"
{{ container_attr('select-container', kwargs) }}
>
<select
name="{{ name }}"
{{ form_attr('select', kwargs) }}
>
{% for k, v in options %}
<option value="{{ k }}"{% if value == k %} selected{% endif %}>
{{ _(v) }}
</option>
{% endfor %}
</select>
</div>
{% endmacro %}
{% macro form_select(columns=5) %}
{{ form_begin({columns:1, ...kwargs}, kwargs) }}
{{ select(columns=columns, kwargs) }}
{{ form_end(columns=columns, kwargs) }}
{% endmacro %}
+7 -7
View File
@@ -79,7 +79,7 @@
<div class="section__body no-padding training__problems"> <div class="section__body no-padding training__problems">
<table class="data-table"> <table class="data-table">
<colgroup> <colgroup>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% if handler.has_perm(perm.PERM_LOGGEDIN) %}
<col class="col--status"> <col class="col--status">
{% endif %} {% endif %}
<col class="col--name"> <col class="col--name">
@@ -89,7 +89,7 @@
</colgroup> </colgroup>
<thead> <thead>
<tr> <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> <th class="col--status record-status--border">{{ _('Status') }}</th>
{% endif %} {% endif %}
<th class="col--name">{{ _('Problem') }}</th> <th class="col--name">{{ _('Problem') }}</th>
@@ -103,7 +103,7 @@
{% if pid in pdict %} {% if pid in pdict %}
{% with pdoc=pdict[pid], psdoc=psdict[pid] %} {% with pdoc=pdict[pid], psdoc=psdict[pid] %}
<tr> <tr>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if psdoc['rid'] %} {% if psdoc['rid'] %}
{{ record.render_status_td(psdoc, rid_key='rid') }} {{ record.render_status_td(psdoc, rid_key='rid') }}
{% else %} {% else %}
@@ -111,9 +111,9 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
<td class="col--name col--problem-name"> <td class="col--name col--problem-name">
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% if handler.has_perm(perm.PERM_LOGGEDIN) %}
<form class="form--inline" action="{{ reverse_url('problem_main') }}" method="post"> <form class="form--inline" action="{{ reverse_url('problem_main') }}" method="post">
<input type="hidden" name="pid" value="{{ pdoc['doc_id'] }}"> <input type="hidden" name="pid" value="{{ pdoc['_id'] }}">
<input type="hidden" name="operation" value="{% if not psdoc['star'] %}star{% else %}unstar{% endif %}"> <input type="hidden" name="operation" value="{% if not psdoc['star'] %}star{% else %}unstar{% endif %}">
<input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}"> <input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
<button class="star{% if psdoc['star'] %} activated{% endif %}" type="submit"> <button class="star{% if psdoc['star'] %} activated{% endif %}" type="submit">
@@ -164,7 +164,7 @@
<div class="section side"> <div class="section side">
<div> <div>
<ol class="menu"> <ol class="menu">
{% if not tsdoc['enroll'] and handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% if not tsdoc['enroll'] and handler.has_perm(perm.PERM_LOGGEDIN) %}
<li class="menu__item"> <li class="menu__item">
<form action="" method="POST"> <form action="" method="POST">
<input type="hidden" name="operation" value="enroll"> <input type="hidden" name="operation" value="enroll">
@@ -188,7 +188,7 @@
</div> </div>
<div class="section__body typo"> <div class="section__body typo">
<dl class="large horizontal"> <dl class="large horizontal">
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% if handler.has_perm(perm.PERM_LOGGEDIN) %}
<dt>{{ _('Status') }}</dt><dd>{% if tsdoc['enroll'] %}{{ _('Completed' if tsdoc['done'] else 'In Progress') }}{% else %}{{ _('Not Enrolled') }}{% endif %}</dd> <dt>{{ _('Status') }}</dt><dd>{% if tsdoc['enroll'] %}{{ _('Completed' if tsdoc['done'] else 'In Progress') }}{% else %}{{ _('Not Enrolled') }}{% endif %}</dd>
{% endif %} {% endif %}
{% if tsdoc['enroll'] %} {% if tsdoc['enroll'] %}
+2 -2
View File
@@ -37,7 +37,7 @@
<span class="icon training-status--icon done"></span> <span class="icon training-status--icon done"></span>
<span class="training-status--text done">{{ _('Completed') }} 100%</span> <span class="training-status--text done">{{ _('Completed') }} 100%</span>
{% endif %} {% endif %}
{% elif handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% elif handler.has_perm(perm.PERM_LOGGEDIN) %}
<span class="icon training-status--icon outside"></span> <span class="training-status--text outside">{{ _('Not Enrolled') }}</span> <span class="icon training-status--icon outside"></span> <span class="training-status--text outside">{{ _('Not Enrolled') }}</span>
{% endif %} {% endif %}
</li> </li>
@@ -52,7 +52,7 @@
</div> </div>
</div> </div>
<div class="large-3 columns"> <div class="large-3 columns">
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %} {% if handler.has_perm(perm.PERM_LOGGEDIN) %}
<div class="section side"> <div class="section side">
<div class="section__header"> <div class="section__header">
<h1 class="section__title">{{ _('Enrolled') }}</h1> <h1 class="section__title">{{ _('Enrolled') }}</h1>
+1 -1
View File
@@ -111,7 +111,7 @@
</div> </div>
<div class="section__body"> <div class="section__body">
{% for pdoc in pdocs %} {% for pdoc in pdocs %}
<p><a href="{{ reverse_url('problem_detail', pid=pdoc['doc_id']) }}">{{ pdoc['title'] }}</a></p> <p><a href="{{ reverse_url('problem_detail', pid=pdoc['_id']) }}">{{ pdoc['title'] }}</a></p>
{% endfor %} {% endfor %}
</div> </div>
{% endif %}{# if pdocs #} {% endif %}{# if pdocs #}