fix the build-checkboxes function

This commit is contained in:
2025-05-29 11:07:23 -04:00
parent 368bd1236f
commit 321bc5d833

View File

@@ -540,33 +540,29 @@ function Build-Checkboxes {
( (
$Global:Tasks | $Global:Tasks |
Where-Object Page -EQ $Page | Where-Object Page -EQ $Page |
Where-Object Column -EQ $Column | Where-Object Column -EQ $Column |
ForEach-Object { ForEach-Object {
$taskId = $_.Id $taskId = $_.Id
$tooltip = if ($_.PSObject.Properties.Name -contains 'Tooltip' -and $_.Tooltip) {
" title='$($_.Tooltip)'"
} else { '' }
# if the task has a Tooltip property, build a title attribute $html = "<label$tooltip><input type='checkbox' id='$taskId' name='$($_.Name)' data-column='$Column'> $($_.Label)</label>"
$titleAttr = if ($_.PSObject.Properties.Name -contains 'Tooltip' -and $_.Tooltip) {
" title='$($_.Tooltip)'"
} else {
''
}
# inject the title attribute into the <label>
$html = "<label$titleAttr><input type='checkbox' id='$taskId' name='$($_.Name)' data-column='$Column'> $($_.Label)</label>"
if ($_.SubOptions) { if ($_.SubOptions) {
$subHtml = $_.SubOptions | ForEach-Object { # join inside the codeblock is fine
"<label style='margin-left:20px; display:block;'> $subHtml = $_.SubOptions |
<input type='checkbox' class='sub-option-$taskId' name='$($_.Value)' value='$($_.Value)'> $($_.Label) ForEach-Object {
</label>" "<label style='margin-left:20px; display:block;'>
} -join "`n" <input type='checkbox' class='sub-option-$taskId' name='$($_.Value)' value='$($_.Value)'> $($_.Label)
</label>"
} -join "`n"
$html += @" $html += @"
<div id='${taskId}OptionsContainer' style='display:none; margin-top:4px;'> <div id='${taskId}OptionsContainer' style='display:none; margin-top:4px;'>
$subHtml $subHtml
</div> </div>
"@ "@
} }
@@ -576,6 +572,7 @@ $subHtml
} }
### Get SVSMSP module version to display in the UI ### Get SVSMSP module version to display in the UI
function Get-ModuleVersionHtml { function Get-ModuleVersionHtml {
$mod = Get-Module -ListAvailable -Name SVSMSP | Sort-Object Version -Descending | Select-Object -First 1 $mod = Get-Module -ListAvailable -Name SVSMSP | Sort-Object Version -Descending | Select-Object -First 1