This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

core / appview / pages / templates / repo / commit.html
5.2 kB 132 lines
1{{ define "title" }} 2 {{ $messageParts := splitN .Diff.Commit.Message "\n\n" 2 }} 3 {{ index $messageParts 0 }} &middot; {{ .RepoInfo.FullName }}@{{ slice .Diff.Commit.This 0 7 }} &middot; Tangled 4{{ end }} 5 6{{ define "extrameta" }} 7 {{ $messageParts := splitN .Diff.Commit.Message "\n\n" 2 }} 8 {{ $title := printf "%s &middot; %s@%s" (index $messageParts 0) .RepoInfo.FullName (slice .Diff.Commit.This 0 7) }} 9 {{ $url := printf "https://tangled.org/%s/commit/%s" .RepoInfo.FullName .Diff.Commit.This }} 10 11 {{ template "repo/fragments/og" (dict "RepoInfo" .RepoInfo "Title" $title "Url" $url) }} 12{{ end }} 13 14 15{{ define "repoContent" }} 16 17{{ $repo := .RepoInfo.FullName }} 18{{ $commit := .Diff.Commit }} 19 20<section class="commit dark:text-white"> 21 <div id="commit-message"> 22 {{ $messageParts := splitN $commit.Message "\n\n" 2 }} 23 <div> 24 <p class="pb-2">{{ index $messageParts 0 }}</p> 25 {{ if gt (len $messageParts) 1 }} 26 <p class="mt-1 cursor-text pb-2 text-sm">{{ nl2br (index $messageParts 1) }}</p> 27 {{ end }} 28 </div> 29 </div> 30 31 <div class="flex flex-wrap items-center space-x-2 text-sm"> 32 <p class="flex flex-wrap items-center gap-1 text-gray-500 dark:text-gray-300"> 33 {{ template "attribution" . }} 34 35 <span class="px-1 select-none before:content-['\00B7']"></span> 36 <span class="inline-flex flex-wrap items-center gap-1"> 37 {{ template "repo/fragments/time" $commit.Committer.When }} 38 <span class="text-gray-500 dark:text-gray-400">({{ $commit.Committer.When | longTimeFmt }})</span> 39 </span> 40 <span class="px-1 select-none before:content-['\00B7']"></span> 41 42 <a href="/{{ $repo }}/commit/{{ $commit.This }}" class="no-underline hover:underline text-gray-500 dark:text-gray-300">{{ slice $commit.This 0 8 }}</a> 43 44 {{ if $commit.Parent }} 45 {{ i "arrow-left" "w-3 h-3 mx-1" }} 46 <a href="/{{ $repo }}/commit/{{ $commit.Parent }}" class="no-underline hover:underline text-gray-500 dark:text-gray-300">{{ slice $commit.Parent 0 8 }}</a> 47 {{ end }} 48 </p> 49 50 {{ if .VerifiedCommit.IsVerified $commit.This }} 51 <div class="group relative inline-block text-sm"> 52 <div class="bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200 px-2 py-1 rounded cursor-pointer"> 53 <div class="flex items-center gap-2"> 54 {{ i "shield-check" "w-4 h-4" }} 55 Verified 56 </div> 57 </div> 58 <div class="absolute z-[9999] hidden group-hover:block bg-white dark:bg-gray-900 text-sm text-black dark:text-white rounded-md shadow-md p-4 w-80 top-full mt-2"> 59 <div class="mb-1">This commit was signed with the committer's <span class="text-green-600 font-semibold">known signature</span>.</div> 60 <div class="flex items-center gap-2 my-2"> 61 {{ i "user" "w-4 h-4" }} 62 {{ $committerDid := index $.EmailToDid $commit.Committer.Email }} 63 {{ template "user/fragments/picHandleLink" $committerDid }} 64 </div> 65 <div class="my-1 pt-2 text-xs border-t border-gray-200 dark:border-gray-700"> 66 <div class="text-gray-600 dark:text-gray-300">SSH Key Fingerprint:</div> 67 <div class="break-all">{{ .VerifiedCommit.Fingerprint $commit.This }}</div> 68 </div> 69 </div> 70 </div> 71 {{ end }} 72 73 <div class="text-sm"> 74 {{ if $.Pipeline }} 75 {{ template "repo/pipelines/fragments/pipelineSymbolLong" (dict "Pipeline" $.Pipeline "RepoInfo" $.RepoInfo) }} 76 {{ end }} 77 </div> 78 </div> 79 80</section> 81{{end}} 82 83{{ define "attribution" }} 84 {{ $commit := .Diff.Commit }} 85 {{ $showCommitter := true }} 86 {{ if eq $commit.Author.Email $commit.Committer.Email }} 87 {{ $showCommitter = false }} 88 {{ end }} 89 90 {{ if $showCommitter }} 91 authored by {{ template "attributedUser" (list $commit.Author.Email $commit.Author.Name $.EmailToDid) }} 92 {{ range $commit.CoAuthors }} 93 {{ template "attributedUser" (list .Email .Name $.EmailToDid) }} 94 {{ end }} 95 and committed by {{ template "attributedUser" (list $commit.Committer.Email $commit.Committer.Name $.EmailToDid) }} 96 {{ else }} 97 {{ template "attributedUser" (list $commit.Author.Email $commit.Author.Name $.EmailToDid )}} 98 {{ end }} 99{{ end }} 100 101{{ define "attributedUser" }} 102 {{ $email := index . 0 }} 103 {{ $name := index . 1 }} 104 {{ $map := index . 2 }} 105 {{ $did := index $map $email }} 106 107 {{ if $did }} 108 {{ template "user/fragments/picHandleLink" $did }} 109 {{ else }} 110 <span class="flex items-center gap-1"> 111 {{ placeholderAvatar "tiny" }} 112 <a href="mailto:{{ $email }}" class="no-underline hover:underline text-gray-500 dark:text-gray-300">{{ $name }}</a> 113 </span> 114 {{ end }} 115{{ end }} 116 117{{ define "mainLayout" }} 118 <div class="px-1 flex-grow col-span-full flex flex-col gap-4"> 119 {{ block "contentLayout" . }} 120 {{ block "content" . }}{{ end }} 121 {{ end }} 122 123 {{ block "contentAfter" . }}{{ end }} 124 </div> 125{{ end }} 126 127 128 129{{ define "contentAfter" }} 130 {{ template "repo/fragments/diff" (list .Diff .DiffOpts) }} 131{{end}} 132