Merge pull request #702 from vingeni/master

improved: webmail compose form
This commit is contained in:
Antoine Nguyen
2015-04-08 16:34:40 +02:00
@@ -2,42 +2,67 @@
<form class="form-horizontal" method="POST" action="{{ posturl }}" id="composemail">
{% csrf_token %}
<div id="compose-container">
<div id="mailheader">
<div class="form-group{% if form.errors.to %} has-error{% endif %}">
{# handling to field #}
<label class="col-sm-1 control-label" for="id_to">{% trans "To" %}</label>
<div class="col-sm-8">
<input id="id_to" name="to" class="form-control" value="{% if form.to.value %}{{ form.to.value }}{% endif %}"{% if form.to.errors %} placeholder="{% for error in form.to.errors %}{{ error }}{% endfor %}" title="{% for error in form.to.errors %}{{ error }}{% endfor %}"{% endif %}>
<input id="id_to" name="to" class="form-control" value="{% if form.to.value %}{{ form.to.value }}{% endif %}" placeholder="{% trans 'This field is required' %}">
{% if form.to.errors %}
{% for error in form.to.errors %}
<p class="help-block">{{ error }}</p>
{% endfor %}
{% endif %}
</div>
{% if not form.cc.value %}
{# handling cc and cci buttons #}
{% if not form.cc.value or not form.cci.valie %}
<div class="col-sm-2">
<button id="add_cc" class="btn btn-default btn-xs"><span class="fa fa-plus"></span> {% trans "Cc" %}</button>
<button id="add_cci" class="btn btn-default btn-xs"><span class="fa fa-plus"> {% trans "Cci" %}</span></button>
{% if not form.cc.value %}
<button id="add_cc" class="btn btn-default btn-xs">
<span class="fa fa-plus"></span> {% trans "Cc" %}
</button>
{% endif %}
{% if not form.cci.value %}
<button id="add_cci" class="btn btn-default btn-xs">
<span class="fa fa-plus"> {% trans "Cci" %}</span>
</button>
{% endif %}
</div>
{% endif %}
{% endif %}
</div>
{# display cc field when required #}
{% if form.cc.value %}
{% render_field form.cc label_width="col-sm-1" %}
{% render_field form.cci label_width="col-sm-1" %}
{% else %}
{% render_field form.cc label_width="col-sm-1" hidden=True %}
{% endif %}
{# display cci field when required #}
{% if form.cci.value %}
{% render_field form.cci label_width="col-sm-1" %}
{% else %}
{% render_field form.cci label_width="col-sm-1" hidden=True %}
{% endif %}
{% render_field form.subject label_width="col-sm-1" %}
</div>
<div id="body_container">
{% if body %}
<textarea id="id_body" name="body" class="form-control editor">{% if bodyheader %}{{ bodyheader }}{% endif %}
<textarea id="id_body" name="body" class="form-control editor">
{% if bodyheader %}{{ bodyheader }}{% endif %}
{{ body }}
</textarea>
{% else %}
<textarea id="id_body" name="body" class="form-control editor"></textarea>
{% endif %}
</div>
</div>
</div>
</form>