···
{{ define "repoContent" }}
+
{{ block "branchSelector" . }} {{ end }}
+
<div class="flex gap-2">
+
{{ block "fileTree" . }} {{ end }}
+
{{ block "commitLog" . }} {{ end }}
+
{{ define "branchSelector" }}
+
<div class="flex justify-between pb-5">
+
onchange="window.location.href = '/{{ .RepoInfo.FullName }}/tree/' + this.value"
+
class="p-1 border border-gray-200 bg-white"
+
<optgroup label="branches" class="bold text-sm">
+
value="{{ .Reference.Name }}"
+
{{ if eq .Reference.Name $.Ref }}
+
<optgroup label="tags" class="bold text-sm">
+
value="{{ .Reference.Name }}"
+
{{ if eq .Reference.Name $.Ref }}
+
<option class="py-1" disabled>no tags found</option>
+
href="/{{ .RepoInfo.FullName }}/commits/{{ .Ref }}"
+
class="ml-2 no-underline flex items-center gap-2 text-sm uppercase font-bold"
+
<i class="w-4 h-4" data-lucide="logs"></i>
+
{{ if eq .TotalCommits 1 }}commit{{ else }}commits{{ end }}
+
{{ define "fileTree" }}
+
<div id="file-tree" class="w-3/5 pr-2 border-r border-gray-200">
+
{{ $containerstyle := "py-1" }}
+
{{ $linkstyle := "no-underline hover:underline" }}
+
<div class="{{ $containerstyle }}">
+
<div class="flex justify-between items-center">
+
href="/{{ $.RepoInfo.FullName }}/tree/{{ $.Ref }}/{{ .Name }}"
+
class="{{ $linkstyle }}"
+
<div class="flex items-center gap-2">
+
class="w-3 h-3 fill-current"
+
<time class="text-xs text-gray-500"
+
>{{ timeFmt .LastCommit.Author.When }}</time
+
<div class="{{ $containerstyle }}">
+
<div class="flex justify-between items-center">
+
href="/{{ $.RepoInfo.FullName }}/blob/{{ $.Ref }}/{{ .Name }}"
+
class="{{ $linkstyle }}"
+
<div class="flex items-center gap-2">
+
<time class="text-xs text-gray-500"
+
>{{ timeFmt .LastCommit.Author.When }}</time
+
{{ define "commitLog" }}
+
<div id="commit-log" class="flex-1">
+
<div class="relative px-2 pb-8">
+
<div id="commit-message">
+
{{ $messageParts := splitN .Message "\n\n" 2 }}
+
<div class="text-base cursor-pointer">
+
href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}"
+
class="inline no-underline hover:underline"
+
>{{ index $messageParts 0 }}</a
+
{{ if gt (len $messageParts) 1 }}
+
class="py-1/2 px-1 bg-gray-200 hover:bg-gray-400 rounded"
+
hx-on:click="this.parentElement.nextElementSibling.classList.toggle('hidden')"
+
{{ $tagsForCommit := index $.TagMap .Hash.String }}
+
{{ range $tagsForCommit }}
+
<span class="text-xs rounded-full bg-black text-white px-2 mx-1 inline-flex items-center">
+
{{ if gt (len $messageParts) 1 }}
+
class="hidden mt-1 text-sm cursor-text pb-2"
+
{{ nl2br (unwrapText (index $messageParts 1)) }}
+
<div class="text-xs text-gray-500">
+
<span class="font-mono">
+
href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}"
+
class="text-gray-500 no-underline hover:underline"
+
>{{ slice .Hash.String 0 8 }}</a
+
class="mx-2 before:content-['·'] before:select-none"
+
href="mailto:{{ .Author.Email }}"
+
class="text-gray-500 no-underline hover:underline"
+
class="inline-block px-1 select-none after:content-['·']"
+
<span>{{ timeFmt .Author.When }}</span>