BlueGit

timfa bluegit

Files

bluegit / internal / server / templates / commit.html

commit.html

feat: toon repositories en groepen op het profiel
timfa project_87923614_bot_3aff574f6f98414b945a8799374f9092 · pushed by timfa · 3 weeks ago
Passed 69db8c2f History
commit.html 6.0 KiB Download Raw
1{{define "commit"}}
2{{template "layout-start" .}}
3<article class="commitpage">
4<header class="commithead"><h1>{{.Commit.Subject}}</h1></header>
5{{if .Commit.Body}}<pre class="commitmsg">{{.Commit.Body}}</pre>{{end}}
6<section class="card commitmeta">
7 <div class="projhead">
8 {{template "avatar" .Commit}}
9 <div>
10 <p>{{template "commitwho" .Commit}}</p>
11 <p class="muted">{{t "commit.authored"}} {{.Commit.Date}}{{if .Commit.When}} · {{.Commit.When}}{{end}}</p>
12 </div>
13 </div>
14 <dl class="commitfacts">
15 <div>
16 <dt>{{t "commit.sha"}}</dt>
17 <dd><code class="sha">{{.Commit.SHA}}</code> <button type="button" class="iconbtn" data-copy="{{.Commit.SHA}}" aria-label="{{t "action.copy"}}">{{t "action.copy"}}</button></dd>
18 </div>
19 {{if .CommitDiff.Parents}}
20 <div>
21 <dt>{{if eq (len .CommitDiff.Parents) 1}}{{t "commit.parent"}}{{else}}{{t "commit.parents"}}{{end}}</dt>
22 <dd class="parents">{{range .CommitDiff.Parents}}<a href="/{{$.Repo.FullPath}}/-/commit/{{.SHA}}"><code>{{.Short}}</code></a>{{end}}</dd>
23 </div>
24 {{end}}
25 {{if .Commit.PipeStatus}}
26 <div>
27 <dt>{{t "pipe.one"}}</dt>
28 <dd><a class="status {{.Commit.PipeStatus}}" href="/{{$.Repo.FullPath}}/-/pipelines/{{.Commit.PipeID}}"><span class="mark"></span>{{.Commit.PipeLabel}}</a></dd>
29 </div>
30 {{end}}
31 </dl>
32</section>
33{{if not .CommitDiff.Files}}
34<p class="muted">{{t "commit.empty"}}</p>
35{{else}}
36{{template "repodiff" .}}
37{{end}}
38</article>
39<script src="/assets/repo.js"></script>
40{{template "layout-end" .}}
41{{end}}
42
43{{define "repodiff"}}
44<div class="commitdiff" id="commitdiff" data-commit-diff data-mode="inline">
45<script src="/assets/commit-mode.js"></script>
46<div class="commitbar diffbar">
47 <div class="grow">
48 <strong>{{tn .CommitDiff.FilesN "commit.file.one" "commit.file.many"}}</strong>
49 <span class="addstat">+{{.CommitDiff.Added}}</span>
50 <span class="delstat">−{{.CommitDiff.Deleted}}</span>
51 </div>
52 <div class="diffswitch" role="group" aria-label="{{t "commit.view"}}">
53 <button type="button" data-diff-mode="inline" aria-pressed="true">{{t "commit.inline"}}</button>
54 <button type="button" data-diff-mode="side" aria-pressed="false">{{t "commit.side"}}</button>
55 </div>
56</div>
57<div class="commitlayout">
58 <nav class="commitfiles" aria-label="{{t "commit.changed"}}">
59 <h2>{{t "commit.changed"}}</h2>
60 <ul>
61 {{range .CommitDiff.Tree}}
62 <li class="d{{.Depth}}">
63 {{if .Dir}}{{template "ficon" .Icon}}<span>{{.Name}}</span>{{else}}<a href="#{{.Anchor}}" data-diff-link="{{.Anchor}}">{{template "ficon" .Icon}}<span class="name">{{.Name}}</span></a> <span class="addstat">+{{.Added}}</span><span class="delstat">−{{.Deleted}}</span>{{end}}
64 </li>
65 {{end}}
66 </ul>
67 </nav>
68 <div class="commitdiffs">
69 {{range .CommitDiff.Files}}
70 <section class="commitfile" id="{{.Anchor}}" data-path="{{.Path}}" data-collapsed="{{if .Collapsed}}1{{else}}0{{end}}">
71 <header>
72 {{if .HasBody}}<button type="button" class="ghost" data-toggle-diff data-show="{{t "commit.show"}}" data-hide="{{t "commit.hide"}}" aria-expanded="{{if .Collapsed}}false{{else}}true{{end}}">{{if .Collapsed}}{{t "commit.show"}}{{else}}{{t "commit.hide"}}{{end}}</button>{{end}}
73 <span class="path">{{if .OldPath}}<span class="oldpath">{{.OldPath}}</span> <span aria-hidden="true">→</span> {{end}}{{if .FileURL}}<a href="{{.FileURL}}">{{.Path}}</a>{{else}}{{.Path}}{{end}}</span>
74 {{if eq .Status "added"}}<span class="pill">{{t "commit.added"}}</span>{{else if eq .Status "deleted"}}<span class="pill">{{t "commit.deleted"}}</span>{{else if eq .Status "renamed"}}<span class="pill">{{t "commit.renamed"}}</span>{{end}}
75 {{if .Binary}}<span class="pill">{{t "commit.binary"}}</span>{{end}}
76 <span class="counts"><span class="addstat">+{{.Added}}</span> <span class="delstat">−{{.Deleted}}</span></span>
77 </header>
78 {{if .HasBody}}
79 <div class="diffbody">
80 {{if .Binary}}<p class="muted binaryhint">{{t "commit.binaryHint"}}</p>{{else}}
81 <div class="unified">
82 {{range .Lines}}
83 <div class="commitline kind-{{.Kind}}{{if and $.CanComment (ne .Kind "hunk")}} with-gutter{{end}}"{{if and $.CanComment .New}} data-line="{{.New}}"{{end}}>
84 {{if and $.CanComment (ne .Kind "hunk")}}<span class="gutter{{if not .New}} off{{end}}"></span>{{end}}
85 <span class="ln">{{if .Old}}{{.Old}}{{end}}</span>
86 <span class="ln">{{if .New}}{{.New}}{{end}}</span>
87 <code>{{.HTML}}</code>
88 </div>
89 {{if $.CanComment}}{{range .Notes}}
90 <article class="linenote" id="note-{{.ID}}">
91 {{if .AuthorURL}}<a href="{{.AuthorURL}}"><strong>{{.Author}}</strong></a>{{else}}<strong>{{.Author}}</strong>{{end}} <span class="muted">{{.When}}</span>
92 <div class="mdbody">{{.HTML}}</div>
93 {{if and $.CanApply .HasSuggestion}}<label class="sugcheck"><input type="checkbox" data-suggestion="{{.ID}}"> {{t "sug.include"}}</label>{{end}}
94 {{range .Replies}}<div class="reply">{{if .AuthorURL}}<a href="{{.AuthorURL}}"><strong>{{.Author}}</strong></a>{{else}}<strong>{{.Author}}</strong>{{end}} <span class="muted">{{.When}}</span><div class="mdbody">{{.HTML}}</div></div>{{end}}
95 </article>
96 {{end}}{{end}}
97 {{end}}
98 </div>
99 <div class="split">
100 {{range .Pairs}}
101 {{if .Hunk}}<div class="commitline kind-hunk"><code>{{.Hunk}}</code></div>{{else}}
102 <div class="pair">
103 <div class="half kind-{{if .LKind}}{{.LKind}}{{else}}empty{{end}}"><span class="ln">{{if .LNo}}{{.LNo}}{{end}}</span><code>{{.LHTML}}</code></div>
104 <div class="half kind-{{if .RKind}}{{.RKind}}{{else}}empty{{end}}"><span class="ln">{{if .RNo}}{{.RNo}}{{end}}</span><code>{{.RHTML}}</code></div>
105 </div>
106 {{end}}
107 {{end}}
108 </div>
109 {{end}}
110 </div>
111 {{end}}
112 </section>
113 {{end}}
114 </div>
115</div>
116</div>
117<script src="/assets/commit.js"></script>
118{{end}}