Migration This is my new public git source viewer. Source coming soon. Please contact with concerns/bugs. Contact me

templates/layouts/notices.html

cb5a7c7c656de5a381e0234208c552c0856e43e3 · 990 B · 24 lines raw

1 {{/* Operator notices. Global ones are always followed by the current
2 repository's, which is why the module merges them into one slice.
3
4 The .Immutable guard is not cosmetic: commit pages are served with a
5 year-long immutable cache, so a notice rendered into one would be
6 frozen in the reader's browser with no way to revalidate. Those pages
7 simply carry no banners. Guarding here rather than in the module means
8 an immutable page never even computes them. */}}
9 {{ define "notices" }}
10 {{ if not .Immutable }}
11 {{ with modOr "notices" }}
12 <div class="notices">
13 {{ range . }}
14 {{ $n := . }}
15 <div class="notice notice-{{ .Type }}">
16 {{ with .Title }}<strong class="notice-title">{{ . }}</strong>{{ end }}
17 {{ with .Body }}<span class="notice-body">{{ . }}</span>{{ end }}
18 {{ with .Link }}<a class="notice-link" href="{{ . }}">{{ with $n.LinkText }}{{ . }}{{ else }}More{{ end }}</a>{{ end }}
19 </div>
20 {{ end }}
21 </div>
22 {{ end }}
23 {{ end }}
24 {{ end }}