{% extends 'twitter/base.html' %}

{% block breadcrumbs %}
    <li class="breadcrumb-item"><a href="{% url 'ditto:home' %}">Home</a></li>
    <li class="breadcrumb-item"><a href="{% url 'twitter:home' %}">Twitter</a></li>
    <li class="breadcrumb-item"><a href="{% url 'twitter:user_detail' screen_name=twitter_user.screen_name %}">{{ twitter_user }}</a></li>
    <li class="breadcrumb-item active">Tweet</li>
{% endblock %}

{% block content %}

    <h1 class="my-4">
        {% block title %}
            A Tweet by {{ twitter_user.name }}
        {% endblock %}
        <small class="text-muted">{{ twitter_user }}</small>
    </h1>

    <div class="row">
        <div class="col-md-9">
            {% if twitter_user.is_private %}
                {# The `tweet` object will be None, too. #}
                <p>This user is private.</p>
            {% else %}

                <hr>
                <div class="media mt-0 twitter-tweet twitter-tweet-detail">
                    {% include 'twitter/includes/tweet.html' with tweet=tweet view='detail' perms=perms only %}
                </div>
                <hr>

                <nav>
                    <p>
                        {% with tweet.get_previous as previous_tweet %}
                            {% with tweet.get_next as next_tweet %}
                                {% if previous_tweet or next_tweet %}
                                    {% if previous_tweet %}
                                        <a href="{% url 'twitter:tweet_detail' screen_name=previous_tweet.user.screen_name twitter_id=previous_tweet.twitter_id %}" title="Previous Tweet" class="btn btn-outline-primary">
                                            &larr; Previous
                                        </a>
                                    {% endif %}
                                    {% if next_tweet %}
                                        <a href="{% url 'twitter:tweet_detail' screen_name=next_tweet.user.screen_name twitter_id=next_tweet.twitter_id %}" title="Next Tweet" class="btn btn-outline-primary float-right">
                                            Next &rarr;
                                        </a>
                                    {% endif %}
                                {% endif %}
                            {% endwith %}
                        {% endwith %}
                    </p>
                </nav>

            {% endif %}
        </div> <!-- .col -->

        <div class="col-md-3">
            {% include 'twitter/includes/user.html' with user=twitter_user account=account perms=perms only %}
        </div> <!-- .col -->
    </div> <!-- .row -->

{% endblock content %}

