mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-18 05:51:26 +02:00
improved: webmail compose form now displays cc/cci only when required
improved: webmail compose form error messages on To field are more clear
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ class EmailListValidator(object):
|
||||
value = force_text(value)
|
||||
emails = [unicode.strip(email) for email in value.split(",")]
|
||||
addresses = getaddresses(emails)
|
||||
[validate_email(e) for r, e in addresses.values]
|
||||
[validate_email(e) for r, e in addresses]
|
||||
|
||||
validate_email_list = EmailListValidator()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user