Skip to content

Commit 18580e6

Browse files
committed
Fix height calculation for Multilink.menu()
1 parent c7bce41 commit 18580e6

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

roundup/cgi/templating.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2083,7 +2083,18 @@ def menu(self, size=None, height=None, showid=0, additional=[],
20832083
for opt in linkcl.filter(None, conditions, sort_on)
20842084
if self._db.security.hasPermission("View", self._client.userid,
20852085
linkcl.classname, itemid=opt)]
2086-
height = height or min(len(options), 7)
2086+
2087+
# make sure we list the current values if they're retired
2088+
for val in value:
2089+
if val not in options:
2090+
options.insert(0, val)
2091+
2092+
if not height:
2093+
height = len(options)
2094+
if value:
2095+
# The "no selection" option.
2096+
height += 1
2097+
height = min(height, 7)
20872098
l = ['<select multiple name="%s" size="%s">'%(self._formname, height)]
20882099
k = linkcl.labelprop(1)
20892100

0 commit comments

Comments
 (0)