重构框架,增加比赛功能

This commit is contained in:
masnn committed 2020-04-11 20:37:47 +08:00
1 parent 0e590ebe0d
commit 9bf3343a64
54 files changed
+1196 -868

No files matched your search

@@ -28,15 +28,15 @@
{% macro reply_operations(doc, rdoc) %}
<div class="dczcomments__operations nojs--hide">
{% if handler.has_perm(reply_post_perm) %}
{% if handler.hasPerm(reply_post_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Reply') }}" name="dczcomments__op-reply-reply"><span class="icon icon-reply"></span></a>
{% endif %}
{% if doc.owner == handler.state.user._id or handler.has_perm(reply_edit_perm) %}
{% if doc.owner == handler.state.user._id or handler.hasPerm(reply_edit_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Edit') }}" name="dczcomments__op-edit-reply"
data-form="{&quot;operation&quot;:&quot;{{reply_edit_op}}&quot;,&quot;{{comment_ref}}&quot;:&quot;{{doc._id}}&quot;,&quot;{{reply_ref}}&quot;:&quot;{{rdoc._id}}&quot;}"
><span class="icon icon-edit"></span></a>
{% endif %}
{% if doc.owner == handler.state.user._id or handler.has_perm(reply_delete_perm) %}
{% if doc.owner == handler.state.user._id or handler.hasPerm(reply_delete_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Delete') }}" name="dczcomments__op-delete-reply"
data-form="{&quot;operation&quot;:&quot;{{reply_delete_op}}&quot;,&quot;{{comment_ref}}&quot;:&quot;{{doc._id}}&quot;,&quot;{{reply_ref}}&quot;:&quot;{{rdoc._id}}&quot;}"
><span class="icon icon-delete"></span></a>
@@ -71,7 +71,7 @@
reply_delete_op = 'delete_tail_reply'
) %}
<ul class="dczcomments__list view--discussion">
{% if handler.has_perm(comment_post_perm) %}
{% if handler.hasPerm(comment_post_perm) %}
<li class="dczcomments__item">
<div class="media">
<div class="media__left top">
@@ -116,17 +116,17 @@
@ {{ datetime_span(doc['_id'])|safe }}
</div>
<div class="dczcomments__operations nojs--hide">
{% if handler.has_perm(reply_post_perm) %}
{% if handler.hasPerm(reply_post_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Reply') }}" name="dczcomments__op-reply-comment"
data-form="{&quot;operation&quot;:&quot;{{reply_post_op}}&quot;, &quot;{{comment_ref}}&quot;:&quot;{{doc._id}}&quot;}"
><span class="icon icon-reply"></span></a>
{% endif %}
{% if doc.owner == handler.state.user._id or handler.has_perm(comment_edit_perm) %}
{% if doc.owner == handler.state.user._id or handler.hasPerm(comment_edit_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Edit') }}" name="dczcomments__op-edit-comment"
data-form="{&quot;operation&quot;:&quot;{{comment_edit_op}}&quot;,&quot;{{comment_ref}}&quot;:&quot;{{doc._id}}&quot;}"
><span class="icon icon-edit"></span></a>
{% endif %}
{% if doc.owner == handler.state.user._id or handler.has_perm(comment_delete_perm) %}
{% if doc.owner == handler.state.user._id or handler.hasPerm(comment_delete_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Delete') }}" name="dczcomments__op-delete-comment"
data-form="{&quot;operation&quot;:&quot;{{comment_delete_op}}&quot;,&quot;{{comment_ref}}&quot;:&quot;{{doc._id}}&quot;}"
><span class="icon icon-delete"></span></a>
+8 -8
View File
@@ -30,7 +30,7 @@
reply_delete_op = 'delete_tail_reply'
) %}
<ul class="dczcomments__list view--solution">
{% if handler.has_perm(comment_post_perm) %}
{% if handler.hasPerm(comment_post_perm) %}
<li class="dczcomments__item">
<div class="media">
<div class="media__left top">
@@ -85,7 +85,7 @@
<div class="media">
<div class="media__left top">
<div class="vote vote--discussion">
{% if handler.has_perm(perm.PERM_VOTE_PROBLEM_SOLUTION) %}
{% if handler.hasPerm(perm.PERM_VOTE_PROBLEM_SOLUTION) %}
<div class="vote-number rotator--enabled">{{ doc.vote }}</div>
<div class="vote-op clearfix">
<form method="post">
@@ -113,17 +113,17 @@
@ {{ datetime_span(doc._id)|safe }}
</div>
<div class="dczcomments__operations nojs--hide">
{% if handler.has_perm(reply_post_perm) %}
{% if handler.hasPerm(reply_post_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Reply') }}" name="dczcomments__op-reply-comment"
data-form="{&quot;operation&quot;:&quot;{{reply_post_op}}&quot;, &quot;{{comment_ref}}&quot;:&quot;{{doc._id}}&quot;}"
><span class="icon icon-reply"></span></a>
{% endif %}
{% if doc.owner == handler.state.user._id or handler.has_perm(comment_edit_perm) %}
{% if doc.owner == handler.state.user._id or handler.hasPerm(comment_edit_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Edit') }}" name="dczcomments__op-edit-comment"
data-form="{&quot;operation&quot;:&quot;{{comment_edit_op}}&quot;,&quot;{{comment_ref}}&quot;:&quot;{{doc._id}}&quot;}"
><span class="icon icon-edit"></span></a>
{% endif %}
{% if doc.owner == handler.state.user._id or handler.has_perm(comment_delete_perm) %}
{% if doc.owner == handler.state.user._id or handler.hasPerm(comment_delete_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Delete') }}" name="dczcomments__op-delete-comment"
data-form="{&quot;operation&quot;:&quot;{{comment_delete_op}}&quot;,&quot;{{comment_ref}}&quot;:&quot;{{doc._id}}&quot;}"
><span class="icon icon-delete"></span></a>
@@ -145,15 +145,15 @@
{{ user.render_inline(udoc, badge=false) }} @ {{ datetime_span(rdoc['_id'])|safe }}
</div>
<div class="dczcomments__operations nojs--hide">
{% if handler.has_perm(reply_post_perm) %}
{% if handler.hasPerm(reply_post_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Reply') }}" name="dczcomments__op-reply-reply"><span class="icon icon-reply"></span></a>
{% endif %}
{% if doc.owner == handler.state.user._id or handler.has_perm(reply_edit_perm) %}
{% if doc.owner == handler.state.user._id or handler.hasPerm(reply_edit_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Edit') }}" name="dczcomments__op-edit-reply"
data-form="{&quot;operation&quot;:&quot;{{reply_edit_op}}&quot;,&quot;{{comment_ref}}&quot;:&quot;{{doc._id}}&quot;,&quot;{{reply_ref}}&quot;:&quot;{{rdoc._id}}&quot;}"
><span class="icon icon-edit"></span></a>
{% endif %}
{% if doc.owner == handler.state.user._id or handler.has_perm(reply_delete_perm) %}
{% if doc.owner == handler.state.user._id or handler.hasPerm(reply_delete_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Delete') }}" name="dczcomments__op-delete-reply"
data-form="{&quot;operation&quot;:&quot;{{reply_delete_op}}&quot;,&quot;{{comment_ref}}&quot;:&quot;{{doc._id}}&quot;,&quot;{{reply_ref}}&quot;:&quot;{{rdoc._id}}&quot;}"
><span class="icon icon-delete"></span></a>
+5 -5
View File
@@ -1,12 +1,12 @@
{% macro form_begin(args) %}
{% set label = args.label %}
{% set columns = args.columns %}
{% set last_column = args.last_column or true %}
{% set last_column = args.last_column|default(true) %}
{% set required = args.required or false %}
{% set hotkeys = args.hotkeys or none %}
{% set row = args.row or true %}
{% set row = args.row|default(true) %}
{% set no_label = args.no_label or false %}
{% set label_wrap = args.label_wrap or true %}
{% set label_wrap = args.label_wrap|default(true) %}
{% if row %}
<div class="row">
{% endif %}
@@ -28,9 +28,9 @@
{% macro form_end(args) %}
{% set help_text = args.help_text or none %}
{% set row = args.row or true %}
{% set row = args.row|default(true) %}
{% set no_label = args.no_label or false %}
{% set label_wrap = args.label_wrap or true %}
{% set label_wrap = args.label_wrap|default(true) %}
{% if not no_label and label_wrap %}
</label>
{% endif %}
+1 -1
View File
@@ -13,7 +13,7 @@
</a>
{% if badge %}
<a class="user-profile-badge v-center badge--lv{{ udoc['level']|default(0) }}" href="/u/{{ udoc['_id']|default(0) }}" title="LV {{ udoc['level']|default(0) }}: Top {{ builtin.LEVELS[udoc['level']|default(0)]|default('N/A') }}%">LV {{ udoc['level']|default(0) }}</a>
{% if modbadge and handler.has_perm(perm.PERM_MOD_BADGE) %}
{% if modbadge and handler.hasPerm(perm.PERM_MOD_BADGE) %}
<span class="user-profile-badge v-center badge--mod" title="Moderator">MOD</span>
{% endif %}
{% endif %}
+3 -3
View File
@@ -24,7 +24,7 @@
<div class="section__body no-padding">
<table class="data-table">
<colgroup>
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
<col class="col--status">
<col class="col--submit-at">
{% endif %}
@@ -32,7 +32,7 @@
</colgroup>
<thead>
<tr>
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
<th class="col--status record-status--border">{{ _('Status') }}</th>
<th class="col--submit-at">{{ _('Last Submit At') }}</th>
{% endif %}
@@ -42,7 +42,7 @@
<tbody>
{% for pid in tdoc['pids'] %}
<tr>
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if psdict[pid] and psdict[pid]['rid'] %}
{% with rdoc=rdict[psdict[pid]['rid']] %}
{% if handler.can_show_record(tdoc) %}
+55 -7
View File
@@ -6,15 +6,63 @@
<div class="section__body">
<form method="post">
<div class="row">
{{ form.form_select(columns=4, label='Rule', name='rule', options=rules, value=tdoc['rule']|default(''), row=False) }}
{{ form.form_text(columns=8, label='Title', name='title', placeholder=_('title'), value=tdoc['title']|default(''), autofocus=True, row=False) }}
{{ form.form_select({
columns:4,
label:'Rule',
name:'rule',
options:rules,
value:tdoc['rule']|default(''),
row:false
}) }}
{{ form.form_text({
columns:8,
label:'Title',
name:'title',
placeholder:_('title'),
value:tdoc['title']|default(''),
autofocus:true,
row:false
}) }}
</div><div class="row">
{{ form.form_text(columns=4, label='Begin Date', name='begin_at_date', placeholder='YYYY-mm-dd', value=date_text, date=True, row=False) }}
{{ form.form_text(columns=4, label='Begin Time', name='begin_at_time', placeholder='HH:MM', value=time_text, time=True, row=False) }}
{{ form.form_text(columns=4, label='Duration (hours)', name='duration', value=duration|default('3'), row=False) }}
{{ form.form_text({
columns:4,
label:'Begin Date',
name:'beginAtDate',
placeholder:'YYYY-mm-dd',
value:date_text,
date:true,
row:false
}) }}
{{ form.form_text({
columns:4,
label:'Begin Time',
name:'beginAtTime',
placeholder:'HH:MM',
value:time_text,
time:true,
row:false
}) }}
{{ form.form_text({
columns:4,
label:'Duration (hours)',
name:'duration',
value:duration|default('3'),
row:false
}) }}
</div>
{{ form.form_text(columns=None, label='Problems', name='pids', value=pids) }}
{{ form.form_textarea(columns=None, label='Content', name='content', value=tdoc['content']|default(''), markdown=True) }}
{{ form.form_text({
columns:null,
label:'Problems',
name:'pids',
value:pids
}) }}
{{ form.form_textarea({
columns:null,
label:'Content',
name:'content',
value:tdoc['content']|default(''),
markdown:true
}) }}
<div class="row"><div class="columns">
<input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
{% if page_name == 'contest_edit' %}
+16 -15
View File
@@ -1,3 +1,4 @@
{% set page_name = "contest_main" %}
{% extends "layout/basic.html" %}
{% import "components/contest.html" as contest with context %}
{% macro render_important_contest(view, title, tdoc) %}
@@ -12,15 +13,15 @@
<ul class="info">
<li>
<span class="icon icon-award"></span>
{{ _('Rule') }}: {{ vj4.constant.contest.RULE_TEXTS[tdoc['rule']] }}
{{ _('Rule') }}: {{ model.contest.RULES[tdoc['rule']].TEXT }}
</li>
<li>
<span class="icon icon-calendar"></span>
{{ _('Start at') }}: {{ contest.render_time(tdoc['begin_at']) }}
{{ _('Start at') }}: {{ model.contest.render_time(tdoc['beginAt']) }}
</li>
<li>
<span class="icon icon-schedule--fill"></span>
{{ _('Duration') }}: {{ contest.render_duration(tdoc) }} {{ _('hour(s)') }}
{{ _('Duration') }}: {{ model.contest.render_duration(tdoc) }} {{ _('hour(s)') }}
</li>
<li>
<span class="icon icon-user--multiple"></span>
@@ -33,7 +34,7 @@
<div class="section__body">
<a href="/t/{{ tdoc._id }}" class="detail-button">{{ _('View Details') }}</a>
<div class="typo text-center">
{% if tsdict[tdoc['doc_id']]['attend'] == 1 %}
{% if tsdict[tdoc._id].attend %}
<p><span class="icon icon-check"></span> {{ _('Attended') }}</p>
{% else %}
<p><span class="icon icon-schedule"></span> {{ _('Not Attended') }}</p>
@@ -56,14 +57,14 @@
{% endfor %}
<div class="section">
<div class="section__header">
<h1 class="section__title">{% if not rule %}{{ _('All Contests') }}{% else %}{{ _('All {0} Contests').format(_(vj4.constant.contest.RULE_TEXTS[rule])) }}{% endif %}</h1>
<h1 class="section__title">{% if not rule %}{{ _('All Contests') }}{% else %}{{ _('All {0} Contests').format(_(model.contest.RULES[rule].TEXT)) }}{% endif %}</h1>
<div class="section__tools">
<form method="get" name="filter-form">
{{ _('Show') }}:
<select class="inline compact select" name="rule">
<option value="0"{% if not rule %} selected{% endif %}>{{ _('All') }}</option>
{% for k, v in vj4.constant.contest.RULE_TEXTS.items() %}
<option value="{{ k }}"{% if rule == k %} selected{% endif %}>{{ _('All {0} Contests').format(_(v)) }}</option>
{% for k, v in model.contest.RULES %}
<option value="{{ k }}"{% if rule == k %} selected{% endif %}>{{ _('All {0} Contests').format(_(v.TEXT)) }}</option>
{% endfor %}
</select>
<button type="submit" class="button hasjs--hide">
@@ -73,24 +74,24 @@
</div>
</div>
<div class="section__body no-padding">
{% if not tdocs %}
{% if not tdocs.length %}
{{ nothing.render('There are no contests...') }}
{% else %}
<ol class="section__list contest__list">
{% for tdoc in tdocs %}
<li class="section__list__item contest__item contest-type--{{ vj4.constant.contest.RULE_ID[tdoc['rule']] }}">
<li class="section__list__item contest__item contest-type--{{ tdoc['rule'] }}">
<div class="media">
<div class="media__left medium">
<div class="contest__date numbox">
<div class="numbox__num large">{{ datetime_span(tdoc['begin_at'], false, '%d') }}</div>
<div class="numbox__text">{{ datetime_span(tdoc['begin_at'], false, '%Y-%m') }}</div>
<div class="numbox__num large">{{ datetime_span(tdoc['beginAt'], false, '%d') }}</div>
<div class="numbox__text">{{ datetime_span(tdoc['beginAt'], false, '%Y-%m') }}</div>
</div>
</div>
<div class="media__body medium">
<h1 class="contest__title"><a href="/t/{{ tdoc._id }}" data-emoji-enabled>{{ tdoc['title'] }}</a></h1>
<ul class="supplementary list">
<li>
<a href="?rule={{ tdoc['rule'] }}" class="contest-type-tag"><span class="icon icon-award"></span>{{ vj4.constant.contest.RULE_TEXTS[tdoc['rule']] }}</a>
<a href="?rule={{ tdoc['rule'] }}" class="contest-type-tag"><span class="icon icon-award"></span>{{ model.contest.RULES[tdoc.rule].TEXT }}</a>
</li>
<li>
<span class="icon icon-schedule--fill text-blue"></span> {{ contest.render_duration(tdoc) }} {{ _('hour(s)') }}
@@ -98,7 +99,7 @@
<li>
<span class="icon icon-user--multiple"></span> {{ tdoc['attend']|default(0) }}
</li>
{% if tsdict[tdoc['doc_id']]['attend'] == 1 %}
{% if tsdict[tdoc._id]['attend'] == 1 %}
<li class="contest__info-attended">
<span class="icon icon-check"></span> {{ _('Attended') }}
</li>
@@ -115,7 +116,7 @@
</div>
</div>
<div class="medium-3 columns">
{% if handler.has_perm(perm.PERM_CREATE_CONTEST) %}
{% if handler.hasPerm(perm.PERM_CREATE_CONTEST) %}
<div class="section side">
<div class="section__header">
<h1 class="section__title">
@@ -123,7 +124,7 @@
</h1>
</div>
<div class="section__body">
<p><a href="{{ reverse_url('contest_create') }}" class="expanded primary button">{{ _('Create a contest') }}</a></p>
<p><a href="/contest/create" class="expanded primary button">{{ _('Create a contest') }}</a></p>
</div>
</div>
{% endif %}
+2 -2
View File
@@ -29,7 +29,7 @@
</div>
</div>
<ul class="section__footer supplementary dot list">
{% if handler.own(ddoc, perm.PERM_EDIT_DISCUSSION_SELF) or handler.has_perm(perm.PERM_EDIT_DISCUSSION) %}
{% if handler.own(ddoc, perm.PERM_EDIT_DISCUSSION_SELF) or handler.hasPerm(perm.PERM_EDIT_DISCUSSION) %}
<li>
<a href="{{ reverse_url('discussion_edit', did=ddoc['doc_id']) }}"><span class="icon icon-edit"></span> {{ _('Edit') }}</a>
</li>
@@ -37,7 +37,7 @@
<li>
{{ _('{0} views').format(ddoc['views']) }}
</li>
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
<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="csrf_token" value="{{ handler.csrf_token }}">
+1 -1
View File
@@ -11,7 +11,7 @@
<button name="operation" value="update" type="submit" class="rounded primary button">
{{ _('Update') }} (Ctrl+Enter)
</button>
{% if handler.own(ddoc, perm.PERM_DELETE_DISCUSSION_SELF) or handler.has_perm(perm.PERM_DELETE_DISCUSSION) %}
{% if handler.own(ddoc, perm.PERM_DELETE_DISCUSSION_SELF) or handler.hasPerm(perm.PERM_DELETE_DISCUSSION) %}
<button name="operation" value="delete" type="submit" class="rounded button">
{{ _('Delete') }}
</button>
+2 -2
View File
@@ -23,10 +23,10 @@
</div>
<div class="section__body">
{% if vnode %}
{% if handler.has_perm(perm.PERM_CREATE_DISCUSSION) %}
{% if handler.hasPerm(perm.PERM_CREATE_DISCUSSION) %}
<p><a href="{{ reverse_url('discussion_create', doc_id=vnode['doc_id']) }}" class="expanded primary button">{{ _('Create a Discussion') }}</a></p>
{% else %}
{% if not handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if not handler.hasPerm(perm.PERM_LOGGEDIN) %}
<p><a href="javascript:showSignInDialog();" class="expanded primary button">{{ _('Login to Create a Discussion') }}</a></p>
{% else %}
<p><a href="javascript:;" class="disabled expanded primary button">{{ _('No Permission to Create a Discussion') }}</a></p>
+2 -2
View File
@@ -13,7 +13,7 @@
</div>
<ol class="menu collapsed">
{{ sidemenu.render_item(null, 'domain_manage_dashboard') }}
{% if handler.has_perm(perm.PERM_EDIT_DESCRIPTION) %}
{% if handler.hasPerm(perm.PERM_EDIT_DESCRIPTION) %}
{{ sidemenu.render_item(null, 'domain_manage_edit') }}
{{ sidemenu.render_item(null, 'domain_manage_join_applications') }}
{{ sidemenu.render_item(null, 'domain_manage_discussion') }}
@@ -21,7 +21,7 @@
<!-- Ranking Settings -->
</ol>
</li>
{% if handler.has_perm(perm.PERM_EDIT_PERM) %}
{% if handler.hasPerm(perm.PERM_EDIT_PERM) %}
<li class="menu__item">
<div class="menu__link expandable">
<span class="icon icon-user"></span> {{ _('Access Control') }}
+2 -2
View File
@@ -139,7 +139,7 @@
<span class="icon training-status--icon done"></span>
<span class="training-status--text done">{{ _('Completed') }} 100%</span>
{% endif %}
{% elif handler.has_perm(perm.PERM_LOGGEDIN) %}
{% elif handler.hasPerm(perm.PERM_LOGGEDIN) %}
<span class="icon training-status--icon outside"></span> <span class="training-status--text outside">{{ _('Not Enrolled') }}</span>
{% endif %}
</li>
@@ -164,7 +164,7 @@
{% endif %}
</div>
<div class="large-3 columns">
{% if handler.has_perm(perm.PERM_VIEW_DISCUSSION) %}
{% if handler.hasPerm(perm.PERM_VIEW_DISCUSSION) %}
{% include 'discussion_nodes_widget.html' %}
{% endif %}
{% if domain_id == vj4.model.builtin.DOMAIN_ID_SYSTEM %}
+3 -3
View File
@@ -23,7 +23,7 @@
<div class="section__body no-padding">
<table class="data-table">
<colgroup>
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
<col class="col--status">
<col class="col--submit-at">
{% endif %}
@@ -31,7 +31,7 @@
</colgroup>
<thead>
<tr>
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
<th class="col--status record-status--border">{{ _('Status') }}</th>
<th class="col--submit-at">{{ _('Last Submit At') }}</th>
{% endif %}
@@ -41,7 +41,7 @@
<tbody>
{% for pid in tdoc['pids'] %}
<tr>
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if psdict[pid] and psdict[pid]['rid'] %}
{% with rdoc=rdict[psdict[pid]['rid']] %}
{% if handler.can_show_record(tdoc) %}
+1 -1
View File
@@ -18,7 +18,7 @@
<option value="list">{{ _('List View') }}</option>
</select>
</span>
{% if handler.has_perm(perm.PERM_CREATE_HOMEWORK) %}
{% if handler.hasPerm(perm.PERM_CREATE_HOMEWORK) %}
<a class="compact button" href="{{ reverse_url('homework_create') }}">{{ _('Create Homework') }}</a>
{% endif %}
</div>
+6 -6
View File
@@ -18,12 +18,12 @@
<div>
<ol class="menu">
{% if page_name == 'discussion_node' %}
{% if handler.has_perm(perm.PERM_CREATE_DISCUSSION) %}
{% 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=tdoc['doc_type'], doc_id=tdoc['doc_id']) }}">
<span class="icon icon-add"></span> {{ _('Create a Discussion') }}
</a></li>
{% else %}
{% if not handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if not handler.hasPerm(perm.PERM_LOGGEDIN) %}
<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 %}
@@ -40,7 +40,7 @@
{% endif %}
{% if not attended and not handler.is_done(tdoc) %}
<li class="menu__item">
{% if handler.has_perm(perm.PERM_ATTEND_CONTEST) and handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if handler.hasPerm(perm.PERM_ATTEND_CONTEST) and handler.hasPerm(perm.PERM_LOGGEDIN) %}
<form action="/t/{{ tdoc._id }}" method="POST">
<input type="hidden" name="operation" value="attend">
<input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
@@ -48,7 +48,7 @@
<span class="icon icon-add"></span> {{ _('Attend Contest') }}
</button>
</form>
{% elif not handler.has_perm(perm.PERM_LOGGEDIN) %}
{% elif not handler.hasPerm(perm.PERM_LOGGEDIN) %}
<a class="menu__link" href="javascript:showSignInDialog()">
<span class="icon icon-add"></span> {{ _('Login to Attend Contest') }}
</a>
@@ -68,12 +68,12 @@
<span class="icon icon-statistics"></span> {{ _('Scoreboard (Hidden)') }}
</a></li>
{% endif %}
{% if handler.own(tdoc, perm.PERM_EDIT_CONTEST_SELF) or handler.has_perm(perm.PERM_EDIT_CONTEST) %}
{% if handler.own(tdoc, perm.PERM_EDIT_CONTEST_SELF) or handler.hasPerm(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(perm.PERM_READ_RECORD_CODE) %}
{% if handler.hasPerm(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(perm.PERM_HIGHLIGHT_DISCUSSION) %}
{% if ddoc['highlight'] or handler.hasPerm(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) }}
+4 -4
View File
@@ -24,7 +24,7 @@
{% endif %}
{% if not attended and not handler.is_done(tdoc) %}
<li class="menu__item">
{% if handler.has_perm(perm.PERM_ATTEND_HOMEWORK) and handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if handler.hasPerm(perm.PERM_ATTEND_HOMEWORK) and handler.hasPerm(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 }}">
@@ -32,7 +32,7 @@
<span class="icon icon-add"></span> {{ _('Claim Homework') }}
</button>
</form>
{% elif not handler.has_perm(perm.PERM_LOGGEDIN) %}
{% elif not handler.hasPerm(perm.PERM_LOGGEDIN) %}
<a class="menu__link" href="javascript:showSignInDialog()">
<span class="icon icon-add"></span> {{ _('Login to Claim Homework') }}
</a>
@@ -52,12 +52,12 @@
<span class="icon icon-statistics"></span> {{ _('Scoreboard (Hidden)') }}
</a></li>
{% endif %}
{% if handler.own(tdoc, perm.PERM_EDIT_HOMEWORK_SELF) or handler.has_perm(perm.PERM_EDIT_HOMEWORK) %}
{% if handler.own(tdoc, perm.PERM_EDIT_HOMEWORK_SELF) or handler.hasPerm(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(perm.PERM_READ_RECORD_CODE) %}
{% if handler.hasPerm(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>
+7 -7
View File
@@ -11,27 +11,27 @@
<ol class="nav__list nav__list--main clearfix">
<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) %}
{% if handler.hasPerm(perm.PERM_VIEW_PROBLEM) %}
{{ nav_item('/p', 'problem_main', 'problem') }}
{% endif %}
{% if handler.has_perm(perm.PERM_VIEW_TRAINING) %}
{% if handler.hasPerm(perm.PERM_VIEW_TRAINING) %}
{{ nav_item('/t', 'training_main', 'training') }}
{% endif %}
{% if handler.has_perm(perm.PERM_VIEW_DISCUSSION) %}
{% if handler.hasPerm(perm.PERM_VIEW_DISCUSSION) %}
{{ nav_item('/d', 'discussion_main', 'discussion') }}
{% endif %}
{% if handler.has_perm(perm.PERM_VIEW_CONTEST) %}
{% if handler.hasPerm(perm.PERM_VIEW_CONTEST) %}
{{ nav_item('/c', 'contest_main', 'contest') }}
{% endif %}
{% if handler.has_perm(perm.PERM_VIEW_HOMEWORK) %}
{% if handler.hasPerm(perm.PERM_VIEW_HOMEWORK) %}
{{ nav_item('/h', 'homework_main', 'homework') }}
{% endif %}
{% if handler.has_perm(perm.PERM_EDIT_DESCRIPTION) or handler.has_perm(perm.PERM_EDIT_PERM) %}
{% if handler.hasPerm(perm.PERM_EDIT_DESCRIPTION) or handler.hasPerm(perm.PERM_EDIT_PERM) %}
{{ 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) %}
{% if not handler.hasPerm(perm.PERM_LOGGEDIN) %}
<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 %}
+3 -3
View File
@@ -8,7 +8,7 @@
{% else %}
<table class="data-table">
<colgroup>
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
<col class="col--status">
{% endif %}
<col class="col--name">
@@ -18,7 +18,7 @@
</colgroup>
<thead>
<tr>
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
<th class="col--status record-status--border">{{ _('Status') }}</th>
{% endif %}
<th class="col--name">{{ _('Problem') }}</th>
@@ -31,7 +31,7 @@
{% for pdoc in pdocs %}
{% set psdoc = psdict[pdoc['_id']] %}
<tr>
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if psdoc['rid'] %}
{{ record.render_status_td(psdoc, rid_key='rid') }}
{% else %}
@@ -28,7 +28,7 @@
<span class="icon icon-send"></span> {{ _('Open in Problem Set') }}
</a></li>
{% endif %}
{% if handler.own(pdoc, perm.PERM_EDIT_PROBLEM_SELF) or handler.has_perm(perm.PERM_EDIT_PROBLEM) %}
{% if handler.own(pdoc, perm.PERM_EDIT_PROBLEM_SELF) or handler.hasPerm(perm.PERM_EDIT_PROBLEM) %}
<li class="menu__seperator"></li>
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_edit' %} active{% endif %}" href="/p/{{ pdoc.pid }}/edit">
<span class="icon icon-edit"></span> {{ _('Edit') }}
@@ -28,7 +28,7 @@
<span class="icon icon-send"></span> {{ _('Open in Problem Set') }}
</a></li>
{% endif %}
{% if handler.own(pdoc, perm.PERM_EDIT_PROBLEM_SELF) or handler.has_perm(perm.PERM_EDIT_PROBLEM) %}
{% if handler.own(pdoc, perm.PERM_EDIT_PROBLEM_SELF) or handler.hasPerm(perm.PERM_EDIT_PROBLEM) %}
<li class="menu__seperator"></li>
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_edit' %} active{% endif %}" href="/p/{{ pdoc.pid }}/edit">
<span class="icon icon-edit"></span> {{ _('Edit') }}
+12 -12
View File
@@ -9,12 +9,12 @@
<div>
<ol class="menu">
{% if page_name == 'discussion_node' or page_name == 'discussion_detail' %}
{% if handler.has_perm(perm.PERM_CREATE_DISCUSSION) %}
{% 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']) }}">
<span class="icon icon-add"></span> {{ _('Create a Discussion') }}
</a></li>
{% else %}
{% if not handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if not handler.hasPerm(perm.PERM_LOGGEDIN) %}
<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 %}
@@ -25,7 +25,7 @@
<li class="menu__seperator"></li>
{% endif %}
{% if page_name == 'problem_detail' %}
{% if handler.has_perm(perm.PERM_SUBMIT_PROBLEM) %}
{% if handler.hasPerm(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>
@@ -38,11 +38,11 @@
<span class="icon icon-flag"></span> {{ _('View Problem') }}
</a></li>
{% endif %}
{% if handler.has_perm(perm.PERM_SUBMIT_PROBLEM) %}
{% 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">
<span class="icon icon-send"></span> {{ _('Submit') }}
</a></li>
{% elif not handler.has_perm(perm.PERM_LOGGEDIN) %}
{% elif not handler.hasPerm(perm.PERM_LOGGEDIN) %}
<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>
@@ -51,26 +51,26 @@
<span class="icon icon-send"></span> {{ _('No Permission to Submit') }}
</a></li>
{% endif %}
{% if handler.has_perm(perm.PERM_VIEW_DISCUSSION) or handler.has_perm(perm.PERM_VIEW_PROBLEM_SOLUTION) %}
{% if handler.hasPerm(perm.PERM_VIEW_DISCUSSION) or handler.hasPerm(perm.PERM_VIEW_PROBLEM_SOLUTION) %}
<li class="menu__seperator"></li>
{% endif %}
{% if handler.has_perm(perm.PERM_VIEW_DISCUSSION) %}
{% 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']) }}">
<span class="icon icon-comment--text"></span> {{ _('Discussions') }}
</a></li>
{% endif %}
{% if handler.has_perm(perm.PERM_VIEW_PROBLEM_SOLUTION) %}
{% 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">
<span class="icon icon-comment--text"></span> {{ _('Solutions') }}
</a></li>
{% endif %}
{% if page_name == 'problem_detail' and handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if page_name == 'problem_detail' and handler.hasPerm(perm.PERM_LOGGEDIN) %}
<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.has_perm(perm.PERM_EDIT_PROBLEM) %}
{% if user._id == pdoc.owner or handler.hasPerm(perm.PERM_EDIT_PROBLEM) %}
<li class="menu__seperator"></li>
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_edit' %} active{% endif %}" href="/p/{{ pdoc.pid }}/edit">
<span class="icon icon-edit"></span> {{ _('Edit') }}
@@ -94,7 +94,7 @@
<dd>{{ pdoc['_id'] }}</dd>
{% endif %}
{% if page_name != 'discussion_node' and page_name != 'discussion_detail' %}
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
<dt>{{ _('Submission') }}</dt>
<dd>
{% if pdoc['psdoc']['status'] %}
@@ -139,7 +139,7 @@
<dt>{{ _('# Submissions') }}</dt>
<dd><a href="/r?pid={{ pdoc['_id'] }}">{{ pdoc.nSubmit }}</a></dd>
{% if page_name != 'discussion_node' and page_name != 'discussion_detail' %}
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
<dt>{{ _('# My Submissions') }}</dt>
<dd><a href="/r?pid={{ pdoc['_id'] }}&uid_or_name={{ handler.user['_id'] }}">{{ pdoc['psdoc'].nSubmit|default(0) }}</a></dd>
{% endif %}
+1 -1
View File
@@ -60,7 +60,7 @@
</div>
</form>
</div>
{% if handler.has_perm(perm.PERM_CREATE_PROBLEM) %}
{% if handler.hasPerm(perm.PERM_CREATE_PROBLEM) %}
<div class="section side">
<div class="section__header">
<h1 class="section__title">{{ _('Create Problem') }}</h1>
+1 -1
View File
@@ -10,7 +10,7 @@
<div class="section__body">
<iframe src="/p/{{ pdoc.pid }}/upload" frameborder="0" style="width: 100%; height: 100px;"></iframe>
<p class="help-text">{{ _('Hint') }}: <a href="/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 (pdoc.owner == user._id or handler.has_perm(perm.PERM_READ_PROBLEM_DATA)) %}
{% if pdoc and (pdoc.owner == user._id or handler.hasPerm(perm.PERM_READ_PROBLEM_DATA)) %}
<p><a href="/p/{{ pdoc.pid }}/data" class="expanded button">{{ _('Download Dataset') }}</a></p>
{% endif %}
</div>
+2 -2
View File
@@ -28,7 +28,7 @@
<div class="section__header">
<h1 class="section__title">{{ _('Information') }}</h1>
</div>
{% if handler.has_perm(perm.PERM_REJUDGE) %}
{% if handler.hasPerm(perm.PERM_REJUDGE) %}
<div class="section__body no-padding">
<ol class="menu">
<li class="menu__item">
@@ -76,7 +76,7 @@
</dd>
{% endif %}{# tdoc['doc_type'] == vj4.model.document.TYPE_CONTEST #}
{% endif %}{# tdoc #}
{% if pdoc and (user._id == pdoc.owner or handler.has_perm(perm.PERM_READ_PROBLEM_DATA)) %}
{% if pdoc and (user._id == pdoc.owner or handler.hasPerm(perm.PERM_READ_PROBLEM_DATA)) %}
<dt>{{ _('Problem Data') }}</dt>
<dd><a href="/p/{{ pdoc.pid }}/data"><span class="icon icon-download"></span> {{ _('Download') }}</a></dd>
{% endif %}
+1 -1
View File
@@ -83,7 +83,7 @@
{% endfor %}
</tbody>
</table>
{% if handler.has_perm(perm.PERM_VIEW_JUDGE_STATISTICS) %}
{% if handler.hasPerm(perm.PERM_VIEW_JUDGE_STATISTICS) %}
<ul class="pager">
<li>
<a class="pager__item next link" href="?start={{ rdocs[-1]['_id'] }}&{{ query_string }}">{{ _('pager_next') }}</a>
+2 -2
View File
@@ -3,7 +3,7 @@
<tr data-rid="{{ rdoc['_id'] }}">
{{ record.render_status_td(rdoc) }}
<td class="col--problem col--problem-name">
{% if handler.has_perm(perm.PERM_REJUDGE) %}
{% if handler.hasPerm(perm.PERM_REJUDGE) %}
<form class="form--inline" method="post" action="/r/{{ rdoc._id }}/rejudge">
<input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
<button type="submit" class="link text-maroon lighter">
@@ -12,7 +12,7 @@
</button> |
</form>
{% endif %}
{% if pdoc and (not pdoc.hidden or handler.has_perm(perm.PERM_VIEW_PROBLEM_HIDDEN)) %}
{% if pdoc and (not pdoc.hidden or handler.hasPerm(perm.PERM_VIEW_PROBLEM_HIDDEN)) %}
{{ problem.render_problem_title(pdoc, show_tags=false) }}
{% else %}
*
+7 -7
View File
@@ -79,7 +79,7 @@
<div class="section__body no-padding training__problems">
<table class="data-table">
<colgroup>
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
<col class="col--status">
{% endif %}
<col class="col--name">
@@ -89,7 +89,7 @@
</colgroup>
<thead>
<tr>
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
<th class="col--status record-status--border">{{ _('Status') }}</th>
{% endif %}
<th class="col--name">{{ _('Problem') }}</th>
@@ -103,7 +103,7 @@
{% if pid in pdict %}
{% with pdoc=pdict[pid], psdoc=psdict[pid] %}
<tr>
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if psdoc['rid'] %}
{{ record.render_status_td(psdoc, rid_key='rid') }}
{% else %}
@@ -111,7 +111,7 @@
{% endif %}
{% endif %}
<td class="col--name col--problem-name">
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
<form class="form--inline" action="{{ reverse_url('problem_main') }}" method="post">
<input type="hidden" name="pid" value="{{ pdoc['_id'] }}">
<input type="hidden" name="operation" value="{% if not psdoc['star'] %}star{% else %}unstar{% endif %}">
@@ -164,7 +164,7 @@
<div class="section side">
<div>
<ol class="menu">
{% if not tsdoc['enroll'] and handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if not tsdoc['enroll'] and handler.hasPerm(perm.PERM_LOGGEDIN) %}
<li class="menu__item">
<form action="" method="POST">
<input type="hidden" name="operation" value="enroll">
@@ -175,7 +175,7 @@
</form>
</li>
{% endif %}
{% if handler.own(tdoc, perm.PERM_EDIT_TRAINING_SELF) or handler.has_perm(perm.PERM_EDIT_TRAINING) %}
{% if handler.own(tdoc, perm.PERM_EDIT_TRAINING_SELF) or handler.hasPerm(perm.PERM_EDIT_TRAINING) %}
<li class="menu__item"><a class="menu__link" href="{{ reverse_url('training_edit', tid=tdoc['doc_id']) }}">
<span class="icon icon-edit"></span> {{ _('Edit') }}
</a></li>
@@ -188,7 +188,7 @@
</div>
<div class="section__body typo">
<dl class="large horizontal">
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
<dt>{{ _('Status') }}</dt><dd>{% if tsdoc['enroll'] %}{{ _('Completed' if tsdoc['done'] else 'In Progress') }}{% else %}{{ _('Not Enrolled') }}{% endif %}</dd>
{% endif %}
{% if tsdoc['enroll'] %}
+3 -3
View File
@@ -37,7 +37,7 @@
<span class="icon training-status--icon done"></span>
<span class="training-status--text done">{{ _('Completed') }} 100%</span>
{% endif %}
{% elif handler.has_perm(perm.PERM_LOGGEDIN) %}
{% elif handler.hasPerm(perm.PERM_LOGGEDIN) %}
<span class="icon training-status--icon outside"></span> <span class="training-status--text outside">{{ _('Not Enrolled') }}</span>
{% endif %}
</li>
@@ -52,7 +52,7 @@
</div>
</div>
<div class="large-3 columns">
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
<div class="section side">
<div class="section__header">
<h1 class="section__title">{{ _('Enrolled') }}</h1>
@@ -76,7 +76,7 @@
</div>
</div>
{% endif %}
{% if handler.has_perm(perm.PERM_CREATE_TRAINING) %}
{% if handler.hasPerm(perm.PERM_CREATE_TRAINING) %}
<div class="section side">
<div class="section__header">
<h1 class="section__title">{{ _('Create Training Plan') }}</h1>
+72 -4
View File
@@ -5,7 +5,7 @@
<div class="row">
<div class="medium-9 columns">
<div class="section">
<div class="profile-header user-profile-bg--{{ udoc.background_img }}">
<div class="profile-header user-profile-bg--{{ udoc.background_img or 1 }}">
<div class="profile-header__content">
<div class="media">
<div class="media__left">
@@ -58,7 +58,7 @@
{{ builtin.USER_GENDER_ICONS[udoc.gender] }}
</span>
{% endif %}
{% if handler.has_perm(perm.PERM_MOD_BADGE) %}
{% if handler.hasPerm(perm.PERM_MOD_BADGE) %}
<span
class="profile-header__contact-item user-profile-badge badge--mod"
data-tooltip="{{ _('{0} is a moderator of this domain.').format(_('She' if udoc.gender == 1 else 'He')) }}"
@@ -74,14 +74,82 @@
<div class="profile-content">
<div class="section__tab-container immersive">
<ul class="section__tabs">
{{ udoc.bio|markdown|safe }}
<li class="section__tab-item">
<h1 class="section__tab-title">{{ _('Bio') }}</h1>
<div class="section__tab-main">
{% if not udoc.bio %}
{{ nothing.render("This person is lazy and didn't wrote anything.") }}
{% else %}
{{ udoc.bio|markdown|safe }}
{% endif %}
</div>
</li>
<li class="section__tab-item">
<h1 class="section__tab-title">{{ _('Contributions') }} ({{ pcount }})</h1>
<div class="section__tab-main">
{% if not pdocs %}
{{ nothing.render("Oh, the user doesn't have any contributions!") }}
{% else %}
<div class="section__header">
<h1 class="section__title">{{ _('Contributed Problems') }}</h1>
</div>
<div class="section__body">
{% for pdoc in pdocs %}
<p><a href="/p/{{pdoc.pid}}">{{ pdoc['title'] }}</a></p>
{% endfor %}
</div>
{% endif %}
</div>
</li>
<li class="section__tab-item">
<h1 class="section__tab-title">{{ _('Submissions') }} ({{ udoc['nSubmit']|default(0) }})</h1>
<div class="section__tab-main">
{% if not rdocs %}
{{ nothing.render("Oh, the user hasn't submitted yet!") }}
{% else %}
<div class="section__header">
<h1 class="section__title">{{ _('Recent Submissions') }}</h1>
</div>
<div class="section__body no-padding">
<table class="data-table record_main__table">
<colgroup>
<col class="col--status">
<col class="col--problem">
<col class="col--submit-by">
<col class="col--time">
<col class="col--memory">
<col class="col--lang">
<col class="col--submit-at">
</colgroup>
<thead>
<tr>
<th class="col--status record-status--border">{{ _('Status') }}</th>
<th class="col--problem">{{ _('Problem') }}</th>
<th class="col--submit-by">{{ _('Submit By') }}</th>
<th class="col--time">{{ _('Time') }}</th>
<th class="col--memory">{{ _('Memory') }}</th>
<th class="col--lang">{{ _('Language') }}</th>
<th class="col--submit-at">{{ _('Submit At') }}</th>
</tr>
</thead>
<tbody>
{% for rdoc in rdocs %}
{% set pdoc = pdict[rdoc.pid] %}
{% include 'record_main_tr.html' %}
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="medium-3 columns">
{% if is_self_profile %}
{% if isSelfProfile %}
{{ home.render_sidebar() }}
{% endif %}
<div class="section side">