Skip to content

Commit 599ce93

Browse files
committed
fix: issue2551231 - template.py-HTMLClass::classhelp doesn't merge user defined classes.
It now merges them in. Also fixed same issue in popcal().
1 parent c31c2b2 commit 599ce93

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ Features:
124124
Rouillard)
125125
- Use native number type input for Number() and Integer()
126126
properties. Integer() uses step=1 as well. (John Rouillard)
127+
- issue2551231 - template.py-HTMLClass::classhelp doesn't merge
128+
user defined classes. It now merges them in. Also fixed same
129+
issue in popcal(). (John Rouillard)
127130

128131
2024-07-13 2.4.0
129132

roundup/cgi/templating.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -981,10 +981,18 @@ def classhelp(self, properties=None, label=''"(list)", width='500',
981981
group, sort, pagesize, filter)
982982
onclick = "javascript:help_window('%s', '%s', '%s');return false;" % \
983983
(help_url, width, height)
984-
return ('<a class="classhelp" data-helpurl="%s" '
984+
985+
if 'class' in html_kwargs:
986+
html_classes = ("classhelp %s" %
987+
html_escape(str(html_kwargs["class"]), True))
988+
del html_kwargs["class"]
989+
else:
990+
html_classes = "classhelp"
991+
992+
return ('<a class="%s" data-helpurl="%s" '
985993
'data-width="%s" data-height="%s" href="%s" '
986994
'target="_blank" onclick="%s" %s>%s</a>') % (
987-
help_url, width, height,
995+
html_classes, help_url, width, height,
988996
help_url, onclick, self.cgi_escape_attrs(**html_kwargs),
989997
self._(label))
990998

@@ -2446,9 +2454,16 @@ def popcal(self, width=300, height=200, label="(cal)",
24462454
"data-height": height
24472455
}
24482456

2449-
return ('<a class="classhelp" %s href="javascript:help_window('
2457+
if 'class' in html_kwargs:
2458+
html_classes = ("classhelp %s" %
2459+
html_escape(str(html_kwargs["class"]), True))
2460+
del html_kwargs["class"]
2461+
else:
2462+
html_classes = "classhelp"
2463+
2464+
return ('<a class="%s" %s href="javascript:help_window('
24502465
"'%s?@template=calendar&amp;property=%s&amp;form=%s%s', %d, %d)"
2451-
'">%s</a>' % (self.cgi_escape_attrs(**data_attr),
2466+
'">%s</a>' % (html_classes, self.cgi_escape_attrs(**data_attr),
24522467
self._classname, self._name, form, date, width,
24532468
height, label))
24542469

0 commit comments

Comments
 (0)