mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
题解功能
This commit is contained in:
1 parent
ec727d58aa
commit
41261f8c4b
20 files changed
+825
-1277
No files matched your search
@@ -1,37 +0,0 @@
|
||||
{% 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 %}
|
||||
@@ -1,46 +0,0 @@
|
||||
{% 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 %}
|
||||
@@ -9,13 +9,13 @@
|
||||
{% 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'].generationTime) }}
|
||||
{{ user.render_inline(udoc, avatar=false) }}
|
||||
@ {{ datetime_span(rdoc['_id'])|safe }}
|
||||
</div>
|
||||
{{ comment_base.reply_operations(doc, rdoc) }}
|
||||
{{ 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 }}
|
||||
{{ rdoc['content']|markdown|safe }}
|
||||
</div>
|
||||
<div class="commentbox-edit-target"></div>
|
||||
{% else %}
|
||||
@@ -26,38 +26,129 @@
|
||||
</li>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro comment(mode_create, udoc, doc = {}) %}
|
||||
{% 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._id}}"}"
|
||||
><span class="icon icon-reply"></span></a>
|
||||
{% endif %}
|
||||
{% if doc.owner == handler.state.user._id 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._id}}"}"
|
||||
><span class="icon icon-edit"></span></a>
|
||||
{% endif %}
|
||||
{% if doc.owner == handler.state.user._id 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._id}}"}"
|
||||
><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 doc.owner == handler.state.user._id 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._id}}","{{reply_ref}}":"{{rdoc._id}}"}"
|
||||
><span class="icon icon-edit"></span></a>
|
||||
{% endif %}
|
||||
{% if doc.owner == handler.state.user._id 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._id}}","{{reply_ref}}":"{{rdoc._id}}"}"
|
||||
><span class="icon icon-delete"></span></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% 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'
|
||||
) %}
|
||||
<ul class="dczcomments__list view--discussion">
|
||||
{% if handler.has_perm(comment_post_perm) %}
|
||||
<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="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}}"}" placeholder="{{ _(comment_placeholder) }}"></textarea>
|
||||
</div>
|
||||
<div class="commentbox-placeholder"></div>
|
||||
<ul style="display:none">
|
||||
{{ reply(true, udoc) }}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% for doc in docs %}
|
||||
{% set udoc = udict[doc.owner] %}
|
||||
<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">
|
||||
<div class="clearfix">
|
||||
<div class="supplementary dczcomments__supplementary">
|
||||
{{ user.render_inline(udoc, dudict[udoc['_id']], avatar=false) }}
|
||||
@ {{ datetime_span(doc['_id'].generationTime) }}
|
||||
{{ user.render_inline(udoc, avatar=false) }}
|
||||
@ {{ datetime_span(doc['_id'])|safe }}
|
||||
</div>
|
||||
{{ comment_base.comment_operations(doc) }}
|
||||
{{ 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 }}
|
||||
{{ doc['content']|markdown|safe }}
|
||||
</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) }}
|
||||
{{ reply(mode_create, udict[rdoc['owner']], 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>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endmacro %}
|
||||
@@ -1,96 +1,177 @@
|
||||
{% 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'].generationTime) }}
|
||||
</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 = {}) %}
|
||||
{% 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'
|
||||
) %}
|
||||
<ul class="dczcomments__list view--solution">
|
||||
{% if handler.has_perm(comment_post_perm) %}
|
||||
<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(perm.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'].generationTime) }}
|
||||
{{ user.render_inline(udoc) }}
|
||||
</div>
|
||||
</div>
|
||||
<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}}"}" placeholder="{{ _(comment_placeholder) }}"></textarea>
|
||||
</div>
|
||||
<div class="commentbox-placeholder"></div>
|
||||
<ul style="display:none">
|
||||
<li class="dczcomments__reply commentbox-container">
|
||||
<div class="media">
|
||||
<div class="media__body top no-heading">
|
||||
<div class="clearfix">
|
||||
<div class="supplementary dczcomments__supplementary">
|
||||
{{ user.render_inline(udoc, badge=false) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="commentbox-placeholder"></div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% for doc in docs %}
|
||||
{% set udoc = udict[doc.owner] %}
|
||||
<li class="dczcomments__item">
|
||||
<div class="media">
|
||||
<div class="media__left top">
|
||||
<div class="vote vote--discussion">
|
||||
{% if handler.has_perm(perm.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._id }}">
|
||||
<input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
|
||||
<button type="submit" class="vote-button upvote{% if pssdict[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._id }}">
|
||||
<input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
|
||||
<button type="submit" class="vote-button downvote{% if pssdict[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>
|
||||
</div>
|
||||
<div class="media__body top no-heading">
|
||||
<div class="clearfix">
|
||||
<div class="supplementary dczcomments__supplementary">
|
||||
{{ user.render_inline(udoc) }}
|
||||
@ {{ datetime_span(doc._id)|safe }}
|
||||
</div>
|
||||
<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._id}}"}"
|
||||
><span class="icon icon-reply"></span></a>
|
||||
{% endif %}
|
||||
{% if doc.owner == handler.state.user._id 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._id}}"}"
|
||||
><span class="icon icon-edit"></span></a>
|
||||
{% endif %}
|
||||
{% if doc.owner == handler.state.user._id 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._id}}"}"
|
||||
><span class="icon icon-delete"></span></a>
|
||||
{% endif %}
|
||||
</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 }}
|
||||
{{ doc['content']|markdown|safe }}
|
||||
</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) }}
|
||||
{% set udoc = udict[rdoc['owner']] %}
|
||||
<li class="dczcomments__reply{% if mode_create %} commentbox-container{% endif %}">
|
||||
<div class="media">
|
||||
<div class="media__body top no-heading">
|
||||
<div class="clearfix">
|
||||
<div class="supplementary dczcomments__supplementary">
|
||||
{{ 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) %}
|
||||
<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) %}
|
||||
<a href="javascript:;" data-tooltip="{{ _('Edit') }}" name="dczcomments__op-edit-reply"
|
||||
data-form="{"operation":"{{reply_edit_op}}","{{comment_ref}}":"{{doc._id}}","{{reply_ref}}":"{{rdoc._id}}"}"
|
||||
><span class="icon icon-edit"></span></a>
|
||||
{% endif %}
|
||||
{% if doc.owner == handler.state.user._id 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._id}}","{{reply_ref}}":"{{rdoc._id}}"}"
|
||||
><span class="icon icon-delete"></span></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</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|safe }}
|
||||
</div>
|
||||
<div class="commentbox-edit-target"></div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{% 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>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endmacro %}
|
||||
@@ -1,6 +1,5 @@
|
||||
{% macro render_inline(
|
||||
udoc,
|
||||
dudoc={},
|
||||
avatar=true,
|
||||
badge=true,
|
||||
modbadge=true
|
||||
@@ -9,16 +8,12 @@
|
||||
{% 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 class="user-profile-name" href="/u/{{ udoc['_id']|default(0) }}">
|
||||
{{ udoc['uname'] }}
|
||||
</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, perm.PERM_MOD_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) %}
|
||||
<span class="user-profile-badge v-center badge--mod" title="Moderator">MOD</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{% set page_name = "problem_solution" %}
|
||||
{% extends "layout/basic.html" %}
|
||||
{% import "components/comments.html" as comments with context %}
|
||||
{% import "components/comments_solution.html" as comments with context %}
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="medium-9 columns">
|
||||
@@ -41,9 +42,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="medium-3 columns">
|
||||
{% with owner_udoc=udict[pdoc['owner_uid']], owner_dudoc=dudict[pdoc['owner_uid']] %}
|
||||
{% set owner_udoc = udict[pdoc.owner] %}
|
||||
{% include "partials/problem_sidebar.html" %}
|
||||
{% endwith %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in new issue
Block a user