2024-05-30 21:54:25 +12:00
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') -%}
{% extends 'themes/' + theme() + '/base.html' -%}
{% else -%}
{% extends "base.html" -%}
{% endif -%} -%}
{% from 'bootstrap/form.html' import render_form -%}
2023-10-02 22:16:44 +13:00
2024-05-30 21:54:25 +12:00
{% 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" >
2024-05-30 21:54:25 +12:00
{% include 'post/_post_full.html' -%}
{% if post.comments_enabled -%}
{% if current_user.is_authenticated -%}
{% if current_user.verified -%}
2023-10-23 13:03:35 +13:00
< 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" >
2024-05-30 21:54:25 +12:00
{% if post.community.ap_id and '@beehaw.org' in post.community.ap_id -%}
2024-02-28 22:25:34 +13:00
< p > {{ _('This post is hosted on beehaw.org which has < a href = "https://docs.beehaw.org/docs/core-principles/what-is-beehaw/" target = "_blank" rel = "nofollow" > higher standards of behaviour than most places. Be nice< / a > .') }}< / p >
2024-05-30 21:54:25 +12:00
{% endif -%}
{% if post.community.posting_warning -%}
2024-04-18 20:51:08 +12:00
< p align = "center" > {{ post.community.posting_warning|safe }}< / p >
2024-05-30 21:54:25 +12:00
{% endif -%}
2023-10-23 13:03:35 +13:00
{{ render_form(form) }}
2024-05-30 21:54:25 +12:00
{% if not low_bandwidth -%}
{% if markdown_editor -%}
2024-02-28 20:12:57 +13:00
< script nonce = "{{ session['nonce'] }}" >
window.addEventListener("load", function () {
var downarea = new DownArea({
elem: document.querySelector('#body'),
resize: DownArea.RESIZE_VERTICAL,
hide: ['heading', 'bold-italic'],
2024-08-16 14:41:39 -04:00
value: document.getElementById("body").value
2024-02-28 20:12:57 +13:00
});
setupAutoResize('body');
2023-12-26 10:49:08 +13:00
});
2024-02-28 20:12:57 +13:00
< / script >
2024-05-30 21:54:25 +12:00
{% else -%}
2024-05-09 17:54:30 +12:00
<!-- <a href="#" aria - hidden="true" id="post_reply_markdown_editor_enabler" class="markdown_editor_enabler" data - id="body">{{ _('Enable markdown editor') }}</a> -->
2024-05-30 21:54:25 +12:00
{% endif -%}
{% endif -%}
2023-10-23 13:03:35 +13:00
< / div >
< / div >
2024-05-30 21:54:25 +12:00
{% if replies -%}
2023-10-23 13:03:35 +13:00
< hr class = "mt-4" / >
2024-05-30 21:54:25 +12:00
{% endif -%}
2023-10-23 13:03:35 +13:00
< / div >
2024-05-30 21:54:25 +12:00
{% else -%}
2023-10-23 13:03:35 +13:00
< p > < a href = "{{ url_for('auth.validation_required') }}" > {{ _('Verify your email address to comment') }}< / a > < / p >
2024-05-30 21:54:25 +12:00
{% endif -%}
{% else -%}
2024-02-28 22:03:26 +13:00
< p > < a href = "{{ url_for('auth.login', next='/post/' + str(post.id)) }}" > {{ _('Log in to comment') }}< / a > < / p >
2024-05-30 21:54:25 +12:00
{% endif -%}
{% else -%}
2023-12-14 21:22:46 +13:00
< p > {{ _('Comments are disabled.') }}< / p >
2024-05-30 21:54:25 +12:00
{% endif -%}
{% if replies -%}
2024-02-29 22:45:17 +13:00
< h2 class = "visually-hidden" > {{ post.reply_count }} {{ _('Comments') }}< / h2 >
2024-01-07 22:28:13 +13:00
< div id = "post_replies" class = "row" >
2023-10-02 22:16:44 +13:00
< div class = "col" >
2024-01-07 22:28:13 +13:00
< div class = "btn-group mt-1 mb-2" >
2024-02-13 19:14:51 +13:00
< a href = "?sort=hot#post_replies" title = "{{ _('Sort by magic') }}" class = "btn btn-sm {{ 'btn-primary' if request.args.get('sort', '') == '' or request.args.get('sort', '') == 'hot' else 'btn-outline-secondary' }}" rel = "nofollow noindex" >
2024-01-07 22:28:13 +13:00
{{ _('Hot') }}
< / a >
2024-02-13 19:14:51 +13:00
< a href = "?sort=top#post_replies" title = "{{ _('Comments with the most upvotes') }}" class = "btn btn-sm {{ 'btn-primary' if request.args.get('sort', '') == 'top' else 'btn-outline-secondary' }}" rel = "nofollow noindex" >
2024-01-07 22:28:13 +13:00
{{ _('Top') }}
< / a >
2024-02-13 19:14:51 +13:00
< a href = "?sort=new#post_replies" title = "{{ _('Show newest first') }}" class = "btn btn-sm {{ 'btn-primary' if request.args.get('sort', '') == 'new' else 'btn-outline-secondary' }}" rel = "nofollow noindex" >
2024-01-07 22:28:13 +13:00
{{ _('New') }}
< / a >
< / div >
2023-10-02 22:16:44 +13:00
2024-03-01 05:16:48 +13:00
< div id = "replies" class = "comments" role = "tree" aria-label = "{{ _('Comments') }}" aria-expanded = "true" >
2024-05-30 21:54:25 +12:00
{% for reply in replies -%}
2024-12-05 13:11:40 +01:00
{% with post_reply=reply['comment'], children=reply['replies'] %}
{% include 'post/_post_reply_teaser.html' %}
{% endwith %}
2024-05-30 21:54:25 +12:00
{% endfor -%}
2023-10-10 22:25:37 +13:00
< / div >
2023-10-02 22:16:44 +13:00
< / div >
< / div >
2024-05-30 21:54:25 +12:00
{% endif -%}
2023-10-02 22:16:44 +13:00
< / div >
2024-07-09 14:24:43 +02:00
{% with community = post.community -%}
{% include "_side_pane.html" %}
{% endwith -%}
2023-10-02 22:16:44 +13:00
< / div >
2024-01-21 12:14:05 +13:00
< script nonce = "{{ session['nonce'] }}" >
window.addEventListener("load", function () {
currentPost = document.querySelector('.post_col'); // set the current post, so A and Z voting keys work when viewing a post page
});
< / script >
2024-05-30 21:54:25 +12:00
{% endblock -%}