HTML · 11061 bytes Raw Blame History
1 {{ define "page" -}}
2 <section class="shithub-repo-page shithub-commits-page">
3 {{ template "repo-header" . }}
4
5 <div class="shithub-commits-shell">
6 <header class="shithub-commits-titlebar">
7 <h1>Commits</h1>
8 </header>
9
10 <div class="shithub-commits-toolbar" aria-label="Commit history filters">
11 <details class="shithub-commit-menu shithub-commit-ref-menu">
12 <summary class="shithub-commit-menu-button">
13 {{ octicon "git-branch" }}
14 <span>{{ .Ref }}</span>
15 {{ octicon "triangle-down" }}
16 </summary>
17 <div class="shithub-commit-menu-panel shithub-commit-ref-panel">
18 <div class="shithub-commit-menu-header">
19 <strong>Switch branches/tags</strong>
20 <button type="button" class="shithub-icon-button" aria-label="Close menu" data-details-close>{{ octicon "x" }}</button>
21 </div>
22 <label class="shithub-commit-menu-search">
23 {{ octicon "search" }}
24 <input type="search" placeholder="Find a branch..." data-commit-filter-input>
25 </label>
26 <div class="shithub-commit-ref-tabs" role="tablist" aria-label="Branch or tag">
27 <button type="button" class="is-active" role="tab" aria-selected="true" data-ref-tab="branches">Branches</button>
28 <button type="button" role="tab" aria-selected="false" data-ref-tab="tags">Tags</button>
29 </div>
30 <div class="shithub-commit-ref-list" data-filter-list data-ref-pane="branches">
31 {{ range .RefMenu.Branches }}
32 <a class="shithub-commit-ref-item{{ if .Active }} is-active{{ end }}" href="{{ .Href }}" data-filter-item>
33 <span>{{ if .Active }}✓{{ end }}</span>
34 <span>{{ .Name }}</span>
35 {{ if .IsDefault }}<span class="shithub-ref-default">default</span>{{ end }}
36 </a>
37 {{ end }}
38 </div>
39 <div class="shithub-commit-ref-list" data-filter-list data-ref-pane="tags" hidden>
40 {{ if .RefMenu.Tags }}
41 {{ range .RefMenu.Tags }}
42 <a class="shithub-commit-ref-item{{ if .Active }} is-active{{ end }}" href="{{ .Href }}" data-filter-item>
43 <span>{{ if .Active }}✓{{ end }}</span>
44 <span>{{ .Name }}</span>
45 </a>
46 {{ end }}
47 {{ else }}
48 <p class="shithub-commit-menu-empty">No tags found.</p>
49 {{ end }}
50 </div>
51 </div>
52 </details>
53
54 <div class="shithub-commit-filter-stack">
55 <details class="shithub-commit-menu shithub-commit-author-menu">
56 <summary class="shithub-commit-menu-button">
57 {{ octicon "person" }}
58 <span>{{ .AuthorLabel }}</span>
59 {{ octicon "triangle-down" }}
60 </summary>
61 <div class="shithub-commit-menu-panel shithub-commit-author-panel">
62 <label class="shithub-commit-menu-search">
63 {{ octicon "search" }}
64 <input type="search" placeholder="Find a user..." data-commit-filter-input>
65 </label>
66 <div class="shithub-commit-author-list" data-filter-list>
67 {{ if .AuthorFilters }}
68 {{ range .AuthorFilters }}
69 <a class="shithub-commit-author-item{{ if .Active }} is-active{{ end }}" href="{{ .Href }}" data-filter-item>
70 {{ if .User }}
71 <img src="{{ .AvatarURL }}" alt="" class="shithub-avatar-sm">
72 {{ else }}
73 <span class="shithub-avatar-sm shithub-identicon" data-seed="{{ .IdenticonSeed }}" aria-hidden="true"></span>
74 {{ end }}
75 <span>{{ .Label }}</span>
76 </a>
77 {{ end }}
78 {{ else }}
79 <p class="shithub-commit-menu-empty">No authors on this page.</p>
80 {{ end }}
81 </div>
82 <a class="shithub-commit-menu-footer" href="{{ .AllAuthorsHref }}">View commits for all users</a>
83 </div>
84 </details>
85
86 <details class="shithub-commit-menu shithub-commit-date-menu">
87 <summary class="shithub-commit-menu-button">
88 {{ octicon "calendar" }}
89 <span>{{ .DateLabel }}</span>
90 {{ octicon "triangle-down" }}
91 </summary>
92 <div class="shithub-commit-menu-panel shithub-commit-calendar-panel">
93 <div class="shithub-commit-calendar-head">
94 <div class="shithub-commit-calendar-month">
95 <span>{{ .Calendar.MonthLabel }}</span>
96 <span>{{ .Calendar.YearLabel }}</span>
97 </div>
98 <div class="shithub-commit-calendar-nav">
99 <a href="{{ .Calendar.PrevMonthHref }}" aria-label="Previous month"></a>
100 <a href="{{ .Calendar.NextMonthHref }}" aria-label="Next month"></a>
101 </div>
102 </div>
103 <table class="shithub-commit-calendar" aria-label="Commit date filter calendar">
104 <thead>
105 <tr>
106 <th scope="col">Su</th>
107 <th scope="col">Mo</th>
108 <th scope="col">Tu</th>
109 <th scope="col">We</th>
110 <th scope="col">Th</th>
111 <th scope="col">Fr</th>
112 <th scope="col">Sa</th>
113 </tr>
114 </thead>
115 <tbody>
116 {{ range .Calendar.Weeks }}
117 <tr>
118 {{ range . }}
119 <td>
120 <a class="shithub-commit-calendar-day{{ if .InMonth }} is-in-month{{ else }} is-muted{{ end }}{{ if .IsSelected }} is-selected{{ end }}{{ if .IsToday }} is-today{{ end }}" href="{{ .Href }}">{{ .Label }}</a>
121 </td>
122 {{ end }}
123 </tr>
124 {{ end }}
125 </tbody>
126 </table>
127 <div class="shithub-commit-calendar-footer">
128 <a href="{{ .Calendar.ClearHref }}">Clear</a>
129 <a href="{{ .Calendar.TodayHref }}">Today</a>
130 </div>
131 </div>
132 </details>
133 </div>
134 </div>
135
136 {{ if .PathFilter }}
137 <div class="shithub-commit-active-filter">
138 <span>Showing commits touching <code>{{ .PathFilter }}</code></span>
139 <a href="{{ .PathClearHref }}">Clear path filter</a>
140 </div>
141 {{ end }}
142
143 {{ if .CommitGroups }}
144 <div class="shithub-commit-timeline">
145 {{ range .CommitGroups }}
146 <section class="shithub-commit-day-group">
147 <h2>{{ octicon "git-commit" }} Commits on {{ .Title }}</h2>
148 <ol class="shithub-commits-list">
149 {{ range .Rows }}
150 <li class="shithub-commits-row">
151 <div class="shithub-commit-row-main">
152 <div class="shithub-commit-message-line">
153 <a class="shithub-commits-subject" href="/{{ $.Owner }}/{{ $.Repo.Name }}/commit/{{ .Commit.OID }}">{{ .Commit.Subject }}</a>
154 {{ if .Commit.Body }}
155 <details class="shithub-commit-body-popover">
156 <summary aria-label="Show full commit message">{{ octicon "kebab-horizontal" }}</summary>
157 <pre>{{ .Commit.Body }}</pre>
158 </details>
159 {{ end }}
160 </div>
161 <div class="shithub-commit-attribution">
162 {{ if .Author.User }}
163 <a href="{{ .AuthorHref }}"><img src="{{ .Author.AvatarURL }}" alt="" class="shithub-avatar-sm"></a>
164 <a href="{{ .AuthorHref }}">{{ .AuthorLabel }}</a>
165 {{ else }}
166 <span class="shithub-avatar-sm shithub-identicon" data-seed="{{ .Author.IdenticonSeed }}" aria-hidden="true"></span>
167 <span>{{ .AuthorLabel }}</span>
168 {{ end }}
169 <span>committed</span>
170 <time datetime="{{ .Commit.AuthorWhen.Format "2006-01-02T15:04:05Z" }}">{{ relativeTime .Commit.AuthorWhen }}</time>
171 </div>
172 </div>
173 <div class="shithub-commit-row-actions">
174 {{ template "verified-badge" .Verification }}
175 <a class="shithub-commits-sha" href="/{{ $.Owner }}/{{ $.Repo.Name }}/commit/{{ .Commit.OID }}">{{ .Commit.ShortOID }}</a>
176 <button type="button" class="shithub-commit-icon-action" title="Copy full SHA" aria-label="Copy full SHA" data-commit-copy="{{ .Commit.OID }}">{{ octicon "copy" }}</button>
177 <a class="shithub-commit-icon-action" href="/{{ $.Owner }}/{{ $.Repo.Name }}/tree/{{ .Commit.OID }}" title="Browse repository at this commit" aria-label="Browse repository at this commit">{{ octicon "code" }}</a>
178 </div>
179 </li>
180 {{ end }}
181 </ol>
182 </section>
183 {{ end }}
184 </div>
185 {{ else }}
186 <div class="shithub-commit-empty">
187 {{ if .HasActiveFilters }}No commits found for these filters.{{ else }}No commits yet.{{ end }}
188 </div>
189 {{ end }}
190
191 {{ if or .NewerHref .OlderHref }}
192 <nav class="shithub-pager shithub-commit-pager" aria-label="Pagination">
193 {{ if .NewerHref }}<a href="{{ .NewerHref }}">Newer</a>{{ end }}
194 {{ if .OlderHref }}<a href="{{ .OlderHref }}">Older</a>{{ end }}
195 </nav>
196 {{ end }}
197 </div>
198 </section>
199
200 <script>
201 (() => {
202 for (const input of document.querySelectorAll("[data-commit-filter-input]")) {
203 const panel = input.closest(".shithub-commit-menu-panel");
204 const items = panel ? panel.querySelectorAll("[data-filter-item]") : [];
205 input.addEventListener("input", () => {
206 const q = input.value.trim().toLowerCase();
207 for (const item of items) {
208 item.hidden = q !== "" && !item.textContent.toLowerCase().includes(q);
209 }
210 });
211 }
212 for (const button of document.querySelectorAll("[data-details-close]")) {
213 button.addEventListener("click", () => {
214 const details = button.closest("details");
215 if (details) details.open = false;
216 });
217 }
218 for (const panel of document.querySelectorAll(".shithub-commit-ref-panel")) {
219 const tabs = panel.querySelectorAll("[data-ref-tab]");
220 const panes = panel.querySelectorAll("[data-ref-pane]");
221 for (const tab of tabs) {
222 tab.addEventListener("click", () => {
223 const target = tab.getAttribute("data-ref-tab");
224 for (const other of tabs) {
225 const active = other === tab;
226 other.classList.toggle("is-active", active);
227 other.setAttribute("aria-selected", active ? "true" : "false");
228 }
229 for (const pane of panes) {
230 pane.hidden = pane.getAttribute("data-ref-pane") !== target;
231 }
232 });
233 }
234 }
235 for (const button of document.querySelectorAll("[data-commit-copy]")) {
236 button.addEventListener("click", async () => {
237 try {
238 await navigator.clipboard.writeText(button.getAttribute("data-commit-copy") || "");
239 button.classList.add("is-copied");
240 window.setTimeout(() => button.classList.remove("is-copied"), 1200);
241 } catch (_) {
242 }
243 });
244 }
245 })();
246 </script>
247 {{- end }}