{% extends 'textdocs/base.html' %}
{% block content %}
    <a href="{% url 'document_create' %}" class="btn btn-primary mb-3">Create New Document</a>
    
    <div class="list-group">
    {% for doc in documents %}
        <a href="{{ doc.get_absolute_url }}" class="list-group-item list-group-item-action">
            <div class="d-flex w-100 justify-content-between">
                <h5 class="mb-1">{{ doc.title }}</h5>
                <!-- MODIFIED: Added author username -->
                <small class="text-muted">By: {{ doc.author.nombre }}</small>
            </div>
            <small class="text-muted">Created on: {{ doc.created_at|date:"F j, Y" }}</small>
        </a>
    {% empty %}
        <p>No documents found. Create your first one!</p>
    {% endfor %}
    </div>
{% endblock %}