You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

92 lines
3.2 KiB

{% extends 'base.html' %}
{% load tz %}
{% load static %}
{% block title %}{{ post.title }}{% endblock %}
{% block content %}
{% autoescape off %}
<nav class="breadcrumb has-bullet-separator is-centered" aria-label="breadcrumbs">
<ul>
<li><a href="/">Главная</a></li>
<li><a href="/posts">Все посты</a></li>
<li class="is-active"><a href="#" aria-current="page">{{ post.title | truncatechars:20}}</a></li>
</ul>
</nav>
<section class="section">
<h1 class="title is-spaced">{{ post.title }}</h1>
{% get_current_timezone as TIME_ZONE %}
<div class="subtitle is-6">Опубликован: {{ post.pub_date | date:'Y-m-d, H:i' }}</div>
<div class="content is-medium">{{ post.text }}</div>
<hr>
<h2 class="title is-5">Комментарии ({{ comments_count }})</h2>
{% for comment in comments %}
<div class="box">
{% if comment.reply %}
<p><strong id="{{ comment.id }}_author_name">{% if comment.is_anonym %}
{{ comment.nickname }}
{% else %}
<span class="is-auth-user" title="Этот пользователь ввел имя и хеш">{{ comment.author }}</span>
{% endif %}
</strong> отвечает {{ comment.reply.author_name }}:</p>
<div class="content">
<blockquote>{{ comment.reply.comment_text }}</blockquote>
{% else %}
<p><strong id="{{ comment.id }}_author_name">
{% if comment.is_anonym %}
{{ comment.nickname }}
{% else %}
<span class="is-auth-user" title="Этот пользователь ввел имя и хеш">{{ comment.author }}</span>
{% endif %}
</strong> говорит:</p>
<div class="content">
{% endif %}
<p>{{ comment.comment_text }}</p>
</div>
<a href="javascript:void(reply({{ comment.id }}));" id="comment_{{ comment.id }}">Ответить</a>
</div>
{% endfor %}
<form action="{% url 'comments:leave_comment' post.id %}" method="POST" id="comment_form">
{% csrf_token %}
<input type="hidden" id="reply_to" name="reply_to">
<div class="field">
<label class="label">Имя</label>
<input class="input" type="text" placeholder="Имярек" name="name" required>
</div>
<div class="field">
<label class="label">Секрет</label>
<input class="input" type="text" placeholder="секрет" name="secret" >
</div>
</div>
<div class="field">
<label class="label" id="reply_to_name_field" style="display: none;">
<!-- <a class="button is-danger is-small" href="javascript:abort_reply();">X</a> -->
<a class="is-red" href="javascript:abort_reply();" title="Отменить создание ответа, просто написать комментарий">X</a>
Ответ для <span id="reply_to_name" class="is-green"></span></label>
<label class="label" id="pure_comment_label">Комментарий</label>
<div class="control">
<textarea class="textarea" name='text' placeholder="Текст" id="comment_text_form" required></textarea>
</div>
</div>
<div class="control">
<button class="button is-primary" type="submit">Оставить комментарий</button>
</div>
</form>
</section>
<script type="text/javascript" src="{% static 'js/comment_reply.js' %}"></script>
{% endautoescape %}
{% endblock %}