2023-10-02 22:16:44 +13:00
{% extends "base.html" %}
{% from 'bootstrap/form.html' import render_form %}
{% block app_content %}
2023-10-23 22:54:11 +13:00
< script type = "text/javascript" nonce = "{{ session['nonce'] }}" >
var toBeHidden = Array(); // this list of comment IDs will be iterated over in setupHideButtons() and the 'hide' button clicked
< / script >
2023-10-02 22:16:44 +13:00
< div class = "row" >
2023-11-09 21:32:29 +13:00
< div class = "col-12 col-md-8 position-relative main_pane" >
2023-11-30 06:36:08 +13:00
{% include 'post/_post_full.html' %}
2023-10-02 22:16:44 +13:00
{% if post.comments_enabled %}
2023-10-23 13:03:35 +13:00
{% if current_user.is_authenticated %}
{% if current_user.verified %}
< div class = "row post_reply_form" >
2023-11-09 21:32:29 +13:00
< hr class = "mt-1" / >
2023-10-23 13:03:35 +13:00
< div class = "col" >
2023-11-30 23:21:37 +13:00
< div class = "reply_form_inner position-relative" >
2023-10-23 13:03:35 +13:00
{{ render_form(form) }}
2023-12-26 10:49:08 +13:00
{% if markdown_editor %}
< script nonce = "{{ session['nonce'] }}" >
window.addEventListener("load", function () {
var downarea = new DownArea({
elem: document.querySelector('#body'),
resize: DownArea.RESIZE_VERTICAL,
hide: ['heading', 'bold-italic'],
});
2023-12-26 22:28:45 +13:00
setupAutoResize('body');
2023-12-26 10:49:08 +13:00
});
< / script >
{% endif %}
2023-10-23 13:03:35 +13:00
< / div >
< / div >
2023-11-09 21:32:29 +13:00
{% if replies %}
2023-10-23 13:03:35 +13:00
< hr class = "mt-4" / >
2023-11-09 21:32:29 +13:00
{% endif %}
2023-10-23 13:03:35 +13:00
< / div >
{% else %}
< p > < a href = "{{ url_for('auth.validation_required') }}" > {{ _('Verify your email address to comment') }}< / a > < / p >
{% endif %}
{% else %}
< p > < a href = "{{ url_for('auth.login') }}" > {{ _('Log in to comment') }}< / a > < / p >
{% endif %}
2023-10-02 22:16:44 +13:00
{% else %}
2023-12-14 21:22:46 +13:00
< p > {{ _('Comments are disabled.') }}< / p >
2023-10-02 22:16:44 +13:00
{% endif %}
2023-11-09 21:32:29 +13:00
{% if replies %}
2023-10-02 22:16:44 +13:00
< div class = "row post_replies" >
< div class = "col" >
2023-10-10 22:25:37 +13:00
{% macro render_comment(comment) %}
2023-12-27 11:00:30 +13:00
< div id = "comment_{{ comment['comment'].id }}" class = "comment { % if comment [ ' comment ' ] . score < = -10 % } low_score { % endif % }
{% if comment['comment'].author.id == post.author.id %}original_poster{% endif %}">
2023-10-15 21:13:32 +13:00
< div class = "limit_height" >
< div class = "voting_buttons" >
{% with comment=comment['comment'] %}
2023-11-30 06:36:08 +13:00
{% include "post/_voting_buttons.html" %}
2023-10-15 21:13:32 +13:00
{% endwith %}
< / div >
2023-11-09 22:44:09 +13:00
< div class = "hide_button" >
{% if comment['comment'].score < = -10 %}
< a href = '#' > [+] show< / a >
{% else %}
< a href = '#' > [-] hide< / a >
{% endif %}
2023-10-23 22:54:11 +13:00
< / div >
2023-10-15 21:13:32 +13:00
< div class = "comment_author" >
2023-10-21 15:49:01 +13:00
{% if comment['comment'].author.deleted %}
< strong > [deleted]< / strong >
{% else %}
2023-10-23 22:54:11 +13:00
{% if comment['comment'].author.avatar_id and comment['comment'].score > -10 %}
2023-10-21 15:49:01 +13:00
< a href = "/u/{{ comment['comment'].author.link() }}" title = "{{ comment['comment'].author.ap_id }}" >
< img src = "{{ comment['comment'].author.avatar_image() }}" alt = "Avatar" / > < / a >
{% endif %}
< a href = "/u/{{ comment['comment'].author.link() }}" title = "{{ comment['comment'].author.link() }}" >
2024-01-01 14:49:15 +13:00
{{ comment['comment'].author.display_name() }}< / a >
2023-10-15 21:13:32 +13:00
{% endif %}
2023-11-30 05:14:22 +13:00
{% if comment['comment'].author.created_recently() %}
< span class = "fe fe-new-account small" title = "New account" > < / span >
{% endif %}
2023-12-27 11:00:30 +13:00
{% if comment['comment'].author.reputation < -10 % }
< span class = "fe fe-warning red" title = "Very low reputation. Beware." > < / span >
< span class = "fe fe-warning red" title = "Very low reputation. Beware!" > < / span >
{% elif comment['comment'].author.reputation < 0 % }
< span class = "fe fe-warning orangered" title = "Low reputation." > < / span >
{% endif %}
2023-10-23 22:54:11 +13:00
{% if comment['comment'].author.id == post.author.id %}< span title = "Submitter of original post" aria-label = "submitter" class = "small" > [OP]< / span > {% endif %}
2023-11-22 20:48:27 +13:00
< span class = "text-muted small" > {{ moment(comment['comment'].posted_at).fromNow(refresh=True) }}{% if comment['comment'].edited_at %}, edited {{ moment(comment['comment'].edited_at).fromNow(refresh=True) }} {% endif %}< / span >
2024-01-02 16:07:41 +13:00
{% if comment['comment'].reports and current_user.is_authenticated and post.community.is_moderator(current_user)%}
< span class = "red fe fe-report" title = "{{ _('Reported. Check comment for issues.') }}" > < / span >
{% endif %}
2023-10-15 21:13:32 +13:00
< / div >
2024-01-02 16:07:41 +13:00
< div class = "comment_body hidable {% if comment['comment'].reports and current_user.is_authenticated and post.community.is_moderator(current_user) %}reported{% endif %}" >
2023-10-15 21:13:32 +13:00
{{ comment['comment'].body_html | safe }}
< / div >
2023-10-15 19:36:14 +13:00
< / div >
2023-12-28 20:00:07 +13:00
< div class = "comment_actions hidable" >
{% if current_user.is_authenticated and current_user.verified %}
2023-12-14 21:22:46 +13:00
{% if post.comments_enabled %}
< a href = "{{ url_for('post.add_reply', post_id=post.id, comment_id=comment['comment'].id) }}" rel = "nofollow" > < span class = "fe fe-reply" > < / span > reply< / a >
{% endif %}
2023-12-28 20:00:07 +13:00
{% endif %}
< a href = "{{ url_for('post.post_reply_options', post_id=post.id, comment_id=comment['comment'].id) }}" class = "comment_actions_link" rel = "nofollow" > < span class = "fe fe-options" title = "Options" > < / span > < / a >
< / div >
2023-10-15 19:36:14 +13:00
{% if comment['replies'] %}
2023-10-16 21:38:36 +13:00
{% if comment['comment'].depth < = THREAD_CUTOFF_DEPTH %}
< div class = "replies hidable" >
{% for reply in comment['replies'] %}
{{ render_comment(reply) | safe }}
{% endfor %}
< / div >
{% else %}
< div class = "continue_thread hidable" >
2023-11-30 06:36:08 +13:00
< a href = "{{ url_for('post.continue_discussion', post_id=post.id, comment_id=comment['comment'].id, _anchor='replies') }}" >
2023-10-16 21:38:36 +13:00
Continue thread< / a >
< / div >
{% endif %}
2023-10-15 19:36:14 +13:00
{% endif %}
2023-10-10 22:25:37 +13:00
< / div >
2023-10-23 22:54:11 +13:00
{% if comment['comment'].score < = -10 %}
< script nonce = "{{ session['nonce'] }}" type = "text/javascript" >
toBeHidden.push({{ comment['comment'].id }});
< / script >
{% endif %}
2023-10-10 22:25:37 +13:00
{% endmacro %}
2023-10-02 22:16:44 +13:00
2023-10-16 21:38:36 +13:00
< div id = "replies" class = "comments" >
2023-10-10 22:25:37 +13:00
{% for reply in replies %}
{{ render_comment(reply) | safe }}
{% endfor %}
< / div >
2023-10-02 22:16:44 +13:00
< / div >
< / div >
2023-11-09 21:32:29 +13:00
{% endif %}
2023-10-02 22:16:44 +13:00
< / div >
2024-01-04 22:21:31 +13:00
< div class = "col-12 col-md-4 side_pane" >
2023-10-02 22:16:44 +13:00
< div class = "card" >
< div class = "card-body" >
< div class = "row" >
2024-01-06 08:47:38 +13:00
< div class = "col-6" >
< a class = "w-100 btn btn-primary" href = "/community/{{ post.community.link() }}/submit" > {{ _('Create post') }}< / a >
< / div >
2023-10-02 22:16:44 +13:00
< div class = "col-6" >
2023-12-03 22:41:15 +13:00
{% if current_user.is_authenticated and community_membership(current_user, post.community) %}
2024-01-05 14:09:46 +13:00
< a class = "w-100 btn btn-primary" href = "/community/{{ post.community.link() }}/unsubscribe" > {{ _('Leave') }}< / a >
2023-10-02 22:16:44 +13:00
{% else %}
2024-01-05 14:09:46 +13:00
< a class = "w-100 btn btn-primary" href = "/community/{{ post.community.link() }}/subscribe" > {{ _('Join') }}< / a >
2023-10-02 22:16:44 +13:00
{% endif %}
< / div >
< / div >
< form method = "get" >
< input type = "search" name = "search" class = "form-control mt-2" placeholder = "{{ _('Search this community') }}" / >
< / form >
< / div >
< / div >
< div class = "card mt-3" >
< div class = "card-header" >
< h2 > {{ _('About community') }}< / h2 >
< / div >
< div class = "card-body" >
2023-12-27 13:02:52 +13:00
< p > {{ post.community.description_html|safe if post.community.description_html else '' }}< / p >
< p > {{ post.community.rules_html|safe if post.community.rules_html else '' }}< / p >
2023-10-02 22:16:44 +13:00
{% if len(mods) > 0 and not post.community.private_mods %}
< h3 > Moderators< / h3 >
2023-12-27 11:00:30 +13:00
< ul class = "moderator_list" >
2023-10-02 22:16:44 +13:00
{% for mod in mods %}
2024-01-01 14:49:15 +13:00
< li > < a href = "/u/{{ mod.user_name }}" > {{ mod.display_name() }}< / a > < / li >
2023-10-02 22:16:44 +13:00
{% endfor %}
2023-12-27 11:00:30 +13:00
< / ul >
2023-10-02 22:16:44 +13:00
{% endif %}
< / div >
< / div >
{% if is_moderator %}
< div class = "card mt-3" >
< div class = "card-header" >
< h2 > {{ _('Community Settings') }}< / h2 >
< / div >
< div class = "card-body" >
< p > < a href = "#" class = "btn btn-primary" > {{ _('Moderate') }}< / a > < / p >
< p > < a href = "#" class = "btn btn-primary" > {{ _('Settings') }}< / a > < / p >
< / div >
< / div >
{% endif %}
< / div >
< / div >
{% endblock %}