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

{% block content %}
    <h2>User content</h2>

    <p>Click "Show content" to load items created by a user.</p>

    <table class="table table-sm">
        <thead>
            <tr>
                <th>Name</th>
                <th>Username</th>
                <th>Content count</th>
                <th>Actions</th>
            </tr>
        </thead>
        <tbody>
            {% for user in users %}
                <tr>
                    <td>{{ user.first_name }} {{ user.last_name }}</td>
                    <td><a href="{% url 'account_profile' user.username %}">{{ user.username }}</a></td>
                    <td>{{ user.content_count }}</td>
                    <td>
                        <button class="btn btn-sm btn-outline-primary"
                                hx-get="{% url 'generic:user_content_review' user.pk %}"
                                hx-target="closest tr"
                                hx-swap="afterend">Show content</button>
                    </td>
                </tr>
            {% endfor %}
        </tbody>
    </table>


{% endblock %}
