<h1>
    Categories
    <a class="btn btn-lg btn-success pull-right" href="{{ url_for('redberry.new_record', model_name='category') }}">
        <span class="glyphicon glyphicon-plus"></span>
        Add New
    </a>
</h1>

{% if not objects %}
    No categories yet.
{% else %}
    <table class="table table-striped table-hover">
        <thead>
            <tr>
                <th>#</th>
                <th>Title</th>
                <th>Description</th>
                <th>Created</th>
                <th>Action</th>
            </tr>
        </thead>

        <tbody>
            {% for category in objects %}
                <tr>
                    <td>{{ category.id }}</td>
                    <td><a href="{{ url_for('redberry.show_category', category_slug=category.slug) }}" target="_blank">{{ category.title | safe }}</a></td>
                    <td>{{ category.summarise(20) }}</td>
                    <td>{{ category.created_at | pretty_date }}</td>
                    <td>
                        <a href="{{ url_for('redberry.edit_record', model_name='category', slug=category.slug) }}">Edit</a>
                        <a href="{{ url_for('redberry.edit_record', model_name='category', slug=category.slug) }}" data-method="delete">
                            Delete
                        </a>
                    </td>
                </tr>
            {% endfor %}
        </tbody>

    </table>
{% endif %}