add style tweaks: commit hashes, emails, and more cross-browser friendly file view

This commit is contained in:
Iris Lightshard 2023-01-31 14:02:43 -07:00
parent 7a512b1da6
commit 2d263d99a3
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
5 changed files with 31 additions and 20 deletions

View file

@ -180,6 +180,10 @@ a:hover {
padding: 1rem 0 1rem 0; padding: 1rem 0 1rem 0;
} }
.commit-hash, .commit-email {
font-family: var(--mono-font);
}
.commit-email:before { .commit-email:before {
content: '<'; content: '<';
} }
@ -238,21 +242,24 @@ a:hover {
-webkit-user-select: none; -webkit-user-select: none;
-o-user-select: none; -o-user-select: none;
user-select: none; user-select: none;
display: flex;
float: left;
flex-direction: column;
margin-right: 1ch;
} }
.file-wrapper { .file-wrapper {
display: flex;
flex-direction: row;
grid-template-columns: 1rem minmax(0, 1fr);
gap: 1rem;
padding: 0.5rem;
background: var(--light-gray); background: var(--light-gray);
display: table;
padding: 0.5rem
width: 100%;
} }
.file-content { .file-content {
background: var(--light-gray); background: var(--light-gray);
overflow-y: hidden; overflow-y: hidden;
overflow-x: auto; overflow-x: auto;
display: block;
} }
.diff-type { .diff-type {

View file

@ -11,13 +11,13 @@
{{- .commit.Message -}} {{- .commit.Message -}}
</pre> </pre>
<div class="commit-info"> <div class="commit-info">
{{ .commit.Author.Name }} <span class="commit-email">{{ .commit.Author.Email}}</span> {{ .commit.Author.Name }} <a href="mailto:{{ .Author.Email }}" class="commit-email">{{ .commit.Author.Email}}</span>
<div>{{ .commit.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</div> <div>{{ .commit.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</div>
</div> </div>
<div> <div>
<strong>commit</strong> <strong>commit</strong>
<p><a href="/{{ .name }}/commit/{{ .commit.This }}"> <p><a href="/{{ .name }}/commit/{{ .commit.This }}" class="commit-hash">
{{ .commit.This }} {{ .commit.This }}
</a> </a>
</p> </p>
@ -26,7 +26,7 @@
{{ if .commit.Parent }} {{ if .commit.Parent }}
<div> <div>
<strong>parent</strong> <strong>parent</strong>
<p><a href="/{{ .name }}/commit/{{ .commit.Parent }}"> <p><a href="/{{ .name }}/commit/{{ .commit.Parent }}" class="commit-hash">
{{ .commit.Parent }} {{ .commit.Parent }}
</a></p> </a></p>
</div> </div>

View file

@ -8,18 +8,22 @@
{{ template "nav" . }} {{ template "nav" . }}
<main> <main>
<p>{{ .path }}</p> <p>{{ .path }}</p>
<div class="file-wrapper"> <table class="file-wrapper">
<div class="line-numbers"> <tbody><tr>
<td class="line-numbers">
<pre>
{{- range .linecount }} {{- range .linecount }}
<a id="L{{ . }}" href="#L{{ . }}">{{ . }}</a> <a id="L{{ . }}" href="#L{{ . }}">{{ . }}</a>
{{- end -}} {{- end -}}
</div> </pre>
<div class="file-content"> </td>
<span></span> <td class="file-content">
<pre> <pre>
{{- .content -}} {{- .content -}}
</pre> </pre>
</div> </td>
</tbody></tr>
</table>
</main> </main>
</body> </body>
</html> </html>

View file

@ -14,11 +14,11 @@
<div class="log"> <div class="log">
{{ range .commits }} {{ range .commits }}
<div> <div>
<div><a href="/{{ $repo }}/commit/{{ .Hash.String }}">{{ slice .Hash.String 0 8 }}</a></div> <div><a href="/{{ $repo }}/commit/{{ .Hash.String }}" class="commit-hash">{{ slice .Hash.String 0 8 }}</a></div>
<pre>{{ .Message }}</pre> <pre>{{ .Message }}</pre>
</div> </div>
<div class="commit-info"> <div class="commit-info">
{{ .Author.Name }} <span class="commit-email">{{ .Author.Email }}</span> {{ .Author.Name }} <a href="mailto:{{ .Author.Email }}" class="commit-email">{{ .Author.Email }}</a>
<div>{{ .Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</div> <div>{{ .Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</div>
</div> </div>
{{ end }} {{ end }}

View file

@ -16,11 +16,11 @@
<div class="log"> <div class="log">
{{ range .commits }} {{ range .commits }}
<div> <div>
<div><a href="/{{ $repo }}/commit/{{ .Hash.String }}">{{ slice .Hash.String 0 8 }}</a></div> <div><a href="/{{ $repo }}/commit/{{ .Hash.String }}" class="commit-hash">{{ slice .Hash.String 0 8 }}</a></div>
<pre>{{ .Message }}</pre> <pre>{{ .Message }}</pre>
</div> </div>
<div class="commit-info"> <div class="commit-info">
{{ .Author.Name }} <span class="commit-email">{{ .Author.Email }}</span> {{ .Author.Name }} <a href="mailto:{{ .Author.Email }}" class="commit-email">{{ .Author.Email }}</a>
<div>{{ .Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</div> <div>{{ .Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</div>
</div> </div>
{{ end }} {{ end }}