{% extends 'base.html' %}
{% load static %}
{% block custom-tags %}<script src="{% static 'js/a.js' %}"></script>
<script src="{% static 'js/jquery.js' %}"></script>
{% endblock %}
{% block content %}
{% if request.user.is_authenticated and request.user.id == post.user.id %}
<a href="{% url 'posts:post_delete' post.user.id post.id %}" class="btn btn-danger">Delete Post</a>
<a href="{% url 'posts:edit_post' request.user.id post.id %}" class="btn btn-primary">Edit Post</a>
{% endif %}
<p>{{ post.user }} | {{ post.created }}</p>
<P>{{ post.body }}</P>
<hr/>
{% if comments.count != 0 %}
{% with total=comments.count %}
<p>This post has {{ total }} comment{{ total|pluralize }}</p>
{% endwith %}
{% endif %}
<br/>
{% if request.user.is_authenticated%}
<form method="post" class="col-md-7">
{% csrf_token %}
{{ form.as_p}}
<input value="Send" type="submit" class="btn btn-primary">
</form>
{% else %}
<P>Only logged in user can send comments</P>
{% endif %}
<br/><br/>
{% for comment in comments %}
<div class="card bg-dark text-white">
<pre style="color: white" class="card-header">{{ comment.user }} <button onclick="show()" class="btn btn-primary">reply</button></pre>
<p class="card-body">{{ comment.body }}</p>
{% if request.user.is_authenticated %}
<div class="card-body">
<form style="display:none" class="a" method="post" action="{% url 'posts:add_reply' post.id comment.id %}">
{% csrf_token %}
{{ reply.as_p }}
<input value="Send" type="submit">
</form>
</div>
{% else %}
<p>You have to login to send reply</p>
{% endif %}
{% for reply in comment.rcomment.all %}
<p class="bg-primary text-white p-3 m-5">{{ reply.user }} <br/> {{ reply.body }}</p>
{% endfor %}
</div>
<br/>
{% empty %}
<P>There is no comment</P>
{% endfor %}
{% endblock %}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}