mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-24 03:43:42 -08:00
183 lines
10 KiB
HTML
183 lines
10 KiB
HTML
{% extends "base.html" %}
|
|
{% from 'bootstrap/form.html' import render_form %}
|
|
|
|
{% block app_content %}
|
|
<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>
|
|
<div class="row">
|
|
<div class="col-12 col-md-8 position-relative main_pane">
|
|
{% include 'post/_post_full.html' %}
|
|
{% if post.comments_enabled %}
|
|
{% if current_user.is_authenticated %}
|
|
{% if current_user.verified %}
|
|
<div class="row post_reply_form">
|
|
<hr class="mt-1" />
|
|
<div class="col">
|
|
<div class="reply_form_inner position-relative">
|
|
{{ render_form(form) }}
|
|
{% 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'],
|
|
});
|
|
setupAutoResize('body');
|
|
});
|
|
</script>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% if replies %}
|
|
<hr class="mt-4" />
|
|
{% endif %}
|
|
</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 %}
|
|
{% else %}
|
|
<p>{{ _('Comments are disabled.') }}</p>
|
|
{% endif %}
|
|
{% if replies %}
|
|
<div class="row post_replies">
|
|
<div class="col">
|
|
{% macro render_comment(comment) %}
|
|
<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 %}">
|
|
<div class="limit_height">
|
|
<div class="voting_buttons">
|
|
{% with comment=comment['comment'] %}
|
|
{% include "post/_voting_buttons.html" %}
|
|
{% endwith %}
|
|
</div>
|
|
<div class="hide_button">
|
|
{% if comment['comment'].score <= -10 %}
|
|
<a href='#'>[+] show</a>
|
|
{% else %}
|
|
<a href='#'>[-] hide</a>
|
|
{% endif %}
|
|
</div>
|
|
<div class="comment_author">
|
|
{% if comment['comment'].author.deleted %}
|
|
<strong>[deleted]</strong>
|
|
{% else %}
|
|
{% if comment['comment'].author.avatar_id and comment['comment'].score > -10 %}
|
|
<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() }}">
|
|
{{ comment['comment'].author.user_name }}</a>
|
|
{% endif %}
|
|
{% if comment['comment'].author.created_recently() %}
|
|
<span class="fe fe-new-account small" title="New account"> </span>
|
|
{% endif %}
|
|
{% 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 %}
|
|
{% if comment['comment'].author.id == post.author.id %}<span title="Submitter of original post" aria-label="submitter" class="small">[OP]</span>{% endif %}
|
|
<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>
|
|
</div>
|
|
<div class="comment_body hidable">
|
|
{{ comment['comment'].body_html | safe }}
|
|
</div>
|
|
</div>
|
|
<div class="comment_actions hidable">
|
|
{% if current_user.is_authenticated and current_user.verified %}
|
|
{% 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 %}
|
|
{% 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>
|
|
{% if comment['replies'] %}
|
|
{% 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">
|
|
<a href="{{ url_for('post.continue_discussion', post_id=post.id, comment_id=comment['comment'].id, _anchor='replies') }}">
|
|
Continue thread</a>
|
|
</div>
|
|
{% endif %}
|
|
{% endif %}
|
|
</div>
|
|
{% if comment['comment'].score <= -10 %}
|
|
<script nonce="{{ session['nonce'] }}" type="text/javascript">
|
|
toBeHidden.push({{ comment['comment'].id }});
|
|
</script>
|
|
{% endif %}
|
|
{% endmacro %}
|
|
|
|
<div id="replies" class="comments">
|
|
{% for reply in replies %}
|
|
{{ render_comment(reply) | safe }}
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="col-12 col-md-4">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<div class="row">
|
|
<div class="col-6">
|
|
{% if current_user.is_authenticated and community_membership(current_user, post.community) %}
|
|
<a class="w-100 btn btn-primary" href="/community/{{ post.community.link() }}/unsubscribe">{{ _('Unsubscribe') }}</a>
|
|
{% else %}
|
|
<a class="w-100 btn btn-primary" href="/community/{{ post.community.link() }}/subscribe">{{ _('Subscribe') }}</a>
|
|
{% endif %}
|
|
</div>
|
|
<div class="col-6">
|
|
<a class="w-100 btn btn-primary" href="/community/{{ post.community.link() }}/submit">{{ _('Create post') }}</a>
|
|
</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">
|
|
<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>
|
|
{% if len(mods) > 0 and not post.community.private_mods %}
|
|
<h3>Moderators</h3>
|
|
<ul class="moderator_list">
|
|
{% for mod in mods %}
|
|
<li><a href="/u/{{ mod.user_name }}">{{ mod.user_name }}</a></li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% 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 %}
|