{% load static %}
{% load board_tag %}
<!DOCTYPE html>
<html lang="en" xmlns="http://w...content-available-to-author-only...3.org/1999/html">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="{% static 'static/css/bootstrap.css' %}">
    <script src="{% static 'static/jQuery/jquery-3.1.1.js' %}"></script>
    <link rel="stylesheet" href="{% static 'static/lightbox/css/lightbox.css' %}">
    <script src="{% static 'static/lightbox/js/lightbox.js' %}"></script>
    <script src="{% static 'static/js/main.js' %}"></script>
    <link rel="stylesheet" type="text/css" href="{% static 'static/css/main.css' %}">
    <script src="https://c...content-available-to-author-only...e.com/ajax/libs/lodash.js/4.3.0/lodash.js"></script>
    <script type="text/template" id="template-thread">
        <div class="container container_board_index">
        <span>
            <% if (data[i].fields.thread_tittle != '') %> <b> <%= data[i].fields.thread_tittle %> </b>
            Аноним <%= data[i].fields.thread_time %>
            [ <a href="/{{ name_board }}/res/<%= data[i].pk %>.html" class="link_color_all">Ответ</a> ]
        </span><br>
        <% if (data[i].fields.thread_image != '') { %>
            <div class="container container_tittle_thread">
                <a href="/upload/<%= data[i].fields.thread_image %>" class="link_color_img"> <%= data[i].fields.thread_image %></a>
            </div>
            <a data-lightbox="image-1" href="/upload/<%= data[i].fields.thread_image %>">
                <img src="/upload/<%= data[i].fields.thread_image %>" width="16%" height="16%" align="left"/>
            </a>
        <% } %>
        <p><%= data[i].fields.thread_text %></p>
        <hr class="board">
        </div>
    </script>
    <script type="text/template" id="template-comment">
        <div class="container container_comments_index">
            <div class="container_comments">
                <span>
                    <% if (data[y].fields.comments_tittle != '') %> <b> <%= data[y].fields.comments_tittle %> </b>
                    Аноним <% if (data[y].fields.comments_op != '') %> <%= data[y].fields.comments_op %>
                    <%= data[y].fields.comments_time %>
                </span><br>
                <% if (data[y].fields.comments_image != '') { %>
                        <div class="container container_tittle_thread">
                            <a href="/upload/<%= data[y].fields.comments_image %>" class="link_color_img"><%= data[y].fields.comments_image %></a>
                        </div>
                        <a data-lightbox="image-1" href="/upload/<%= data[y].fields.comments_image %>">
                            <img src="/upload/<%= data[y].fields.comments_image %>" width="16%" height="16%" align="left">
                        </a>
                <% } %>
                <p><%= data[y].fields.comments_text %></p>
            </div>
        </div>
    </script>
    <script type="text/template" id="template-tooltip">
        <span class="tooltip"><%= data[0].fields.comments_text %></span>
    </script>
</head>
<body>

    <div class="navbar navbar-inverse navbar-static-top">
        <div class="container container_navbar">
            <a class="menu" href="{% url 'index' %}">Главная</a>
            <a class="menu" href="{% url 'contacts' %}">Контакты</a>
        </div>
    </div>
    <hr class="index">
    <div class="board_center_text">
        <h1><a class="mainlogo link_color_all" href="{% url 'board' name_board %}">{{ board.board_name }}</a></h1>
    </div>
    <hr>
    <div class="board_center_text">
        [ <a class="link_color_all" id="js_thr_1">Создать тред</a> ]
    </div>
    <div class="container container-form_1">
    <hr>
        <form enctype="multipart/form-data" method="post" action="{% url 'board' name_board %}" class="container-js_1">
            {% csrf_token %}
            <table>
                {% for x in form %}
                <tr>
                    <td>{% cycle 'Имя треда' 'Текст' 'Файл' %}</td>
                    <td>{{ x }} {% cycle '<input type="submit" class="button" value="Отправить">' '' '' %}</td>
                </tr>
                {% endfor %}
            </table>
        </form>
    </div>
    <div class="dynamic1">
    {% for thread in threads %}
    <div class="container container_board_index">
        <span> {% if thread.thread_tittle %}<b>{{ thread.thread_tittle }}</b>{% endif %} Аноним {{ thread.thread_time }} [ <a href="{% url 'thread' name_board thread.id %}" class="link_color_all">Ответ</a> ]</span><br>
        {% if thread.thread_image %}
            <div class="container container_tittle_thread">
                <a href="{{ thread.thread_image.url }}" class="link_color_img"> {{ thread.thread_image }}</a>
            </div>
            <a data-lightbox="image-1" href="{{ thread.thread_image.url }}">
                <img src="{{ thread.thread_image.url }}" width="16%" height="16%" align="left"/>
            </a>
        {% endif %}
        <p>{{ thread.thread_text }}</p>
        <hr class="board">
    </div>
        {% for comment in comments %}
            {% for x in comment %}
                {% if thread.id == x.thread_id %}
                    <div class="container container_comments_index">
                        <div class="container_comments">
                            <span> {% if x.comments_tittle %}<b>{{ x.comments_tittle }}</b>{% endif %} Аноним
                                {% if x.comments_op %}{{ x.comments_op }}{% endif %}{{ x.comments_time }}</span><br>
                            {% if x.comments_image %}
                                <div class="container container_tittle_thread">
                                    <a href="{{ x.comments_image.url }}" class="link_color_img">{{ x.comments_image }}</a>
                                </div>
                                <a data-lightbox="image-1" href="{{ x.comments_image.url }}">
                                    <img src="{{ x.comments_image.url }}" width="16%" height="16%" align="left">
                                </a>
                            {% endif %}
                            <blockquote>{{ x.comments_text|safe|linebreaksbr }}</blockquote>
                        {% if x.comments_answers %}
                            <span>Ответы: {% for answer in x.comments_answers|make_mylist %}<a class="link-reply" data-num="{{ answer }}">>>{{ answer }} </a>{% endfor %}</span>
                        {% endif %}
                        </div>
                    </div>
                    {% if forloop.last %}
                        <hr class="comments">
                    {% endif %}
                {% endif %}
            {% endfor %}
        {% endfor %}
{% endfor %}
    </div>

    <div class="board_center_text">
        [ <a class="link_color_all" id="js_thr_2">Создать тред</a> ]
    </div>
    <div class="container container-form_2">
    <hr>
        <form enctype="multipart/form-data" method="post" action="{% url 'board' name_board %}" class="container-js_2">
            {% csrf_token %}
            <table>
                {% for x in form %}
                <tr>
                    <td>{% cycle 'Имя треда' 'Текст' 'Файл' %}</td>
                    <td>{{ x }} {% cycle '<input type="submit" class="button" value="Отправить">' '' '' %}</td>
                </tr>
                {% endfor %}
            </table>
        </form>
    </div>
</body>
</html>
