first commit
This commit is contained in:
commit
8c4dcae475
89 changed files with 24623 additions and 0 deletions
412
templates/partials.html
Normal file
412
templates/partials.html
Normal file
|
|
@ -0,0 +1,412 @@
|
|||
{{ define "cat-boxes" }}
|
||||
{{ $a := .ActiveCategory }}{{ if not $a }}{{ $a = "" }}{{ end }}
|
||||
<nav id="cat-boxes" aria-label="Browse categories">
|
||||
<a href="/browse/program" class="cat-box{{ if eq $a "program" }} cat-box-active{{ end }}"><strong>Programs</strong><span class="count">{{ index .CatCounts "program" }}</span></a>
|
||||
<a href="/browse/journalist" class="cat-box{{ if eq $a "journalist" }} cat-box-active{{ end }}"><strong>Journalists</strong><span class="count">{{ index .CatCounts "journalist" }}</span></a>
|
||||
<a href="/browse/agency" class="cat-box{{ if eq $a "agency" }} cat-box-active{{ end }}"><strong>Agencies</strong><span class="count">{{ index .CatCounts "agency" }}</span></a>
|
||||
<a href="/browse/publisher" class="cat-box{{ if eq $a "publisher" }} cat-box-active{{ end }}"><strong>Publishers</strong><span class="count">{{ index .CatCounts "publisher" }}</span></a>
|
||||
<a href="/browse/country" class="cat-box{{ if eq $a "country" }} cat-box-active{{ end }}"><strong>Countries</strong><span class="count">{{ index .CatCounts "country" }}</span></a>
|
||||
<a href="/browse/people" class="cat-box{{ if eq $a "people" }} cat-box-active{{ end }}"><strong>People</strong><span class="count">{{ index .CatCounts "people" }}</span></a>
|
||||
<a href="/browse/classification" class="cat-box{{ if eq $a "classification" }} cat-box-active{{ end }}"><strong>Classification</strong><span class="count">{{ index .CatCounts "classification" }}</span></a>
|
||||
<a href="/browse/dissemination" class="cat-box{{ if eq $a "dissemination" }} cat-box-active{{ end }}"><strong>Dissemination</strong><span class="count">{{ index .CatCounts "dissemination" }}</span></a>
|
||||
<a href="/browse/published" class="cat-box{{ if eq $a "published" }} cat-box-active{{ end }}"><strong>Pub Year</strong><span class="count">{{ index .CatCounts "published" }}</span></a>
|
||||
<a href="/browse/docdate" class="cat-box{{ if eq $a "docdate" }} cat-box-active{{ end }}"><strong>Doc Date</strong><span class="count">{{ index .CatCounts "docdate" }}</span></a>
|
||||
<a href="/browse/tag" class="cat-box{{ if eq $a "tag" }} cat-box-active{{ end }}"><strong>Tags</strong><span class="count">{{ index .CatCounts "tag" }}</span></a>
|
||||
</nav>
|
||||
{{ 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 }}<a href="{{ .Pub.Link }}" target="_blank" rel="noopener"{{ if or .LinkClass .On }} class="{{ .LinkClass }}{{ if and .LinkClass .On }} {{ end }}{{ if .On }}active{{ end }}"{{ end }}>{{ .Pub.Publisher }} ↗</a>
|
||||
{{- else if .Pub.ReportingOnly }}{{ .Pub.Publisher }}
|
||||
{{- else }}<a href="/browse/publisher/{{ pathEscape .Pub.Publisher }}{{ with .QS }}{{ . }}{{ end }}"{{ if or .PageClass .On }} class="{{ .PageClass }}{{ if and .PageClass .On }} {{ end }}{{ if .On }}active{{ end }}"{{ end }}>{{ .Pub.Publisher }}</a>{{ end }}
|
||||
{{- end }}
|
||||
|
||||
{{ define "sort-th" }}{{ if .URL }}<th{{ with .Class }} class="{{ . }}"{{ end }}><a href="{{ .URL }}">{{ .Label }} {{ if .Active }}{{ if .Desc }}▼{{ else }}▲{{ end }}{{ else }}<span class="sort-hint">↕</span>{{ end }}</a></th>{{ else }}<th{{ with .Class }} class="{{ . }}"{{ end }}>{{ .Label }}</th>{{ end }}{{ end }}
|
||||
|
||||
{{ define "doc-table" }}
|
||||
<div class="table-scroll">
|
||||
<table class="data-table">
|
||||
<thead>
|
||||
<tr>{{ range .TableHeads }}{{ template "sort-th" . }}{{ end }}</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{ if .RowsHTML }}{{ .RowsHTML }}{{ else }}{{ range .TableRows }}{{ template "doc-table-row" . }}{{ end }}{{ end }} </tbody>
|
||||
</table>
|
||||
</div>
|
||||
{{ 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 }}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="/doc/{{ .ID }}"><strong>{{ .Title }}</strong></a>
|
||||
[<a href="/files/{{ .ID }}/{{ pathEscape .PDFFile }}" target="_blank" rel="noopener">pdf</a>]
|
||||
</td>
|
||||
<td>
|
||||
{{ if .DocMeta.Creator }}<a href="/browse/agency/{{ pathEscape .DocMeta.Creator }}{{ $qs }}">{{ .DocMeta.Creator }}</a>{{ else }}-{{ end }}
|
||||
</td>
|
||||
<td>
|
||||
{{ with .DocMeta.DateCreated }}{{ . }}{{ else }}-{{ end }}
|
||||
</td>
|
||||
<td>
|
||||
{{- $first := true -}}
|
||||
{{- range .Publication -}}
|
||||
{{- if .DatePublished -}}
|
||||
{{- if not $first -}}, {{ end -}}
|
||||
{{ .DatePublished }}
|
||||
{{- $first = false -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if $first -}}-{{- end -}}
|
||||
</td>
|
||||
<td>{{ facetLinks (dict "Vals" .DocMeta.Classification "Cat" "classification" "QS" $qs) }}</td>
|
||||
<td>{{ facetLinks (dict "Vals" .DocMeta.Dissemination "Cat" "dissemination" "QS" $qs) }}</td>
|
||||
<td>{{ facetLinks (dict "Vals" .DocMeta.Programs "Cat" "program" "QS" $qs) }}</td>
|
||||
<td>{{ facetLinks (dict "Vals" .DocMeta.Countries "Cat" "country" "QS" $qs) }}</td>
|
||||
<td>{{ facetLinks (dict "Vals" .DocMeta.People "Cat" "people" "QS" $qs) }}</td>
|
||||
<td>{{ facetLinks (dict "Vals" .JournalistsDeduped "Cat" "journalist" "QS" $qs) }}</td>
|
||||
<td>
|
||||
{{- $first = true -}}
|
||||
{{- range .Publication -}}
|
||||
{{- if .Publisher -}}
|
||||
{{- if not $first -}}, {{ end -}}
|
||||
{{ template "pub-publisher" (dict "Pub" . "QS" $qs) }}
|
||||
{{- $first = false -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if $first -}}-{{- end -}}
|
||||
</td>
|
||||
<td>
|
||||
{{ template "type-badge" .Type }}
|
||||
{{ if and .MarkReported .ReportedIssue }}<span class="issue-reported" title="Individually reported - also in the Reported collection">reported</span>{{ end }}
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
|
||||
{{ define "doc-cards" }}
|
||||
<ul class="doc-grid">
|
||||
{{ range .Docs }}
|
||||
<li class="doc-card">
|
||||
|
||||
{{ if $.ShowThumbs }}
|
||||
<div class="thumb-container"{{ if and $.CardPagePreview .Images }} data-pp-id="{{ .ID }}" data-pp-imgs="{{ range $i, $im := .Images }}{{ if $i }} {{ end }}{{ pathEscape $im }}{{ end }}"{{ end }}>
|
||||
<a href="/doc/{{ .ID }}" class="thumb" tabindex="-1" aria-hidden="true">
|
||||
{{ if .HasThumb }}
|
||||
<img src="/files/{{ .ID }}/thumb.jpg"
|
||||
{{ if .HasGifThumb }}data-gif="/files/{{ .ID }}/thumb.gif"{{ end }}
|
||||
class="doc-img"
|
||||
alt="" loading="lazy">
|
||||
{{ end }}
|
||||
</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
<div class="doc-body">
|
||||
{{ $cat := $.ActiveCategory }}{{ $val := $.ActiveValue }}
|
||||
{{/* A FOIA release's links name every collection for a reader who
|
||||
leaves FOIA out: the pages they open must list the release. */}}
|
||||
{{ $qs := "" }}{{ if eq .Collection "foia" }}{{ $qs = $.FOIAQS }}{{ end }}
|
||||
|
||||
<h3>
|
||||
<a href="/doc/{{ .ID }}" class="doc-title">{{ if .Title }}{{ .Title }}{{ else }}<span class="doc-untitled">(untitled)</span>{{ end }}</a>
|
||||
{{ template "type-badge" .Type }}
|
||||
{{ if and $.MarkReported .ReportedIssue }}<span class="issue-reported" title="Individually reported - also in the Reported collection">reported</span>{{ end }}
|
||||
<a href="/files/{{ .ID }}/{{ pathEscape .PDFFile }}" target="_blank" rel="noopener" class="doc-pdf" title="Open PDF">[pdf]</a>
|
||||
{{ if $.ShowUnpin }}
|
||||
<button type="submit" form="unpin-{{ .ID }}" class="link-btn unpin-btn" title="Remove from pinned">★ unpin</button>
|
||||
{{ end }}
|
||||
</h3>
|
||||
{{ if $.ShowUnpin }}
|
||||
<form method="POST" action="/pin/{{ .ID }}" id="unpin-{{ .ID }}" class="inline-form">
|
||||
<input type="hidden" name="back" value="/pinned">
|
||||
</form>
|
||||
{{ end }}
|
||||
|
||||
<div class="doc-content">
|
||||
|
||||
<div>
|
||||
{{ if .DocMeta.Creator }}
|
||||
<a href="/browse/agency/{{ pathEscape .DocMeta.Creator }}{{ $qs }}"
|
||||
class="doc-creator{{ if and (eq $cat "agency") (eqFold .DocMeta.Creator $val) }} active{{ end }}">{{ .DocMeta.Creator }}</a>
|
||||
{{ end }}
|
||||
{{ if and .DocMeta.Creator .DocMeta.DateCreated }}
|
||||
<span class="doc-dot">·</span>
|
||||
{{ end }}
|
||||
{{ if .DocMeta.DateCreated }}
|
||||
{{ if ge (len .DocMeta.DateCreated) 4 }}
|
||||
{{ $year := slice .DocMeta.DateCreated 0 4 }}
|
||||
<a href="/browse/docdate/{{ $year }}{{ $qs }}"
|
||||
class="doc-created{{ if and (eq $cat "docdate") (eq $year $val) }} active{{ end }}">{{ .DocMeta.DateCreated }}</a>
|
||||
{{ else }}
|
||||
<span class="doc-created">{{ .DocMeta.DateCreated }}</span>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ if .Pages }}
|
||||
{{ if or .DocMeta.Creator .DocMeta.DateCreated }}
|
||||
<span class="doc-dot">·</span>
|
||||
{{ end }}
|
||||
<span class="doc-pages">{{ .Pages }} p.</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
{{ if and .Description (not $.HideSummary) }}
|
||||
<p class="card-summary">{{ .Description }}</p>
|
||||
{{ end }}
|
||||
|
||||
{{ if and (or .DocMeta.Classification .DocMeta.Dissemination) (not $.HideClassification) }}
|
||||
<div>
|
||||
<span class="doc-classification">Marking:</span>
|
||||
{{ with .DocMeta.Classification }}{{ facetLinks (dict "Vals" . "Cat" "classification" "Sep" "dot" "Active" (and (eq $cat "classification") $val) "QS" $qs) }}{{ end }}
|
||||
{{ if and .DocMeta.Classification .DocMeta.Dissemination }}<span class="doc-dot">·</span>{{ end }}
|
||||
{{ with .DocMeta.Dissemination }}{{ facetLinks (dict "Vals" . "Cat" "dissemination" "Sep" "dot" "Active" (and (eq $cat "dissemination") $val) "QS" $qs) }}{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ if and .DocMeta.Programs (not $.HidePrograms) }}
|
||||
<div>
|
||||
<span class="doc-programs">Programs:</span>
|
||||
{{ facetLinks (dict "Vals" .DocMeta.Programs "Cat" "program" "Sep" "dot" "Active" (and (eq $cat "program") $val) "QS" $qs) }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ if and .DocMeta.People (not $.HidePeople) }}
|
||||
<div>
|
||||
<span class="doc-people">People:</span>
|
||||
{{ facetLinks (dict "Vals" .DocMeta.People "Cat" "people" "Sep" "dot" "Active" (and (eq $cat "people") $val) "QS" $qs) }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
<div class="doc-publication">
|
||||
{{ $shown := false }}
|
||||
{{ range $pub := .Publication }}
|
||||
{{ if or $pub.Title $pub.Link $pub.Publisher $pub.DatePublished }}
|
||||
{{ if $shown }}<span class="doc-dot">·</span>{{ end }}{{ $shown = true }}
|
||||
{{ if $pub.Title }}
|
||||
{{ $ak := articleKey $pub.Link }}
|
||||
{{ if $ak }}<a href="/article/{{ $ak }}" class="pub-article-title">“{{ $pub.Title }}”</a>{{ else }}<span class="pub-article-title">“{{ $pub.Title }}”</span>{{ end }}
|
||||
-
|
||||
{{ end }}
|
||||
{{ if or $pub.Link $pub.Publisher }}
|
||||
{{ template "pub-publisher" (dict "Pub" $pub "QS" $qs "LinkClass" "pub-link" "PageClass" "pub-source" "On" (and (eq $cat "publisher") (eqFold $pub.Publisher $val))) }}
|
||||
{{ end }}
|
||||
{{ if $pub.DatePublished }}
|
||||
<span class="doc-published">({{ $pub.DatePublished }})</span>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ $journos := .JournalistsDeduped }}
|
||||
{{ if and $journos (not $.HideJournalists) }}
|
||||
<span class="doc-dot">·</span>
|
||||
{{ range $i, $j := $journos }}
|
||||
{{ if $i }}<span class="doc-dot">·</span>{{ end }}
|
||||
<a href="/browse/journalist/{{ pathEscape $j }}{{ $qs }}"
|
||||
class="doc-journalist{{ if and (eq $cat "journalist") (eqFold $j $val) }} active{{ end }}">{{ $j }}</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
|
||||
{{ define "type-filter" }}
|
||||
<form method="GET" action="{{ .Action }}" class="type-filter">
|
||||
{{ range $k, $vals := .Params }}
|
||||
{{ if and (ne $k "type") (ne $k "p") (ne $k "action") }}
|
||||
{{ range $vals }}
|
||||
<input type="hidden" name="{{ $k }}" value="{{ . }}">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
<span class="muted">Show:</span>
|
||||
|
||||
{{ range $type, $count := .AllTypes }}
|
||||
<label class="type-filter-option">
|
||||
<input type="checkbox" name="type" value="{{ $type }}"
|
||||
{{ if index $.SelectedTypes $type }}checked{{ end }}>
|
||||
{{ template "type-badge" $type }}
|
||||
{{ if eq $type "REPORTED" }}<span class="type-filter-leak">Reported</span>{{ end }}
|
||||
<span class="faint type-filter-count">({{ $count }})</span>
|
||||
</label>
|
||||
{{ end }}
|
||||
|
||||
<button type="submit" class="ctl">Apply</button>
|
||||
</form>
|
||||
{{ end }}
|
||||
|
||||
|
||||
{{ define "pagination" }}
|
||||
{{ if gt .TotalPages 1 }}
|
||||
{{ $sortParam := "" }}{{ if .Sort }}{{ $sortParam = print "&sort=" .Sort }}{{ end }}
|
||||
{{ $orderParam := "" }}{{ if .Order }}{{ $orderParam = print "&order=" .Order }}{{ end }}
|
||||
<nav class="pagination" aria-label="Pagination">
|
||||
|
||||
{{ if gt .Page 1 }}
|
||||
<a href="{{ .BaseURL }}p={{ add .Page -1 }}{{ $sortParam }}{{ $orderParam }}" class="pag-btn" rel="prev">« Prev</a>
|
||||
{{ end }}
|
||||
|
||||
{{ range pages .Page .TotalPages }}
|
||||
{{ if eq . 0 }}
|
||||
<span class="pag-ellipsis" aria-hidden="true">...</span>
|
||||
{{ else if eq . $.Page }}
|
||||
<span class="pag-btn pag-current" aria-current="page">{{ . }}</span>
|
||||
{{ else }}
|
||||
<a href="{{ $.BaseURL }}p={{ . }}{{ $sortParam }}{{ $orderParam }}" class="pag-btn">{{ . }}</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if lt .Page .TotalPages }}
|
||||
<a href="{{ .BaseURL }}p={{ add .Page 1 }}{{ $sortParam }}{{ $orderParam }}" class="pag-btn" rel="next">Next »</a>
|
||||
{{ end }}
|
||||
|
||||
</nav>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "timeline-hist" }}
|
||||
<div class="timeline-block">
|
||||
<h2 class="timeline-label">{{ .Label }} <span class="faint">({{ len .Bars }} years)</span></h2>
|
||||
<div class="date-hist entity-timeline-hist">
|
||||
{{ range .Bars }}
|
||||
{{ if .URL }}
|
||||
<a class="hist-col" href="{{ .URL }}" title="{{ .Count }} documents {{ $.Verb }} {{ .Year }}">
|
||||
<span class="hist-count">{{ .Count }}</span>
|
||||
<span class="hist-track"><span class="hist-bar" style="height: {{ .Pct }}%"></span></span>
|
||||
<span class="hist-year">{{ .Year }}</span>
|
||||
</a>
|
||||
{{ else }}
|
||||
<span class="hist-col" title="{{ .Count }} documents {{ $.Verb }} {{ .Year }}">
|
||||
<span class="hist-count">{{ .Count }}</span>
|
||||
<span class="hist-track"><span class="hist-bar" style="height: {{ .Pct }}%"></span></span>
|
||||
<span class="hist-year">{{ .Year }}</span>
|
||||
</span>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ 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 }}
|
||||
|
||||
<details class="sort-dropdown">
|
||||
<summary
|
||||
aria-label="Sort documents, currently sorted by {{ $activeLabel }}{{ if $directed }} {{ if eq $order "desc" }}descending{{ else }}ascending{{ end }}{{ end }}">
|
||||
Sort: <strong>{{ $activeLabel }}</strong>
|
||||
{{ if $directed }}<span aria-hidden="true">{{ $orderLabel }}</span>{{ end }}
|
||||
</summary>
|
||||
<div role="navigation" aria-label="Sort options" class="sort-options">
|
||||
{{ range sortOptions }}
|
||||
{{ if or (ne .Key "relevance") $showRelevance }}
|
||||
{{ $active := eq .Key $cur }}
|
||||
{{ $flips := and $active (ne .Key "relevance") }}
|
||||
{{ $href := print $base "sort=" .Key }}
|
||||
{{ if and $flips (ne $order "desc") }}{{ $href = print $href "&order=desc" }}{{ end }}
|
||||
<a href="{{ $href }}" class="{{ if $active }}active{{ end }}" {{ if $active }}aria-current="true"{{ end }}>
|
||||
{{ .Label }}
|
||||
{{ if $flips }}
|
||||
<span aria-hidden="true">{{ $orderLabel }}</span>
|
||||
<span class="sr-only">{{ if eq $order "desc" }}descending, click for ascending{{ else }}ascending, click for descending{{ end }}</span>
|
||||
{{ end }}
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</details>
|
||||
{{ end }}
|
||||
|
||||
{{ define "type-badge" }}
|
||||
{{ if eq . "FOIA" }}
|
||||
<span class="type-badge type-badge--foia">FOIA</span>
|
||||
{{ else if eq . "SIDTODAY" }}
|
||||
<span class="type-badge type-badge--sidtoday" title="This document is part of SIDtoday">SIDtoday</span>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "lightbox-overlays" }}
|
||||
{{ $lbBase := .ImageBase }}{{ $lbN := len .Images }}
|
||||
{{ range $i, $img := .Images }}
|
||||
<div class="lightbox" id="lb-{{ add $i 1 }}" aria-label="Page {{ add $i 1 }} of {{ $lbN }}">
|
||||
<a class="lb-backdrop" href="#lb-closed" tabindex="-1" aria-hidden="true"></a>
|
||||
<a class="lb-close" href="#lb-closed" title="Close">×</a>
|
||||
{{ if $i }}<a class="lb-prev" href="#lb-{{ $i }}" title="Previous page">‹</a>{{ end }}
|
||||
{{ if lt (add $i 1) $lbN }}<a class="lb-next" href="#lb-{{ add $i 2 }}" title="Next page">›</a>{{ end }}
|
||||
<img src="{{ $lbBase }}{{ pathEscape $img }}"{{ $.ImageSize $i }} alt="Page {{ add $i 1 }} of {{ $lbN }}" loading="lazy" decoding="async">
|
||||
<span class="lb-counter">{{ add $i 1 }} / {{ $lbN }}{{ if and $.Version ($.Version.PageChanged (add $i 1)) }} · differs from the main document{{ end }}</span>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "changed-page-links" }}
|
||||
{{- $v := . -}}
|
||||
{{- range $k, $p := .ChangedPages -}}
|
||||
{{- if $k }}, {{ end -}}
|
||||
{{- if $p.Pos }}<a href="/doc/{{ $v.DocID }}/versions/{{ $v.Slug }}/pages#lb-{{ $p.Pos }}" title="Open page {{ $p.Page }} of this copy">{{ $p.Page }}</a>{{ else }}{{ $p.Page }}{{ end -}}
|
||||
{{- end -}}
|
||||
{{ end }}
|
||||
|
||||
{{ define "doc-viewport" }}
|
||||
<input type="radio" name="view-control" id="view-images" aria-controls="doc-viewport" {{ if eq .Prefs.DocView "images" }}checked{{ end }}>
|
||||
<input type="radio" name="view-control" id="view-split" aria-controls="doc-viewport" {{ if eq .Prefs.DocView "split" }}checked{{ end }}>
|
||||
<input type="radio" name="view-control" id="view-text" aria-controls="doc-viewport" {{ if eq .Prefs.DocView "text" }}checked{{ end }}>
|
||||
|
||||
<div class="view-picker" role="radiogroup" aria-label="Document display mode">
|
||||
<label for="view-images" class="btn-img">Images Only</label>
|
||||
<label for="view-split" class="btn-split">Split View</label>
|
||||
<label for="view-text" class="btn-txt">Text Only</label>
|
||||
</div>
|
||||
|
||||
<div id="doc-viewport" class="content-wrapper{{ if .Prefs.ScrollDoc }} scroll-panes{{ end }}">
|
||||
<div class="pane images-pane">
|
||||
{{ if gt (len .Images) 1 }}
|
||||
<nav class="page-jump" aria-label="Jump to page">
|
||||
<span class="faint">Page:</span>
|
||||
{{ range $i, $img := .Images }}<a href="#page-{{ add $i 1 }}"{{ if and $.Version ($.Version.PageChanged (add $i 1)) }} class="page-changed-jump" title="Differs from the main document"{{ end }}>{{ add $i 1 }}</a>{{ end }}
|
||||
</nav>
|
||||
{{ end }}
|
||||
<div class="image-list">
|
||||
{{ if .Prefs.TextOnly }}
|
||||
<p class="muted textonly-note">Text-only mode is on - page images are not loaded. <a href="/preferences">Preferences</a></p>
|
||||
<ul class="page-link-list">
|
||||
{{ range $i, $img := .Images }}
|
||||
<li id="page-{{ add $i 1 }}"><a href="{{ $.ImageBase }}{{ pathEscape $img }}" target="_blank" rel="noopener">Page {{ add $i 1 }}</a>{{ if and $.Version ($.Version.PageChanged (add $i 1)) }} <span class="muted">(differs from the main document)</span>{{ end }}</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ else }}
|
||||
{{ range $i, $img := .Images }}
|
||||
<a href="#lb-{{ add $i 1 }}" id="page-{{ add $i 1 }}" class="page-open{{ if and $.Version ($.Version.PageChanged (add $i 1)) }} page-changed{{ end }}" title="Open page {{ add $i 1 }} full screen">
|
||||
<img src="{{ $.ImageBase }}{{ pathEscape $img }}"{{ $.ImageSize $i }}
|
||||
alt="Page {{ add $i 1 }}"
|
||||
loading="lazy">
|
||||
{{- if and $.Version ($.Version.PageChanged (add $i 1)) }}<span class="page-changed-badge">differs</span>{{ end }}
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pane text-pane">
|
||||
<div class="prose">
|
||||
{{ .Content }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
Loading…
Add table
Add a link
Reference in a new issue