rezometz/django-paiji2-social

View on GitHub
paiji2_social/templates/social/directory.html

Summary

Maintainability
Test Coverage
{% extends "social/directory_base.html" %}

{% load bootstrap3 %}
{% load i18n %}
{% load profile %}
{% load gravatar %}

{% block title %}

{% trans 'User Directory' %}
{% if q %}
    | {{ q }}
{% endif %}

{% endblock %}

{% block usersbtnclass %}
active
{% endblock %}

{% block form %}

<div class="row">
    <div class="col col-md-12">
        <h2>{% trans 'User Directory' %}</h2>
    </div>
</div>


<div class="row">
    <div class="col col-md-12 centered">
        <form role="search" method="GET"
        name="search" action="{{ request.path }}" >
            <div class="input-group">
                <span class="input-group-addon">
                    <i class="glyphicon glyphicon-search"></i>
                    {% trans 'search' %}
                </span>
                <input class="form-control" name="q" title="search" type="text" value="{{ q }}"/>
            </div>
        </form>
        <br/>
    </div>
</div>

{% endblock %}

{% block results %}

{% if is_paginated %}
<div class="row">
    <div class="col col-md-12 centered pagination-container">
        {% bootstrap_pagination page_obj url=request.get_full_path %}
    </div>
</div>
{% endif %}

<div class="row">
<div class="col col-md-12">
<table class="table table-condensed table-striped">
    <thead>
        <tr>
            <th>{% trans 'Profile' %}/{% trans 'Pseudo' %}</th>
            <th>{% trans 'First name' %}</th>
            <th>{% trans 'Last name' %}</th>
            <th>{% trans 'School' %}/{% trans 'Class' %}</th>
            <th>{% trans 'Room' %}</th>
            <th>{% trans 'Email' %}</th>
        </tr>
    </thead>
    <tbody>
    {% for user in users %}
        <tr>
            <td>
                <a class="logo"
                title="{% trans 'view profile' %}"
                href="{% profile_url user %}" >
                    {% gravatar user.email 30 %}
                </a>
                <a title="{% trans 'view profile' %}"
                href="{% profile_url user %}" >
                                    {{ user.username }}
                </a>
            </td>
            <td><strong>{{ user.first_name }}</strong></td>
            <td>
                    <p class="text-uppercase">
                        {{ user.last_name }}
                    </p>
            </td>
            {% if user.get_rezo %}
                <td>
                    {{ user.get_rezo.ecole }}
                    {{ user.get_rezo.precisionecole }}
                </td>
                <td>{{ user.get_room }}</td>
            {% else %}
                <td></td>
                <td></td>
            {% endif %}
            <td>
                <a href="mailto:{{ user.email|urlencode }}"
                title="{{ _('Send a mail to')|add:' '|add:user.first_name|add:' '|add:user.last_name }}"
                >
                    {{ user.email }}
                </a>
            </td>
        </tr>
        {% empty %}
        <tr class="inactive">
            <td><span class="label label-defaul label-danger">{% trans 'no result' %}</span></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
    {% endfor %}
    </tbody>
</table>
</div><!-- col -->
</div><!-- row -->

{% if is_paginated %}
<div class="row">
    <div class="col col-md-12 centered pagination-container">
        {% bootstrap_pagination page_obj url=request.get_full_path %}
    </div>
</div>
{% endif %}

{% endblock %}