content/static/html/helpers: split directory template
A helper template is added to _unit_directories.tmpl.
Trust: Julie Qiu
Run-TryBot: Julie Qiu
TryBot-Result: kokoro
<div class="UnitDirectories-expandButton js-expandAllDirectories">
<button>Expand all</button>
</div>
- {{- if .Directories -}}
+ {{if .Directories}}
<table class="UnitDirectories-table UnitDirectories-table--tree js-expandableTable" data-test-id="UnitDirectories-table">
<tr class="UnitDirectories-tableHeader UnitDirectories-tableHeader--tree">
<th>Path</th>
<th class="UnitDirectories-desktopSynopsis">Synopsis</th>
</tr>
- {{- range .Directories -}}
- {{- $prefix := .Prefix -}}
+ {{range .Directories}}
+ {{template "directory" .}}
+ {{end}}
+ </table>
+ {{end}}
+ </div>
+{{end}}
+
+{{define "directory"}}
+ {{$prefix := .Prefix}}
<tr{{if .Subdirectories}} data-aria-controls="{{range .Subdirectories}}{{$prefix}}-{{.Suffix}} {{end}}"{{end}}>
<td data-id="{{$prefix}}" data-aria-owns="{{range .Subdirectories}}{{$prefix}}-{{.Suffix}} {{end}}">
<div class="UnitDirectories-pathCell">
<td class="UnitDirectories-desktopSynopsis">{{.Synopsis}}</td>
{{- end -}}
</tr>
- {{- end -}}
- </table>
- {{- end -}}
- </div>
{{end}}
{{define "legacy_unit_directories"}}
