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

templates/views/graph.html

79436f09f5539aac9b6f836b5b9049bbbece48aa · 2.0 KB · 53 lines raw

1 {{ define "graph.html" }}{{ template "base" . }}{{ end }}
2 {{ define "styles" }}<link rel="stylesheet" href="/static/css/graph.css">{{ end }}
3 {{ define "main" }}
4 {{ $slug := print "/" .Info.Slug }}
5 {{/* "150" here must match core.GraphPageSize -- buildCtx uses that
6 constant to snap incoming ?ofs= values onto real page boundaries. */}}
7 {{ $g := mod "graph" "150" }}
8
9 <header class="hero">
10 <div class="hero-inner">
11 <h1 class="page-title">Commit Graph</h1>
12 <p class="page-subtitle">
13 <span class="text-muted">{{ len $g.Rows }} commits across all refs &middot; {{ $g.Lanes }} lanes</span>
14 </p>
15 </div>
16 </header>
17
18 {{ with $g.Rows }}
19 <div style="overflow-x:auto;">
20 <table class="graph-table">
21 <tbody>
22 {{ range . }}
23 <tr>
24 <td class="graph-rail">{{ .Rail }}</td>
25 <td class="graph-msg">
26 {{ range .Refs }}<span class="chip chip-{{ if eq .Kind "tag" }}tag{{ else }}branch{{ end }}">{{ .Name }}</span>{{ end }}
27 <a href="{{ $slug }}/commit/{{ .Commit.SHA }}">{{ trunc 88 .Commit.Subject }}</a>
28 </td>
29 <td class="graph-who text-xs text-muted">{{ .Commit.Author }}</td>
30 <td class="graph-when text-xs text-muted"><time datetime="{{ rfc3339 .Commit.When }}">{{ date .Commit.When }}</time></td>
31 </tr>
32 {{ end }}
33 </tbody>
34 </table>
35 </div>
36
37 {{ else }}
38 {{ if $g.HasPrev }}
39 <div class="notice" style="text-align:center;"><span class="text-muted">No commits at this offset.</span></div>
40 {{ else }}
41 <div class="card" style="padding:2rem;text-align:center;">
42 <p class="muted">No commits yet. This is a fresh repository.</p>
43 </div>
44 {{ end }}
45 {{ end }}
46
47 {{ if or $g.HasPrev $g.HasNext }}
48 <nav class="pager" style="display:flex;justify-content:space-between;margin-top:1rem;">
49 <span>{{ if $g.HasPrev }}<a href="?ofs={{ $g.PrevOfs }}">&larr; Newer</a>{{ end }}</span>
50 <span>{{ if $g.HasNext }}<a href="?ofs={{ $g.NextOfs }}">Older &rarr;</a>{{ end }}</span>
51 </nav>
52 {{ end }}
53 {{ end }}