mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-20 06:08:35 +02:00
* Using 'icon-trash' to represent 'delete' actions (fixes #210)
* A simple click on a domain name opens the edit box (fixes #209) * No more creation and modification dates in the listing (fixes #211) * Fixed an issue with modal boxes
This commit is contained in:
@@ -10,9 +10,11 @@ output (using standard tags like <table> and co.).
|
||||
"""
|
||||
import inspect
|
||||
import lxml
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.template import Template, RequestContext, Context
|
||||
from django.template.loader import render_to_string
|
||||
from templatetags.libextras import render_link
|
||||
|
||||
class Column:
|
||||
"""Simple column representation
|
||||
@@ -70,6 +72,12 @@ class ActionColumn(Column):
|
||||
def render(self, fct, user, rowid):
|
||||
return fct(user, rowid)
|
||||
|
||||
class LinkColumn(Column):
|
||||
def render(self, rowid, value):
|
||||
linkdef = dict(url=reverse(self.urlpattern, args=[rowid]), label=value,
|
||||
modal=self.modal, modalcb=self.modalcb)
|
||||
return render_link(linkdef)
|
||||
|
||||
class Table(object):
|
||||
tableid = ""
|
||||
|
||||
@@ -133,6 +141,9 @@ class Table(object):
|
||||
elif isinstance(c, ActionColumn):
|
||||
newcol["value"] = c.render(c.defvalue, self.request.user, nrow["id"])
|
||||
newcol["safe"] = True
|
||||
elif isinstance(c, LinkColumn):
|
||||
newcol["value"] = c.render(nrow["id"], row[c.name])
|
||||
newcol["safe"] = True
|
||||
elif row.has_key(c.name):
|
||||
if "class" in row.keys():
|
||||
newcol["cssclass"] += newcol["cssclass"] != "" \
|
||||
|
||||
Reference in New Issue
Block a user