templates

This commit is contained in:
masnn committed 2020-04-03 18:52:20 +08:00
1 parent d5b1f623f8
commit 7fa4a58abe
112 files changed
+5726

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
{% macro render(
view, docs, udict,
comment_ref,
reply_ref,
comment_post_perm,
comment_edit_perm,
comment_edit_self_perm,
comment_delete_perm,
comment_delete_self_perm,
reply_post_perm,
reply_edit_perm,
reply_edit_self_perm,
reply_delete_perm,
reply_delete_self_perm,
comment_placeholder = 'Write Your Comment',
comment_post_op = 'reply',
comment_edit_op = 'edit_reply',
comment_post_text = 'Comment',
comment_edit_text = 'Update',
reply_post_op = 'tail_reply',
reply_post_text = 'Reply',
reply_edit_op = 'edit_tail_reply',
reply_edit_text = 'Update',
comment_delete_op = 'delete_reply',
reply_delete_op = 'delete_tail_reply'
) %}
{% import "components/comments_base.html" as comment_base with context %}
{% import "components/comments_"~view~".html" as comment_impl with context %}
<ul class="dczcomments__list view--{{ view }}">
{% if handler.has_perm(comment_post_perm) %}
{{ comment_impl.comment(true, handler.user) }}
{% endif %}
{% for doc in docs %}
{{ comment_impl.comment(false, udict[doc['owner_uid']], doc) }}
{% endfor %}
</ul>
{% endmacro %}
+46
View File
@@ -0,0 +1,46 @@
{% macro comment_form() %}
<div class="hasjs--hide">
<form method="post" class="dczcomments__box" name="dczcomments__box__form" data-hotkey="ctrl+enter:submit,esc:vjCommentBoxCancel">
<div>
<textarea name="content" class="textbox" data-markdown required></textarea>
</div>
<div>
<input type="submit" class="rounded primary button dczcomments__box__submit" value="{{ _(comment_post_text) }} (Ctrl+Enter)" data-value-reply="{{ _(reply_post_text) }} (Ctrl+Enter)" data-value-comment="{{ _(comment_post_text) }} (Ctrl+Enter)" data-value-comment-update="{{ _(comment_edit_text) }} (Ctrl+Enter)" data-value-reply-update="{{ _(reply_edit_text) }} (Ctrl+Enter)">
<input type="button" class="rounded button nojs--hide" name="dczcomments__box__cancel" value="{{ _('Cancel') }} (Esc)">
</div>
<input type="hidden" name="operation" value="{{ comment_post_op }}">
<input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
</form>
</div>
<div class="nojs--hide">
<textarea class="textbox" name="dczcomments__dummy-box" readonly data-form="{{ {"operation": comment_post_op}|json }}" placeholder="{{ _(comment_placeholder) }}"></textarea>
</div>
{% endmacro %}
{% macro comment_operations(doc) %}
<div class="dczcomments__operations nojs--hide">
{% if handler.has_perm(reply_post_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Reply') }}" name="dczcomments__op-reply-comment" data-form="{{ {'operation': reply_post_op, comment_ref: doc['doc_id']}|json }}"><span class="icon icon-reply"></span></a>
{% endif %}
{% if handler.own(doc, comment_edit_self_perm) or handler.has_perm(comment_edit_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Edit') }}" name="dczcomments__op-edit-comment" data-form="{{ {'operation': comment_edit_op, comment_ref: doc['doc_id']}|json }}"><span class="icon icon-edit"></span></a>
{% endif %}
{% if handler.own(doc, comment_delete_self_perm) or handler.has_perm(comment_delete_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Delete') }}" name="dczcomments__op-delete-comment" data-form="{{ {'operation': comment_delete_op, comment_ref: doc['doc_id']}|json }}"><span class="icon icon-delete"></span></a>
{% endif %}
</div>
{% endmacro %}
{% macro reply_operations(doc, rdoc) %}
<div class="dczcomments__operations nojs--hide">
{% if handler.has_perm(reply_post_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Reply') }}" name="dczcomments__op-reply-reply"><span class="icon icon-reply"></span></a>
{% endif %}
{% if handler.own(rdoc, reply_edit_self_perm) or handler.has_perm(reply_edit_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Edit') }}" name="dczcomments__op-edit-reply" data-form="{{ {'operation': reply_edit_op, comment_ref: doc['doc_id'], reply_ref: rdoc['_id']}|json }}"><span class="icon icon-edit"></span></a>
{% endif %}
{% if handler.own(rdoc, reply_delete_self_perm) or handler.has_perm(reply_delete_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Delete') }}" name="dczcomments__op-delete-reply" data-form="{{ {'operation': reply_delete_op, comment_ref: doc['doc_id'], reply_ref: rdoc['_id']}|json }}"><span class="icon icon-delete"></span></a>
{% endif %}
</div>
{% endmacro %}
@@ -0,0 +1,63 @@
{% import "components/user.html" as user with context %}
{% macro reply(mode_create, udoc, doc = {}, rdoc = {}) %}
<li class="dczcomments__reply{% if mode_create %} commentbox-container{% endif %}">
<div class="media">
<div class="media__left top">
<img src="{{ udoc['gravatar']|gravatar_url }}" width="50" height="50" class="medium user-profile-avatar">
</div>
<div class="media__body top no-heading">
{% if not mode_create %}
<div class="clearfix">
<div class="supplementary dczcomments__supplementary">
{{ user.render_inline(udoc, dudict[udoc['_id']], avatar=false) }}
@ {{ datetime_span(rdoc['_id'].generation_time) }}
</div>
{{ comment_base.reply_operations(doc, rdoc) }}
</div>
<div class="typo" data-emoji-enabled data-raw-url="{{ reverse_url('discussion_tail_reply_raw', did=doc['parent_doc_id'], drid=doc['doc_id'], drrid=rdoc['_id']) }}">
{{ rdoc['content']|markdown }}
</div>
<div class="commentbox-edit-target"></div>
{% else %}
<div class="commentbox-placeholder"></div>
{% endif %}
</div>
</div>
</li>
{% endmacro %}
{% macro comment(mode_create, udoc, doc = {}) %}
<li class="dczcomments__item">
<div class="media">
<div class="media__left top">
<img src="{{ udoc['gravatar']|gravatar_url }}" width="60" height="60" class="medium user-profile-avatar">
</div>
<div class="media__body top no-heading">
{% if not mode_create %}
<div class="clearfix">
<div class="supplementary dczcomments__supplementary">
{{ user.render_inline(udoc, dudict[udoc['_id']], avatar=false) }}
@ {{ datetime_span(doc['_id'].generation_time) }}
</div>
{{ comment_base.comment_operations(doc) }}
</div>
<div class="typo" data-emoji-enabled data-raw-url="{{ reverse_url('discussion_reply_raw', did=doc['parent_doc_id'], drid=doc['doc_id']) }}">
{{ doc['content']|markdown }}
</div>
<div class="commentbox-edit-target"></div>
<ul class="dczcomments__replies commentbox-reply-target">
{% for rdoc in doc['reply'] %}
{{ reply(mode_create, udict[rdoc['owner_uid']], doc, rdoc) }}
{% endfor %}
</ul>
{% else %}
{{ comment_base.comment_form() }}
<div class="commentbox-placeholder"></div>
<ul style="display:none">
{{ reply(mode_create, udoc) }}
</ul>
{% endif %}
</div>
</div>
</li>
{% endmacro %}
@@ -0,0 +1,96 @@
{% import "components/user.html" as user with context %}
{% macro reply(mode_create, udoc, doc = {}, rdoc = {}) %}
<li class="dczcomments__reply{% if mode_create %} commentbox-container{% endif %}">
<div class="media">
<div class="media__body top no-heading">
{% if not mode_create %}
<div class="clearfix">
<div class="supplementary dczcomments__supplementary">
{{ user.render_inline(udoc, badge=false) }}
@ {{ datetime_span(rdoc['_id'].generation_time) }}
</div>
{{ comment_base.reply_operations(doc, rdoc) }}
</div>
<div class="typo" data-emoji-enabled data-raw-url="{{ reverse_url('problem_solution_reply_raw', pid=doc['parent_doc_id'], psid=doc['doc_id'], psrid=rdoc['_id']) }}">
{{ rdoc['content']|markdown }}
</div>
<div class="commentbox-edit-target"></div>
{% else %}
<div class="clearfix">
<div class="supplementary dczcomments__supplementary">
{{ user.render_inline(udoc, badge=false) }}
</div>
</div>
<div class="commentbox-placeholder"></div>
{% endif %}
</div>
</div>
</li>
{% endmacro %}
{% macro comment(mode_create, udoc, doc = {}) %}
<li class="dczcomments__item">
<div class="media">
<div class="media__left top">
{% if not mode_create %}
<div class="vote vote--discussion">
{% if handler.has_perm(vj4.model.builtin.PERM_VOTE_PROBLEM_SOLUTION) %}
<div class="vote-number rotator--enabled">{{ doc['vote'] }}</div>
<div class="vote-op clearfix">
<form method="post">
<input type="hidden" name="operation" value="upvote">
<input type="hidden" name="psid" value="{{ doc['doc_id'] }}">
<input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
<button type="submit" class="vote-button upvote{% if pssdict[doc['doc_id']]['vote'] == 1 %} active{% endif %}" data-tooltip="{{ _('Upvote') }}" data-tooltip-pos="bottom center" aria-label="{{ _('Upvote') }}"><span class="icon icon-vote--up"></span></button>
</form>
<form method="post">
<input type="hidden" name="operation" value="downvote">
<input type="hidden" name="psid" value="{{ doc['doc_id'] }}">
<input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
<button type="submit" class="vote-button downvote{% if pssdict[doc['doc_id']]['vote'] == -1 %} active{% endif %}" data-tooltip="{{ _('Downvote') }}" data-tooltip-pos="bottom center" aria-label="{{ _('Downvote') }}"><span class="icon icon-vote--down"></span></button>
</form>
</div>
{% else %}
<div class="vote-number">{{ doc['vote'] }}</div>
{% endif %}
</div>
{% else %}
<div class="vote vote--discussion">
<div class="vote-number">0</div>
</div>
{% endif %}
</div>
<div class="media__body top no-heading">
{% if not mode_create %}
<div class="clearfix">
<div class="supplementary dczcomments__supplementary">
{{ user.render_inline(udoc, dudict[udoc['_id']]) }}
@ {{ datetime_span(doc['_id'].generation_time) }}
</div>
{{ comment_base.comment_operations(doc) }}
</div>
<div class="typo" data-emoji-enabled data-raw-url="{{ reverse_url('problem_solution_raw', pid=doc['parent_doc_id'], psid=doc['doc_id']) }}">
{{ doc['content']|markdown }}
</div>
<div class="commentbox-edit-target"></div>
<ul class="dczcomments__replies commentbox-reply-target">
{% for rdoc in doc['reply'] %}
{{ reply(mode_create, udict[rdoc['owner_uid']], doc, rdoc) }}
{% endfor %}
</ul>
{% else %}
<div class="clearfix">
<div class="supplementary dczcomments__supplementary">
{{ user.render_inline(udoc, dudict[udoc['_id']]) }}
</div>
</div>
{{ comment_base.comment_form() }}
<div class="commentbox-placeholder"></div>
<ul style="display:none">
{{ reply(mode_create, udoc) }}
</ul>
{% endif %}
</div>
</div>
</li>
{% endmacro %}
+8
View File
@@ -0,0 +1,8 @@
{% import "components/user.html" as user with context %}
{% macro render_time(tdoc_time) %}
{{ datetime_span(tdoc_time, false, '%Y-%m-%d %H:%M') }}
{% endmacro %}
{% macro render_duration(tdoc) %}
{{ ((tdoc['end_at'] - tdoc['begin_at']).total_seconds() / 3600)|round(1) }}
{% endmacro %}
+201
View File
@@ -0,0 +1,201 @@
{% macro form_begin() %}
{% 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() %}
{% 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) %}
{% 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) %}
{% set extra_class = kwargs.pop('extra_class', none) %}
class="{{ container_class }}{% if extra_class %} {{ extra_class }}{% endif %}"
{% endmacro %}
{% macro select(options, name='', value='') %}
<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=columns, **kwargs) }}
{{ select(columns=columns, **kwargs) }}
{{ form_end(columns=columns, **kwargs) }}
{% endmacro %}
{% macro radio(options, name='', value='') %}
<div
name="form_item_{{ name }}"
{{ container_attr('radiobox-container', **kwargs) }}
>
{% for k, v in options %}
<label class="radiobox">
<input
value="{{ k }}"
type="radio"
name="{{ name }}"
{{ form_attr('radiobox__input', **kwargs) }}
{% if value == k %} checked{% endif %}
/> {{ _(v) }}
</label>
{% endfor %}
</div>
{% endmacro %}
{% macro form_radio(columns=5) %}
{{ form_begin(columns=columns, label_wrap=false, **kwargs) }}
{{ radio(columns=columns, **kwargs) }}
{{ form_end(columns=columns, label_wrap=false, **kwargs) }}
{% endmacro %}
{% macro image_radio(options, name='', value='', image_class='') %}
<div
name="form_item_{{ name }}"
{{ container_attr('radiobox-container with-image', **kwargs) }}
>
{% for k, v in options %}
<label class="radiobox with-image">
<input
value="{{ k }}"
type="radio"
name="{{ name }}"
{{ form_attr('radiobox__input', **kwargs) }}
{% if value == k %} checked{% endif %}
/>
<div class="radiobox__image-container" data-tooltip="{{ _(v) }}">
<div class="radiobox__image {{ image_class.format(k) }}"></div>
</div>
</label>
{% endfor %}
</div>
{% endmacro %}
{% macro form_image_radio(columns=8) %}
{{ form_begin(columns=columns, label_wrap=false, **kwargs) }}
{{ image_radio(columns=columns, **kwargs) }}
{{ form_end(columns=columns, label_wrap=false, **kwargs) }}
{% endmacro %}
{% macro text(name='', value='', placeholder='', type='text') %}
<div
name="form_item_{{ name }}"
{{ container_attr('textbox-container', **kwargs) }}
>
<input
type="{{ type }}"
name="{{ name }}"
value="{{ value }}"
placeholder="{{ placeholder }}"
{{ form_attr('textbox', **kwargs) }}
>
</div>
{% endmacro %}
{% macro form_text(columns=5) %}
{{ form_begin(columns=columns, **kwargs) }}
{{ text(columns=columns, **kwargs) }}
{{ form_end(columns=columns, **kwargs) }}
{% endmacro %}
{% macro textarea(name='', value='', placeholder='') %}
{% set markdown = kwargs.pop('markdown', false) %}
<div
name="form_item_{{ name }}"
{{ container_attr('textarea-container', **kwargs) }}
>
<textarea
name="{{ name }}"
placeholder="{{ placeholder }}"
{% if markdown %}data-markdown{% endif %}
{{ form_attr('textbox', **kwargs) }}
>{{ value }}</textarea>
</div>
{% endmacro %}
{% macro form_textarea(columns=8) %}
{{ form_begin(columns=columns, **kwargs) }}
{{ textarea(columns=columns, **kwargs) }}
{{ form_end(columns=columns, **kwargs) }}
{% endmacro %}
{% macro checkbox(label='', name='', value=false) %}
<div
name="form_item_{{ name }}"
{{ container_attr('checkbox-container', **kwargs) }}
>
<label class="checkbox">
<input type="checkbox" name="{{ name }}"{% if value %} checked{% endif %}
{{ form_attr('checkbox', **kwargs) }}
>{{ _(label) }}
</label>
</div>
{% endmacro %}
{% macro form_checkbox(columns=5) %}
{{ form_begin(columns=columns, no_label=True, **kwargs) }}
{{ checkbox(columns=columns, **kwargs) }}
{{ form_end(columns=columns, no_label=True, **kwargs) }}
{% endmacro %}
+17
View File
@@ -0,0 +1,17 @@
{% import "components/sidemenu.html" as sidemenu with context %}
{% macro render_sidebar() %}
<div class="section side">
<ol class="menu">
{{ sidemenu.render_item('account--circle', 'user_detail', label='My Profile', uid=handler.user['_id']) }}
{{ sidemenu.render_item('comment--multiple', 'home_messages') }}
<li class="menu__seperator"></li>
{{ sidemenu.render_item('wrench', 'home_account') }}
{{ sidemenu.render_item('web', 'home_domain_account', label='@ '+handler.domain['name']) }}
{{ sidemenu.render_item('sliders', 'home_preference') }}
{{ sidemenu.render_item('security', 'home_security') }}
<li class="menu__seperator"></li>
{{ sidemenu.render_item('file', 'home_file') }}
{{ sidemenu.render_item('web', 'home_domain') }}
</ol>
</div>
{% endmacro %}
+8
View File
@@ -0,0 +1,8 @@
{% import "components/user.html" as user with context %}
{% macro render_time(tdoc_time) %}
{{ datetime_span(tdoc_time, false, '%Y-%m-%d %H:%M') }}
{% endmacro %}
{% macro render_extension(tdoc) %}
{{ ((tdoc['end_at'] - tdoc['penalty_since']).total_seconds() / 3600)|round(1) }}
{% endmacro %}
+29
View File
@@ -0,0 +1,29 @@
<div class="section side">
<div class="section__body typo">
<dl>
<dt>{{ _('Inline codes') }}</dt>
<dd><pre>`std::cout()`</pre></dd>
<dt>{{ _('Code blocks') }}</dt>
<dd>
<pre>```c++
int main() {
return 0;
}
```</pre>
</dd>
<dt>{{ _('Inline formulas') }}</dt>
<dd><pre>$ E=mc^2 $</pre></dd>
<dt>{{ _('Formula blocks') }}</dt>
<dd><pre>$$ E=mc^2 $$</pre></dd>
<dt>{{ _('Links') }}</dt>
<dd><pre>[{{ _('Text') }}](http://...)</pre></dd>
<dt>{{ _('Images') }}</dt>
<dd><pre>![{{ _('Description') }}](http://...)</pre></dd>
</dl>
<h2>{{ _('Learn More') }}</h2>
<ul>
<li><a href="http://commonmark.org/help/" target="_blank"><span class="icon icon-link--external"></span> {{ _('CommonMark Syntax') }}</a></li>
<li><a href="http://www.onemathematicalcat.org/MathJaxDocumentation/TeXSyntax.htm" target="_blank"><span class="icon icon-link--external"></span> {{ _('LaTeX Expressions') }}</a></li>
</ul>
</div>
</div>
+7
View File
@@ -0,0 +1,7 @@
{% macro render() %}
<noscript><div class="section__body no-padding">
<blockquote class="warn">
<p>{{ _('This page needs JavaScript to work.') }}</p>
</blockquote>
</div></noscript>
{% endmacro %}
+6
View File
@@ -0,0 +1,6 @@
{% macro render(text, compact=false) %}
<div class="nothing-placeholder{% if compact %} compact{% endif %}">
<div class="nothing-icon"></div>
{{ _(text) }}
</div>
{% endmacro %}
+25
View File
@@ -0,0 +1,25 @@
{% macro render(page, num_pages, add_qs='') %}
{% if num_pages > 0 %}
<ul class="pager">
{% for type, page0 in paginate(page, num_pages) %}
<li>
{% if type == 'first' %}
<a class="pager__item first link" href="?page={{ page0 }}{% if add_qs %}&{{ add_qs }}{% endif %}">{{ _('pager_first') }}</a>
{% elif type == 'previous' %}
<a class="pager__item previous link" href="?page={{ page0 }}{% if add_qs %}&{{ add_qs }}{% endif %}">{{ _('pager_previous') }}</a>
{% elif type == 'ellipsis' %}
<span class="pager__item ellipsis">...</span>
{% elif type == 'page' %}
<a class="pager__item page link" href="?page={{ page0 }}{% if add_qs %}&{{ add_qs }}{% endif %}">{{ page0 }}</a>
{% elif type == 'current' %}
<span class="pager__item current">{{ page0 }}</span>
{% elif type == 'next' %}
<a class="pager__item next link" href="?page={{ page0 }}{% if add_qs %}&{{ add_qs }}{% endif %}">{{ _('pager_next') }}</a>
{% elif type == 'last' %}
<a class="pager__item last link" href="?page={{ page0 }}{% if add_qs %}&{{ add_qs }}{% endif %}">{{ _('pager_last') }}</a>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
{% endmacro %}
+40
View File
@@ -0,0 +1,40 @@
{% macro render_problem_title(pdoc, tdoc=none, show_tags=true, show_invisible_flag=true, rp=none, invalid=false) %}
{%- if not invalid %}
<a
{%- if tdoc is none %}
href="{{ reverse_url('problem_detail', domain_id=pdoc['domain_id'], pid=pdoc['doc_id']) }}"
{%- 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']) }}"
{%- 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']) }}"
{%- endif %}
>
{%- endif %}
{% if pdoc['doc_id']|string|length < 10 %}P{{ pdoc['doc_id'] }} {% endif %}{{ pdoc['title'] }}
{%- if not invalid %}
</a>
{%- endif %}
{%- if pdoc['hidden'] and show_invisible_flag %}
<span class="text-orange">({{ _('Hidden') }})</span>
{%- endif %}
{%- if not rp is none %}
<span class="problem__rp-tag">RP+{{ rp|round|int }}</span>
{%- endif %}
{%- if show_tags %}
{{ render_problem_tags(pdoc) }}
{%- endif %}
{% endmacro %}
{% macro render_problem_tags(pdoc, show_none_label=false) %}
{%- if pdoc['tag']|length > 0 %}
<ul class="problem__tags">
{%- for tag in pdoc['tag'] %}
<li class="problem__tag"><a class="problem__tag-link" href="{{ reverse_url('problem_category', category=tag) }}">{{ tag }}</a></li>
{%- endfor %}
</ul>
{%- else %}
{%- if show_none_label %}
{{ _('(None)') }}
{%- endif %}
{%- endif %}
{% endmacro %}
+15
View File
@@ -0,0 +1,15 @@
{% macro render_status_td(rdoc, rid_key='_id') %}
<td class="col--status record-status--border {{ vj4.constant.record.STATUS_CODES[rdoc['status']] }}">
<div class="col--status__text">
<span class="icon record-status--icon {{ vj4.constant.record.STATUS_CODES[rdoc['status']] }}"></span>
<a href="{{ reverse_url('record_detail', rid=rdoc[rid_key], domain_id=rdoc['domain_id']) }}" class="record-status--text {{ vj4.constant.record.STATUS_CODES[rdoc['status']] }}">
{{ vj4.constant.record.STATUS_TEXTS[rdoc['status']] }}
</a>
</div>
{% if rdoc['status'] == vj4.constant.record.STATUS_JUDGING %}
<div class="col--status__progress-container">
<div class="col--status__progress" style="width: {{ rdoc['progress']|default(50)|int }}%"></div>
</div>
{% endif %}
</td>
{% endmacro %}
+15
View File
@@ -0,0 +1,15 @@
{% macro render_item(icon_name, page_name, label=none) %}
<li class="menu__item" id="menu-item-{{ page_name }}">
{% set target_url = reverse_url(page_name, **kwargs) %}
<a href="{{ target_url }}" class="menu__link{% if handler.request.path_qs == target_url %} active{% endif %}">
{% if icon_name %}
<span class="icon icon-{{ icon_name }}"></span>
{% endif %}
{% if label %}
{{ _(label) }}
{% else %}
{{ _(page_name) }}
{% endif %}
</a>
</li>
{% endmacro %}
+26
View File
@@ -0,0 +1,26 @@
{% macro render_inline(
udoc,
dudoc={},
avatar=true,
badge=true,
modbadge=true
) %}
<span class="user-profile-link">
{% if avatar %}
<img class="small user-profile-avatar v-center" src="{{ udoc['gravatar']|default('')|gravatar_url }}" width="20" height="20">
{% endif %}
<a class="user-profile-name" href="{{ reverse_url('user_detail', uid=udoc['_id']|default(0)) }}">
{% if dudoc['display_name'] %}
{{ dudoc['display_name'] }} ({{ udoc['uname'] }})
{% else %}
{{ udoc['uname'] }}
{% endif %}
</a>
{% if badge %}
<a class="user-profile-badge v-center badge--lv{{ dudoc['level']|default(0) }}" href="{{ reverse_url('user_detail', uid=udoc['_id']|default(0)) }}" title="LV {{ dudoc['level']|default(0) }}: Top {{ vj4.model.builtin.LEVELS[dudoc['level']|default(0)]|default('N/A') }}%">LV {{ dudoc['level']|default(0) }}</a>
{% if modbadge and handler.dudoc_has_perm(udoc, dudoc, vj4.model.builtin.PERM_MOD_BADGE) %}
<span class="user-profile-badge v-center badge--mod" title="Moderator">MOD</span>
{% endif %}
{% endif %}
</span>
{% endmacro %}