{% extends 'musette/base_musette.html' %}

{% load i18n %}
{% load static %}
{% load forum_tags %}

{% block content %}

<div class="container">

    <ul class="breadcrumb">
        <li class="active">{% trans "Forums" %}</li>
    </ul>

    {% for category in categories %}
        <table class="table table-striped table-bordered">
            <thead class="topiclist">
                <tr>
                    <th class="forum-name">
                    {{category.name}}</th>
                    <th><i class="fa fa-map-o"></i> {% trans "Topics" %}</th>
                    <th><i class="fa fa-user"></i> {% trans "Users" %}</th>
                    <th><i class="fa fa-history"></i> <span> {% trans "Created"%}</span></th>
                </tr>
            </thead>
            <tbody class="topiclist forums">
                {% for forum in category.idcategory|in_category %}
                      {% if not forum.parent %}
                        <tr>
                            <td class="forum-name" title="No unread posts">
                                <span class="pull-left forum-icon" style="margin-right: 5px">
                                    <a href="{% url 'forum' forum.category forum.name %}" class="btn btn-lg btn-default tooltip-link">
                                        <i class="fa fa-tasks"></i>
                                    </a>
                                </span>
                               
                                <a href="{% url 'forum' forum.category forum.name %}" class="forumtitle"> {{ forum.name }}</a><br>
                                <small>{{ forum.description|safe }}</small>
                            </td>

                            <td><span class="badge">{{ forum.topics_count }}</span></td>
                            <td><span class="badge">{{ forum|get_tot_users_forum }}</span></td>
                            <td><span>
                                <dfn>{{ forum.date }}</dfn>
                            </td>
                        </tr>

                    {% endif %}
                {% empty %}
                    <p> {% trans "There are no forums" %} <p>
                {% endfor %}
        </tbody>
    </table>
    {% empty %}
        <p> {% trans "Please, you add forums and categories in the administrator." %} <p>
    {% endfor %}

</div>

{% endblock %}