Explicit domains and identities states.

fix #541
This commit is contained in:
Antoine Nguyen
2014-12-03 16:25:37 +01:00
parent ae0662f13c
commit 6f6da61225
6 changed files with 20 additions and 19 deletions
@@ -6,7 +6,7 @@
{% render_field form.password1 %}
{% render_field form.password2 %}
{% if form.domain_is_disabled %}
{% include "common/generic_field.html" with field=form.is_active inline_message=_("Domain is disabled") extra_classes="info" %}
{% include "common/generic_field.html" with field=form.is_active label_width="col-sm-4" inline_message=_("Domain is disabled") %}
{% else %}
{% render_field form.is_active %}
{% endif %}
@@ -1,7 +1,7 @@
{% load i18n admin_tags lib_tags %}
{% for domain in domains %}
<tr id="{{ domain.id }}" class="{% if not domain.enabled %}muted{% endif %}" name="{{ forloop.counter }}">
<td name="name">{% domain_modify_link domain %}</td>
<tr id="{{ domain.id }}" class="{% if not domain.enabled %}text-muted{% endif %}" name="{{ forloop.counter }}">
<td name="name">{% domain_modify_link domain %}{% if not domain.enabled %} ({% trans "disabled" %}){% endif %}</td>
<td name="aliases">{% domain_aliases domain %} </td>
<td name="tags">{% render_tags domain.tags %}</td>
<td name="actions">{% domain_actions user domain %}</td>
@@ -1,7 +1,8 @@
{% load i18n admin_tags lib_tags %}
{% for ident in identities %}
<tr id="{{ ident.id }}" class="{% disable_identity ident %}" name="{{ forloop.counter }}">
<td name="identity">{% identity_modify_link ident %}</td>
{% check_identity_status ident as identity_is_enabled %}
<tr id="{{ ident.id }}" class="{% if not identity_is_enabled %}text-muted{% endif %}" name="{{ forloop.counter }}">
<td name="identity">{% identity_modify_link ident %}{% if not identity_is_enabled %} (disabled){% endif %}</td>
<td name="name_or_rcpt">{{ ident.name_or_rcpt }}</td>
<td name="tags">{% render_tags ident.tags %}</td>
<td name="actions">{% identity_actions user ident %}</td>
@@ -168,19 +168,19 @@ def identity_actions(user, ident):
return render_actions(actions)
@register.simple_tag
def disable_identity(identity):
"""Disable an identity.
Finding this information depends on the identity type.
"""
@register.assignment_tag
def check_identity_status(identity):
"""Check if identity is enabled or not."""
if identity.__class__.__name__ == "User":
if identity.is_active and identity.mailbox_set.count() \
and identity.mailbox_set.all()[0].domain.enabled:
return ""
elif identity.enabled and identity.domain.enabled:
return ""
return "muted"
if identity.mailbox_set.count() \
and not identity.mailbox_set.all()[0].domain.enabled:
return False
elif not identity.is_active:
return False
elif not identity.enabled or not identity.domain.enabled:
return False
return True
@register.simple_tag
def domain_modify_link(domain):
+1 -1
View File
@@ -284,5 +284,5 @@ html body div.navbar div.container-fluid div#navigate-navbar-collapse.collapse u
/* Wizard */
#wizard .carousel-inner {
overflow: visible;
overflow: visible;
}
+1 -1
View File
@@ -26,7 +26,7 @@
<span class="help-block pull-right">{{ field.help_text }}</span>
{% endif %}
{% if inline_message %}
<span class="">{{ inline_message }}</span>
<span class="text-info">{{ inline_message }}</span>
{% endif %}
{% if field.errors %}
<p class="help-block">