~bigbes/sr-ht-ecore

ref: 17411599089544c82bc6c0a7c073276b9f90c275 sr-ht-ecore/chrome/templates/chrome.tmpl -rw-r--r-- 3.0 KiB
17411599 — Eugene Blikh bearer: split the grant check out of validation 10 days ago
                                                                                
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
{{/*
  Shared chrome partials. The dot must expose the chrome.Page fields — either
  a Page itself or a view struct embedding one.

  srht-env-banner renders the non-production warning strip; place it first in
  <body>. srht-nav renders the navbar INNER content (brand + switcher + login
  box); the service's layout owns the <nav> element itself so it can keep its
  own classes.
*/}}

{{define "srht-env-banner" -}}
{{if .ShowBanner}}
<div style="background: #228800; color: white; font-weight: bold; width: 100%; text-align: center">
  {{.Environment}} ENVIRONMENT
</div>
{{end}}
{{- end}}

{{/*
  srht-repo-list renders a listing of projects (repos, databases, spaces) as
  the family's event-list cards. Dot is a chrome.RepoList. The rules the four
  services converged on: h4 title link; visibility as small muted text on the
  right, non-public only, lowercase; description as a paragraph when present.
*/}}
{{define "srht-repo-list" -}}
{{if .Items}}
<div class="event-list">
  {{range .Items}}
  <div class="event">
    <h4>
      <a href="{{.Href}}">{{.Title}}</a>
      {{if and .Visibility (ne .Visibility "PUBLIC")}}
      <small class="pull-right">{{if eq .Visibility "UNLISTED"}}unlisted{{else}}private{{end}}</small>
      {{end}}
    </h4>
    {{if .Description}}
    <p>{{.Description}}</p>
    {{end}}
  </div>
  {{end}}
</div>
{{else}}
<p class="text-muted">{{.Empty}}</p>
{{end}}
{{- end}}

{{define "srht-nav" -}}
{{/*
  The brand carries a fixed min-width so the service switcher starts at the
  same x-coordinate on every service: without it the menu shifts by the width
  of the red service label ("dolt" vs "compare") when hopping between
  services. Sized for the longest label on the instance; inline because the
  services build their CSS from the shared core tree and ecore ships none.
*/}}
<span class="navbar-brand" style="min-width: 15rem">
  <span class="icon icon-circle" aria-hidden="true"><svg width="22" height="22" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200z"/></svg></span>
  <a class="navbar-brand" href="/">
    {{.SiteName}}
    <span class="text-danger">{{.SiteLabel}}</span>
  </a>
</span>
<ul class="navbar-nav">
  {{if .Username}}
  {{range .Nav}}
  <li class="nav-item {{if .Active}}active{{end}}">
    <a class="nav-link" href="{{.Origin}}">{{.Name}}</a>
  </li>
  {{end}}
  {{range .ExtraNav}}
  <li class="nav-item {{if .Active}}active{{end}}">
    <a class="nav-link" href="{{.Origin}}">{{.Name}}</a>
  </li>
  {{end}}
  {{end}}
</ul>
<div class="login">
  {{if .Username}}
  <span class="navbar-text">
    Logged in as
    <a href="{{.ProfileURL}}">{{.Username}}</a>
    &mdash;
    <a href="{{.LogoutURL}}">Log out</a>
  </span>
  {{else}}
  <span class="navbar-text">
    <a href="{{.LoginURL}}" rel="nofollow">Log in</a>
    &mdash;
    <a href="{{.RegisterURL}}">Register</a>
  </span>
  {{end}}
</div>
{{- end}}