mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
Identities:
* Removed 'edit' button * Clicking on an identity name now opens the edit box fixes #213
This commit is contained in:
+7
-1
@@ -54,7 +54,13 @@ class ExtensionsTable(tables.Table):
|
||||
|
||||
class IdentitiesTable(tables.Table):
|
||||
idkey = "id"
|
||||
identity = tables.Column("identity", label=ugettext_noop("Email/Username"))
|
||||
identity = tables.LinkColumn(
|
||||
"identity", label=ugettext_noop("Email/Username"),
|
||||
modal=True,
|
||||
urlpattern={"User" : "modoboa.admin.views.editaccount",
|
||||
"Alias" : "modoboa.admin.views.editdlist"},
|
||||
modalcb={"User" : "editaccount_cb", "Alias" : "dlistform_cb"}
|
||||
)
|
||||
name_or_rcpt = tables.Column("name_or_rcpt", label=ugettext_noop("Fullname/Recipient"))
|
||||
actions = tables.ActionColumn("actions", label=ugettext_noop("Actions"),
|
||||
width="70px", align="center",
|
||||
|
||||
@@ -122,39 +122,23 @@ def domain_actions(user, domid):
|
||||
|
||||
return render_actions(actions)
|
||||
|
||||
@register.simple_tag
|
||||
def account_actions(user, accountid):
|
||||
actions = [
|
||||
{"name" : "editaccount",
|
||||
"url" : reverse(admin.views.editaccount, args=[accountid]),
|
||||
"img" : "icon-edit",
|
||||
"modal" : True,
|
||||
"modalcb" : "editaccount_cb",
|
||||
"title" : _("Edit account")},
|
||||
{"name" : "delaccount",
|
||||
"url" : reverse(admin.views.delaccount) + "?selection=%s" % accountid,
|
||||
"img" : "icon-trash",
|
||||
"title" : _("Delete this account")},
|
||||
]
|
||||
return render_actions(actions)
|
||||
|
||||
@register.simple_tag
|
||||
def identity_actions(user, iid):
|
||||
name, objid = iid.split(':')
|
||||
if name == "User":
|
||||
return account_actions(user, objid)
|
||||
actions = [
|
||||
{"name" : "editdlist",
|
||||
"url" : reverse(admin.views.editdlist, args=[objid]),
|
||||
"img" : "icon-edit",
|
||||
"modal" : True,
|
||||
"modalcb" : "dlistform_cb",
|
||||
"title" : _("Edit distribution list")},
|
||||
{"name" : "deldlist",
|
||||
"url" : reverse(admin.views.deldlist) + "?selection=%s" % objid,
|
||||
"img" : "icon-trash",
|
||||
"title" : _("Delete this distribution list")},
|
||||
]
|
||||
actions = [
|
||||
{"name" : "delaccount",
|
||||
"url" : reverse(admin.views.delaccount) + "?selection=%s" % objid,
|
||||
"img" : "icon-trash",
|
||||
"title" : _("Delete this account")},
|
||||
]
|
||||
else:
|
||||
actions = [
|
||||
{"name" : "deldlist",
|
||||
"url" : reverse(admin.views.deldlist) + "?selection=%s" % objid,
|
||||
"img" : "icon-trash",
|
||||
"title" : _("Delete this distribution list")},
|
||||
]
|
||||
return render_actions(actions)
|
||||
|
||||
@register.simple_tag
|
||||
|
||||
+8
-2
@@ -74,8 +74,14 @@ class ActionColumn(Column):
|
||||
|
||||
class LinkColumn(Column):
|
||||
def render(self, rowid, value):
|
||||
linkdef = dict(url=reverse(self.urlpattern, args=[rowid]), label=value,
|
||||
modal=self.modal, modalcb=self.modalcb)
|
||||
linkdef = dict(label=value, modal=self.modal)
|
||||
if type(self.urlpattern) == dict:
|
||||
t, value = rowid.split(":")
|
||||
linkdef.update(url=reverse(self.urlpattern[t], args=[value]),
|
||||
modalcb=self.modalcb[t])
|
||||
else:
|
||||
linkdef.update(url=reverse(self.urlpattern, args=[rowid]),
|
||||
modalcb=self.modalcb)
|
||||
return render_link(linkdef)
|
||||
|
||||
class Table(object):
|
||||
|
||||
Reference in New Issue
Block a user