forked from tangled.org/core
this repo has no description
at file-tree 7.4 kB view raw
1{{ define "title" }}commits &middot; {{ .RepoInfo.FullName }}{{ end }} 2 3{{ define "repoContent" }} 4 <section id="commit-message"> 5 {{ $commit := index .Commits 0 }} 6 {{ $messageParts := splitN $commit.Message "\n\n" 2 }} 7 <div> 8 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ $commit.Hash.String }}" class="dark:text-white"> 9 <p class="pb-5">{{ index $messageParts 0 }}</p> 10 {{ if gt (len $messageParts) 1 }} 11 <p class="mt-1 text-sm cursor-text pb-5"> 12 {{ nl2br (unwrapText (index $messageParts 1)) }} 13 </p> 14 {{ end }} 15 </a> 16 </div> 17 18 <div class="text-sm text-gray-500 dark:text-gray-400"> 19 <span class="font-mono"> 20 <a 21 href="/{{ $.RepoInfo.FullName }}/commit/{{ $commit.Hash.String }}" 22 class="text-gray-500 dark:text-gray-400 no-underline hover:underline" 23 >{{ slice $commit.Hash.String }}</a 24 > 25 </span> 26 <span class="mx-2 before:content-['·'] before:select-none"></span> 27 <span> 28 {{ $didOrHandle := index $.EmailToDidOrHandle $commit.Author.Email }} 29 {{ if $didOrHandle }} 30 <a 31 href="/{{ $didOrHandle }}" 32 class="text-gray-500 dark:text-gray-400 no-underline hover:underline" 33 >{{ $didOrHandle }}</a 34 > 35 {{ else }} 36 <a 37 href="mailto:{{ $commit.Author.Email }}" 38 class="text-gray-500 dark:text-gray-400 no-underline hover:underline" 39 >{{ $commit.Author.Name }}</a 40 > 41 {{ end }} 42 </span> 43 <div 44 class="inline-block px-1 select-none after:content-['·']" 45 ></div> 46 <span>{{ timeFmt $commit.Author.When }}</span> 47 </div> 48 </section> 49{{ end }} 50 51{{ define "repoAfter" }} 52 <main> 53 <div id="commit-log" class="flex-1 relative"> 54 <div class="absolute left-8 top-0 bottom-0 w-px bg-gray-300 dark:bg-gray-600"></div> 55 {{ $end := length .Commits }} 56 {{ $commits := subslice .Commits 1 $end }} 57 {{ range $commits }} 58 <div class="flex flex-row justify-between items-center"> 59 <div 60 class="relative w-full px-4 py-4 mt-4 rounded-sm bg-white dark:bg-gray-800" 61 > 62 <div id="commit-message"> 63 {{ $messageParts := splitN .Message "\n\n" 2 }} 64 <div class="text-base cursor-pointer"> 65 <div> 66 <div> 67 <a 68 href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}" 69 class="inline no-underline hover:underline dark:text-white" 70 >{{ index $messageParts 0 }}</a 71 > 72 {{ if gt (len $messageParts) 1 }} 73 74 <button 75 class="py-1/2 px-1 bg-gray-200 hover:bg-gray-400 dark:bg-gray-700 dark:hover:bg-gray-600 rounded" 76 hx-on:click="this.parentElement.nextElementSibling.classList.toggle('hidden')" 77 > 78 {{ i "ellipsis" "w-3 h-3" }} 79 </button> 80 {{ end }} 81 </div> 82 {{ if gt (len $messageParts) 1 }} 83 <p 84 class="hidden mt-1 text-sm cursor-text pb-2 dark:text-gray-300" 85 > 86 {{ nl2br (index $messageParts 1) }} 87 </p> 88 {{ end }} 89 </div> 90 </div> 91 </div> 92 93 <div class="text-sm text-gray-500 dark:text-gray-400 mt-3"> 94 <span class="font-mono"> 95 <a 96 href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}" 97 class="text-gray-500 dark:text-gray-400 no-underline hover:underline" 98 >{{ slice .Hash.String 0 8 }}</a 99 > 100 </span> 101 <span 102 class="mx-2 before:content-['·'] before:select-none" 103 ></span> 104 <span> 105 {{ $didOrHandle := index $.EmailToDidOrHandle .Author.Email }} 106 {{ if $didOrHandle }} 107 <a 108 href="/{{ $didOrHandle }}" 109 class="text-gray-500 dark:text-gray-400 no-underline hover:underline" 110 >{{ $didOrHandle }}</a 111 > 112 {{ else }} 113 <a 114 href="mailto:{{ .Author.Email }}" 115 class="text-gray-500 dark:text-gray-400 no-underline hover:underline" 116 >{{ .Author.Name }}</a 117 > 118 {{ end }} 119 </span> 120 <div 121 class="inline-block px-1 select-none after:content-['·']" 122 ></div> 123 <span>{{ timeFmt .Author.When }}</span> 124 </div> 125 </div> 126 </div> 127 {{ end }} 128 </div> 129 130 {{ $commits_len := len .Commits }} 131 <div class="flex justify-end mt-4 gap-2"> 132 {{ if gt .Page 1 }} 133 <a 134 class="btn flex items-center gap-2 no-underline hover:no-underline dark:text-white dark:hover:bg-gray-700" 135 hx-boost="true" 136 onclick="window.location.href = window.location.pathname + '?page={{ sub .Page 1 }}'" 137 > 138 {{ i "chevron-left" "w-4 h-4" }} 139 previous 140 </a> 141 {{ else }} 142 <div></div> 143 {{ end }} 144 145 {{ if eq $commits_len 30 }} 146 <a 147 class="btn flex items-center gap-2 no-underline hover:no-underline dark:text-white dark:hover:bg-gray-700" 148 hx-boost="true" 149 onclick="window.location.href = window.location.pathname + '?page={{ add .Page 1 }}'" 150 > 151 next 152 {{ i "chevron-right" "w-4 h-4" }} 153 </a> 154 {{ end }} 155 </div> 156 </main> 157{{ end }}