I’ve just noticed an oddity and come up with a work around that might help others. I was hacking some new UI code together and wanted to have a TitleBox widget that was rolled up by default (so its in the rolled up state when the user first gets to the page - the reason being that its optional data and might be really long). I tried a call to TitleBox like this:
<&|/Widgets/TitleBox, rolledup => 1, title => loc('Changes in my visible change queues being drafted/reworked', ), &>
This didn’t work - the TitleBox was still unrolled. Looking in the code, the TitleBox widget calls the TitleBoxStart widget to build the open HTML for the title box. In TitleBoxStart, the relevant line is:
<div class="titlebox<% $class ? " $class " : "" %><% $rolledup ? " rolled-up" : "" %>" id="<% $id %>">
With the call above it generates the HTML:
<div class="titlebox" id="">
Turns out this behaves oddly. Without specifying a
$class parameter, no
rolled-up output is generated, even if
$rolledup is true. As soon as I give a class, even if it just contains a space character, the rolled up stuff works. So a call like this:
<&|/Widgets/TitleBox, rolledup => 1, class => ' ', title => loc('Changes in my visible change queues being drafted/reworked', ), &>
generates the HTML:
<div class="titlebox rolled-up" id="">
which does what I want.
I can’t see why the logic in TitleBoxStart is wrong, so I assume this is a weirdness of the Mason templating system somehow. But I thought other RT hackers might stumble over this, and the provision of a blank (single space)
$class hack might be useful.