{% extends "forum/post_list.html" %}
{% load crispy_forms_tags %}

{% block head %}
    <script>
        $('#confirm-delete').on('show.bs.modal', function (e) {
            $(this).find('.btn-ok').attr('href', $(e.relatedTarget).data('href'));
        });
    </script>
{% endblock %}

{% block title %}
    Delete Topic
{% endblock title %}


{% load django_bootstrap_breadcrumbs %}

{% block breadcrumbs %}
    {{ block.super }}
    {% breadcrumb "Delete" "forum:topic_delete" topic.slug %}

{% endblock breadcrumbs %}




{% block content %}
    {% render_breadcrumbs %}


    <div class="col-sm-6 col-sm-offset-3">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">Delete {{ tribe }}</h3>
            </div>
            <div class="panel-body">
                <p>Are you sure you want to delete "{{ object }}"?
                    {% if object.post.count %}
                        You'll be deleting {{ object.post_set.count }} posts and {{ object.reply_set.count }} replies!
                    {% endif %}</p>
                <button class="btn btn-danger pull-right" data-href="/" data-toggle="modal"
                        data-target="#confirm-delete">
                    Delete Topic
                </button>
                <a href="{% url 'forum:topic_posts' object.slug %}">
                    <button type="button" class="btn btn-default">Cancel</button>
                </a>

            </div>
            <!--panel body--!>
				</div><!--panel-->
        </div>
        <!--/col-->


        <div class="modal fade" id="confirm-delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
             aria-hidden="true"><!--modal-->
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title">Warning!</h4>
                    </div>
                    <div class="modal-body">
                        Once deleted, this cannot be undone.
                    </div>
                    <div class="modal-footer">
                        <form action="" method="post">
                            {% csrf_token %}
                            <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                            <input type="submit" class="btn btn-danger" value="Delete"/>
                        </form>
                    </div>
                </div>
                <!--/modal-->
            </div>
        </div>



{% endblock content %}