blob: d19b99f35a1f7c77e00551b2119cbbeb959c6d35 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
{{/*
Determine the optimal number of columns based on the number of entries.
Parameters:
- length: INTEGER
- scratch: (Scratch)
*/}}
{{ if eq .length 1 }}
{{ .scratch.Set "col-lg" "12" }}
{{ .scratch.Set "col-md" "12" }}
{{ else if eq .length 2 }}
{{ .scratch.Set "col-lg" "6" }}
{{ .scratch.Set "col-md" "6" }}
{{ else if or (eq .length 4) (or (eq .length 7) (eq .length 8)) }}
{{ .scratch.Set "col-lg" "3" }}
{{ .scratch.Set "col-md" "6" }}
{{ else }}
{{ .scratch.Set "col-lg" "4" }}
{{ .scratch.Set "col-md" "6" }}
{{ end }}
{{ .scratch.Set "col_layout" (printf "col-lg-%s col-md-%s" (.scratch.Get "col-lg") (.scratch.Get "col-md")) }}
{{ .scratch.Delete "col-md" }}
{{ .scratch.Delete "col-lg" }}
|