rezometz/django-paiji2-shoutbox

View on GitHub
paiji2_shoutbox/templates/shoutbox/message/list.html

Summary

Maintainability
Test Coverage
{% extends "home/layout_three_columns.html" %}

{% load cache %}
{% load shoutbox %}
{% load i18n %}
{% load bootstrap3 %}
{% load profile %}

{% block title%}{% trans 'Shoutbox' %}{% endblock %}

{% block content %}
<div class="well">
    <h3>{% trans 'Shoutbox' %} — {% trans 'Records' %}</h3>

    <div class="pagination-container">
        {% bootstrap_pagination page_obj %}
    </div>

    <form action="{% url 'message-add' %}" method="post">

        {% csrf_token %}

        <div class="input-group">
            <span class="input-group-addon">
                <i class="glyphicon glyphicon-envelope"></i>
                {{ request.user.first_name }}
            </span>
            {% bootstrap_field form.message show_label=False %}
            <input type="hidden" value="{{ request.get_full_path }}" name="next" />
        </div>

        <br/>

        {% buttons %}
        <button type="submit" class="btn btn-success btn-block">{% trans 'publish' %}</button>
        {% endbuttons %}

        <div class="clearfix"></div>
    </form>

    <ul class="list-unstyled">
        {% for note in notes %}
        <li>

            {% profile_link note.author %}

            <span class="pull-right">
                {% if note.author == request.user %}
                    <a href="{% url 'message-edit' note.id %}"><i class="fa fa-pencil"></i></a>
                    <a href="{% url 'message-delete' note.id %}"><i class="fa fa-trash-o"></i></a>
                {% else %}
                    {% with subject='['|add:_('shoutbox')|add:'] '|add:_('About')|add:' : "'|add:note.message|add:'"' %}
                    {% mail_link note.author '' subject %}
                    {% endwith %}
                {% endif %}
            </span>

            {{ note.message|urlize }}

            <span class="text-muted">
                <small>
                    {% blocktrans with TimeSince=note.posted_at|timesince %}{{ TimeSince }} ago{% endblocktrans %}
                </small>
            </span>

        </li>

        <li>
            <hr/>
        </li>

        {% endfor %}
    </ul>

    <div class="pagination-container">
        {% bootstrap_pagination page_obj %}
    </div>
</div>
{% endblock %}