{% if user.is_authenticated %}
    {% if form %}
        <form class="form-control" method="post" hx-swap="outerHTML" hx-target="closest section">
            {% csrf_token %}
            {{ form.non_field_errors }}
            <div class="mb-3">
                {{ form.content.errors }}
                {{ form.content.label_tag }}
                {{ form.content }}
            </div>
            <div class="row">
                <div class="col">
                    <div class="form-check form-switch">
                        {{ form.is_public.errors }}
                        {{ form.is_public.label_tag }}
                        {{ form.is_public }}
                    </div>
                </div>
                <div class="col align-self-end">
                    <input
                        type="submit"
                        value="Submit"
                        class="btn btn-primary float-end mx-2"
                        hx-post="{{request.path}}"
                        hx-trigger="click",
                    >
                    {% if comment %}
                        <button
                            type="button"
                            class="btn btn-secondary float-end mx-2"
                            hx-get="{{comment.get_absolute_url}}"
                            hx-trigger="click"
                        >Cancel</button>
                    {% endif %}
                </div>
            </div>
        </form>
    {% endif %}
{% endif %}
