{% comment %}
Display information about a Twitter user.
Expects:

* user -- A single Twitter User object.
* account -- Optional, a Twitter Account object if this user has one.
* perms -- Optional, Django perms.

{% endcomment %}

{% load l10n %}

<div class="card twitter-user">
    <div class="card-block">
        <h4 class="card-title m-b-0 twitter-user-name">
            {{ user.name }}
            <small class="text-muted twitter-user-screenname">{{ user }}</small>
        </h4>
    </div>
    <ul class="list-group list-group-flush twitter-user-about">
        {% if user.description %}
            <li class="list-group-item twitter-user-description">{{ user.description_html|safe }}</li>
        {% endif %}
        {% if user.location %}
            <li class="list-group-item twitter-user-location">{{ user.location }}</li>
        {% endif %}
        {% if user.url %}
            <li class="list-group-item twitter-user-url">{{ user.url|cut:"http://"|cut:"https://"|urlizetrunc:15 }}</li>
        {% endif %}
        <li class="list-group-item twitter-user-joined">Joined {{ user.created_at|date:"M Y" }}</li>
        {% if account == None or account.is_active %}
            <li class="list-group-item twitter-user-link"><a href="{{ user.permalink }}">At Twitter.com</a></li>
        {% endif %}
        {% if perms and perms.twitter.can_change_user %}
            <li class="list-group-item"><a href="{% url 'admin:twitter_user_change' user.id %}" title="Edit this user in the Django Admin">Edit</a></li>
        {% endif %}
    </ul>
</div>

<div class="card twitter-user">
    <ul class="list-group list-group-flush twitter-user-counts">
        <li class="list-group-item">{{ user.statuses_count|localize }} Tweet{{ user.statuses_count|pluralize }}</li>
        <li class="list-group-item">{{ user.favorites_count|localize }} Like{{ user.favorites_count|pluralize }}</li>
        <li class="list-group-item">{{ user.followers_count|localize }} Follower{{ user.followers_count|pluralize }}</li>
        <li class="list-group-item">Following {{ user.friends_count|localize }}</li>
        <li class="list-group-item">On {{ user.listed_count|localize }} List{{ user.listed_count|pluralize }}</li>
    </ul>
</div>

<div class="card twitter-user">
    <div class="card-block">
        <p class="card-text text-muted">
            {% load ditto_core %}
            <small>As of {% display_time user.fetch_time %}</small>
        </p>
    </div>
</div>
