* 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:
Antoine Nguyen
2012-04-06 09:48:59 +02:00
parent 4e78f6b01a
commit 67ec55beac
5 changed files with 23 additions and 49 deletions
+11
View File
@@ -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"] != "" \