New tags to simplify the reading of the identities listing.

see #319
This commit is contained in:
Antoine Nguyen
2013-01-11 17:07:48 +01:00
parent 90fc3b8fd1
commit 3b800271fb
3 changed files with 18 additions and 2 deletions
+15
View File
@@ -176,6 +176,12 @@ class User(DUser):
val1 = raw_value
return constant_time_compare(val1, val2)
@property
def metainfo(self):
ret = '<span class="label">%s</span>' % _("account")
ret += ' <span class="label label-info">%s</span>' % self.group
return ret
@property
def has_mailbox(self):
return len(self.mailbox_set.all()) != 0
@@ -760,6 +766,15 @@ class Alias(DatesAware):
return "%s, ..." % rcpts[0]
return rcpts[0]
@property
def metainfo(self):
cpt = len(self.mboxes.all())
if cpt:
label = _("alias") if cpt == 1 else _("distribution list")
else:
label = _("forward")
return '<span class="label">%s</span>' % label
def save(self, int_rcpts, ext_rcpts, *args, **kwargs):
if len(ext_rcpts):
self.extmboxes = ",".join(ext_rcpts)
+2 -1
View File
@@ -50,6 +50,7 @@ class ExtensionsTable(tables.Table):
class IdentitiesTable(tables.Table):
idkey = "id"
styles = "table"
metainfo = tables.Column("metainfo", label=ugettext_lazy("Tags"), safe=True)
identity = tables.LinkColumn(
"identity", label=ugettext_lazy("Email/Username"),
modal=True,
@@ -61,7 +62,7 @@ class IdentitiesTable(tables.Table):
actions = tables.ActionColumn("actions", label=ugettext_lazy("Actions"),
defvalue=identity_actions)
cols_order = ["identity", "name_or_rcpt", "actions"]
cols_order = ["identity", "name_or_rcpt", "metainfo", "actions"]
def __init__(self, request, identities):
super(IdentitiesTable, self).__init__(request)
+1 -1
View File
@@ -30,7 +30,7 @@ class Column:
label = getattr(self, "label")
except AttributeError:
label = getattr(self, "name")
return _(label)
return label.encode("utf-8")
class SelectionColumn(Column):
"""Specific column: selection