{% extends "chats/base_detail.html" %}

{% load community_utils %}
{% load bootstrap_helpers %}
{% load django_bootstrap5 %}
{% load community_buttons %}
{% load chats %}

{% block headline %}{{ thread }}{% endblock %}

{% block title %}{{ thread }}{% endblock %}

{% block breadcrumbs %}
  {% with all_channels_url=channel.get_list_url|str_add:"/.." %}
    {% if form.instance.pk %}
      {% breadcrumbs "Channels"|combine:all_channels_url channel.channel_type|verbose_model_name_plural|combine:channel.get_list_url channel|name_for:user|combine:channel.get_absolute_url form.instance|combine:form.instance.get_absolute_url "Edit thread"|combine:request.path %}
    {% else %}
      {% breadcrumbs "Channels"|combine:all_channels_url channel.channel_type|verbose_model_name_plural|combine:channel.get_list_url channel|name_for:user|combine:channel.get_absolute_url "Post"|combine:request.path %}
    {% endif %}
  {% endwith %}
{% endblock %}

{% block content %}

  <form role="form" method="post" id="comment-form">
    {% csrf_token %}
    {% bootstrap_form form %}

    <div class="row row-cols-auto m-3">
      {% bootstrap_button "OK" button_type="submit" extra_classes="me-2" %}
      {% bootstrap_button "Reset" button_type="reset"  %}

      {% bootstrap_button content="Cancel" extra_classes="ms-auto" button_type="link" href=next_url|default:channel.get_absolute_url %}
      {% delete_button form.instance None url_for_next=form.instance.get_list_url button_class="ms-2 btn-primary" %}
    </div>
  </form>

  {% include "chats/components/comment_form_js.html" %}

{% endblock %}
