{{ define "cat-boxes" }} {{ $a := .ActiveCategory }}{{ if not $a }}{{ $a = "" }}{{ end }} {{ end }} {{/* pub-publisher is a publication entry's outlet: a link to the story where the entry has one, else to the outlet's page - which a partner that only reported has none of. */}} {{ define "pub-publisher" -}} {{ if .Pub.Link }}{{ .Pub.Publisher }} ↗ {{- else if .Pub.ReportingOnly }}{{ .Pub.Publisher }} {{- else }}{{ .Pub.Publisher }}{{ end }} {{- end }} {{ define "sort-th" }}{{ if .URL }}{{ .Label }} {{ if .Active }}{{ if .Desc }}▼{{ else }}▲{{ end }}{{ else }}↕{{ end }}{{ else }}{{ .Label }}{{ end }}{{ end }} {{ define "doc-table" }}
{{ range .TableHeads }}{{ template "sort-th" . }}{{ end }} {{ if .RowsHTML }}{{ .RowsHTML }}{{ else }}{{ range .TableRows }}{{ template "doc-table-row" . }}{{ end }}{{ end }}
{{ end }} {{/* The rows are rendered once for every reader, so a FOIA release's links always name every collection: they must list the release itself. */}} {{ define "doc-table-row" }}{{ $qs := "" }}{{ if eq .Collection "foia" }}{{ $qs = wholeArchiveQS }}{{ end }} {{ .Title }} [pdf] {{ if .DocMeta.Creator }}{{ .DocMeta.Creator }}{{ else }}-{{ end }} {{ with .DocMeta.DateCreated }}{{ . }}{{ else }}-{{ end }} {{- $first := true -}} {{- range .Publication -}} {{- if .DatePublished -}} {{- if not $first -}}, {{ end -}} {{ .DatePublished }} {{- $first = false -}} {{- end -}} {{- end -}} {{- if $first -}}-{{- end -}} {{ facetLinks (dict "Vals" .DocMeta.Classification "Cat" "classification" "QS" $qs) }} {{ facetLinks (dict "Vals" .DocMeta.Dissemination "Cat" "dissemination" "QS" $qs) }} {{ facetLinks (dict "Vals" .DocMeta.Programs "Cat" "program" "QS" $qs) }} {{ facetLinks (dict "Vals" .DocMeta.Countries "Cat" "country" "QS" $qs) }} {{ facetLinks (dict "Vals" .DocMeta.People "Cat" "people" "QS" $qs) }} {{ facetLinks (dict "Vals" .JournalistsDeduped "Cat" "journalist" "QS" $qs) }} {{- $first = true -}} {{- range .Publication -}} {{- if .Publisher -}} {{- if not $first -}}, {{ end -}} {{ template "pub-publisher" (dict "Pub" . "QS" $qs) }} {{- $first = false -}} {{- end -}} {{- end -}} {{- if $first -}}-{{- end -}} {{ template "type-badge" .Type }} {{ if and .MarkReported .ReportedIssue }}reported{{ end }} {{ end }} {{ define "doc-cards" }} {{ end }} {{ define "type-filter" }}
{{ range $k, $vals := .Params }} {{ if and (ne $k "type") (ne $k "p") (ne $k "action") }} {{ range $vals }} {{ end }} {{ end }} {{ end }} Show: {{ range $type, $count := .AllTypes }} {{ end }}
{{ end }} {{ define "pagination" }} {{ if gt .TotalPages 1 }} {{ $sortParam := "" }}{{ if .Sort }}{{ $sortParam = print "&sort=" .Sort }}{{ end }} {{ $orderParam := "" }}{{ if .Order }}{{ $orderParam = print "&order=" .Order }}{{ end }} {{ end }} {{ end }} {{ define "timeline-hist" }}

{{ .Label }} ({{ len .Bars }} years)

{{ range .Bars }} {{ if .URL }} {{ .Count }} {{ .Year }} {{ else }} {{ .Count }} {{ .Year }} {{ end }} {{ end }}
{{ end }} {{ define "sort-bar" }} {{ $base := .SortURL }} {{ $order := .Order }} {{ $showRelevance := .ShowRelevance }} {{ $cur := .SortBy }} {{ if eq $cur "" }}{{ $cur = .DefaultSort }}{{ end }} {{ $activeLabel := sortLabel $cur }} {{ $directed := ne $cur "relevance" }} {{ $orderLabel := "↑" }}{{ if eq $order "desc" }}{{ $orderLabel = "↓" }}{{ end }}
Sort: {{ $activeLabel }} {{ if $directed }}{{ end }}
{{ end }} {{ define "type-badge" }} {{ if eq . "FOIA" }} FOIA {{ else if eq . "SIDTODAY" }} SIDtoday {{ end }} {{ end }} {{ define "lightbox-overlays" }} {{ $lbBase := .ImageBase }}{{ $lbN := len .Images }} {{ range $i, $img := .Images }} {{ end }} {{ end }} {{ define "changed-page-links" }} {{- $v := . -}} {{- range $k, $p := .ChangedPages -}} {{- if $k }}, {{ end -}} {{- if $p.Pos }}{{ $p.Page }}{{ else }}{{ $p.Page }}{{ end -}} {{- end -}} {{ end }} {{ define "doc-viewport" }}
{{ if gt (len .Images) 1 }} {{ end }}
{{ if .Prefs.TextOnly }}

Text-only mode is on - page images are not loaded. Preferences

{{ else }} {{ range $i, $img := .Images }} Page {{ add $i 1 }} {{- if and $.Version ($.Version.PageChanged (add $i 1)) }}differs{{ end }} {{ end }} {{ end }}
{{ .Content }}
{{ end }}