diff --git a/admin/tables.py b/admin/tables.py index b8c9cc304..301e1ea5e 100644 --- a/admin/tables.py +++ b/admin/tables.py @@ -7,10 +7,11 @@ class DomainsTable(tables.Table): tableid = "objects_table" idkey = "id" - name = tables.Column("name", label=ugettext_noop("Name")) - creation = tables.Column("creation", label=ugettext_noop("Created"), width="160px") - modified = tables.Column("last_modification", label=ugettext_noop("Last modified"), - width="160px") + name = tables.LinkColumn( + "name", label=ugettext_noop("Name"), + urlpattern="modoboa.admin.views.editdomain", + title=_("Edit domain"), modal=True, modalcb="domainform_cb" + ) domaliases = tables.Column("domainalias_count", label=ugettext_noop("Domain aliases"), width="100px", align="center") mboxes = tables.Column("mailbox_count", label=ugettext_noop("Mailboxes"), @@ -24,8 +25,7 @@ class DomainsTable(tables.Table): actions = tables.ActionColumn("actions", label=ugettext_noop("Actions"), width="70px", align="center", defvalue=domain_actions) - cols_order = ["name", "creation", "modified", - "domaliases", "mboxes", "mbaliases", + cols_order = ["name", "domaliases", "mboxes", "mbaliases", "quota", "actions"] def __init__(self, request, doms): @@ -52,38 +52,6 @@ class ExtensionsTable(tables.Table): cols_order = ["selection", "name", "version", "descr"] -class AccountsTable(tables.Table): - idkey = "id" - username = tables.Column("username", label=ugettext_noop("User name")) - first_name = tables.Column("first_name", label=ugettext_noop("First name")) - last_name = tables.Column("last_name", label=ugettext_noop("Last name")) - date_joined = tables.Column("date_joined", label=ugettext_noop("Defined")) - enabled = tables.Column("is_active", label=gender("Enabled", "m"), width="10%") - role = tables.Column("group", label=ugettext_noop("Role")) - actions = tables.ActionColumn("actions", label=ugettext_noop("Actions"), - width="70px", align="center", - defvalue=account_actions) - - cols_order = ["username", "first_name", "last_name", "date_joined", - "role", "actions"] - - def __init__(self, request, users): - super(AccountsTable, self).__init__(request) - self.populate(self._rows_from_model(users)) - - def parse_is_active(self, value): - return _("yes") if value else _("no") - - def parse_group(self, value): - if value == "SimpleUsers": - return "U" - return value[:1] - - def row_class(self, request, obj): - if not obj.is_active: - return "muted" - return "" - class IdentitiesTable(tables.Table): idkey = "id" identity = tables.Column("identity", label=ugettext_noop("Email/Username")) diff --git a/admin/templatetags/admin_extras.py b/admin/templatetags/admin_extras.py index 439159915..933e10090 100644 --- a/admin/templatetags/admin_extras.py +++ b/admin/templatetags/admin_extras.py @@ -115,15 +115,9 @@ def identities_menu(user): @register.simple_tag def domain_actions(user, domid): actions = [ - {"name" : "editdomain", - "url" : reverse(admin.views.editdomain, args=[domid]), - "img" : "icon-edit", - "title" : _("Edit domain"), - "modal" : True, - "modalcb" : "domainform_cb"}, {"name" : "deldomain", "url" : reverse(admin.views.deldomain) + "?selection=%s" % domid, - "img" : "icon-remove"}, + "img" : "icon-trash"}, ] return render_actions(actions) @@ -139,7 +133,7 @@ def account_actions(user, accountid): "title" : _("Edit account")}, {"name" : "delaccount", "url" : reverse(admin.views.delaccount) + "?selection=%s" % accountid, - "img" : "icon-remove", + "img" : "icon-trash", "title" : _("Delete this account")}, ] return render_actions(actions) @@ -158,7 +152,7 @@ def identity_actions(user, iid): "title" : _("Edit distribution list")}, {"name" : "deldlist", "url" : reverse(admin.views.deldlist) + "?selection=%s" % objid, - "img" : "icon-remove", + "img" : "icon-trash", "title" : _("Delete this distribution list")}, ] return render_actions(actions) diff --git a/admin/tests.py b/admin/tests.py index 562e4acbb..101df80fa 100644 --- a/admin/tests.py +++ b/admin/tests.py @@ -7,6 +7,7 @@ Liste des tests effectués Permissions ----------- + * Vérifier qu'un admin de domaine qui modifie son propre compte laisse le rôle intact diff --git a/lib/tables.py b/lib/tables.py index 1d07fbda1..a4c931572 100644 --- a/lib/tables.py +++ b/lib/tables.py @@ -10,9 +10,11 @@ output (using standard tags like