author | sylvain.thenault@logilab.fr |
Fri, 20 Feb 2009 15:06:59 +0100 | |
branch | tls-sprint |
changeset 890 | 3530baff9120 |
parent 861 | 7985b5db2284 |
child 895 | e78ae38506db |
permissions | -rw-r--r-- |
845 | 1 |
from logilab.mtconverter import html_escape |
2 |
from cubicweb.common.uilib import simple_sgml_tag |
|
3 |
class tag(object): |
|
4 |
def __init__(self, name): |
|
5 |
self.name = name |
|
6 |
||
7 |
def __call__(self, __content=None, **attrs): |
|
8 |
return simple_sgml_tag(self.name, __content, **attrs) |
|
9 |
||
10 |
input = tag('input') |
|
11 |
textarea = tag('textarea') |
|
12 |
a = tag('a') |
|
13 |
span = tag('span') |
|
14 |
img = tag('img') |
|
846 | 15 |
label = tag('label') |
861
7985b5db2284
provide a mini HTML select tag constructor
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
846
diff
changeset
|
16 |
|
7985b5db2284
provide a mini HTML select tag constructor
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
846
diff
changeset
|
17 |
def select(name, options=[]): |
7985b5db2284
provide a mini HTML select tag constructor
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
846
diff
changeset
|
18 |
html = [u'<select name="%s">' % name] |
7985b5db2284
provide a mini HTML select tag constructor
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
846
diff
changeset
|
19 |
html += options |
7985b5db2284
provide a mini HTML select tag constructor
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
846
diff
changeset
|
20 |
html.append(u'</select>') |
7985b5db2284
provide a mini HTML select tag constructor
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
846
diff
changeset
|
21 |
return u'\n'.join(html) |
7985b5db2284
provide a mini HTML select tag constructor
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
846
diff
changeset
|
22 |