rezometz/django-paiji2-shoutbox

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

Summary

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


{% load bootstrap3 %}
{% load i18n %}

{% block title %}
    {% if form.instance and form.instance.pk %}
        {% trans 'Edit a message' %}
    {% else %}
        {% trans 'Publish a message' %}
    {% endif %}
{% endblock %}
{% block content %}
<div class="well">
    {% if form.instance and form.instance.pk %}
    <h3>{% trans 'Edit a message' %}</h3>
    {% else %}
    <h3>{% trans 'Publish a message' %}</h3>
    {% endif %}

    <form action="{{ request.get_full_path }}" 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 %}
        </div>
        <input type="hidden" value="{{ request.META.HTTP_REFERER }}" name="next" />
        <br />
        {% buttons %}
        <button type="submit" class="btn btn-success btn-block">
            {% if form.instance and form.instance.pk %}
                {% trans 'Update' %}
            {% else %}
                {% trans 'Publish' %}
            {% endif %}
        </button>
        {% endbuttons %}
        <div class="clearfix"></div>
    </form>
</div>
{% endblock %}