diff roundup/cgi/templating.py @ 8291:ae7fadcac9e1

fix: issue2551231 - template.py-HTMLClass::classhelp doesn't merge user defined classes. It now merges them in. Also fixed same issue in popcal().
author John Rouillard <rouilj@ieee.org>
date Sat, 18 Jan 2025 22:20:38 -0500
parents 46886073c665
children 4aa34c826fc4
line wrap: on
line diff
--- a/roundup/cgi/templating.py	Sat Jan 18 19:08:16 2025 -0500
+++ b/roundup/cgi/templating.py	Sat Jan 18 22:20:38 2025 -0500
@@ -981,10 +981,18 @@
                     group, sort, pagesize, filter)
         onclick = "javascript:help_window('%s', '%s', '%s');return false;" % \
                   (help_url, width, height)
-        return ('<a class="classhelp" data-helpurl="%s" '
+
+        if 'class' in html_kwargs:
+            html_classes = ("classhelp %s" %
+                            html_escape(str(html_kwargs["class"]), True))
+            del html_kwargs["class"]
+        else:
+            html_classes = "classhelp"
+
+        return ('<a class="%s" data-helpurl="%s" '
                 'data-width="%s" data-height="%s" href="%s" '
                 'target="_blank" onclick="%s" %s>%s</a>') % (
-                    help_url, width, height,
+                    html_classes, help_url, width, height,
                     help_url, onclick, self.cgi_escape_attrs(**html_kwargs),
                     self._(label))
 
@@ -2446,9 +2454,16 @@
             "data-height": height
         }
 
-        return ('<a class="classhelp" %s href="javascript:help_window('
+        if 'class' in html_kwargs:
+            html_classes = ("classhelp %s" %
+                            html_escape(str(html_kwargs["class"]), True))
+            del html_kwargs["class"]
+        else:
+            html_classes = "classhelp"
+
+        return ('<a class="%s" %s href="javascript:help_window('
                 "'%s?@template=calendar&amp;property=%s&amp;form=%s%s', %d, %d)"
-                '">%s</a>' % (self.cgi_escape_attrs(**data_attr),
+                '">%s</a>' % (html_classes, self.cgi_escape_attrs(**data_attr),
                               self._classname, self._name, form, date, width,
                               height, label))
 

Roundup Issue Tracker: http://roundup-tracker.org/