even better commit messages
Anirudh Oppiliappan 2 weeks ago 2 files (+25, -6)
MODIFIED
appview/pages/pages.go
MODIFIED
appview/pages/pages.go
@@ -79,6 +79,19 @@ },"unescapeHtml": func(s string) template.HTML {return template.HTML(s)},+ "nl2br": func(text string) template.HTML {+ return template.HTML(strings.Replace(template.HTMLEscapeString(text), "\n", "<br>", -1))+ },+ "unwrapText": func(text string) string {+ paragraphs := strings.Split(text, "\n\n")++ for i, p := range paragraphs {+ lines := strings.Split(p, "\n")+ paragraphs[i] = strings.Join(lines, " ")+ }++ return strings.Join(paragraphs, "\n\n")+ },}}
@@ -103,12 +103,18 @@<div id="commit-message">{{ $messageParts := splitN .Message "\n\n" 2 }}<div class="text-base cursor-pointer">- {{ index $messageParts 0 }}- {{ if gt (len $messageParts) 1 }}- <div class="text-sm inline rounded-sm bg-gray-300 text-gray-700 px-1"- hx-on:click="this.nextElementSibling.classList.toggle('hidden')">...</div>- <div class="hidden mt-1 text-sm">{{ index $messageParts 1 }}</div>- {{ end }}+ <div>+ <div class="flex items-center gap-1">+ <a href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}" class="inline no-underline hover:underline hover:text-sky-400">{{ index $messageParts 0 }}</a>+ {{ if gt (len $messageParts) 1 }}+ <button class="text-sm inline rounded-sm bg-gray-300 text-gray-700 px-1 w-fit hover:bg-gray-400"+ hx-on:click="this.parentElement.nextElementSibling.classList.toggle('hidden')">…</button>+ {{ end }}+ </div>+ {{ if gt (len $messageParts) 1 }}+ <p class="hidden mt-1 text-sm cursor-text pb-2">{{ nl2br (unwrapText (index $messageParts 1)) }}</p>+ {{ end }}+ </div></div></div>