forked from tangled.org/core
this repo has no description

appview/pulls: hyperlink to ids and better round #

anirudh.fi 6a1daebf 369dbb79

verified
Changed files
+49 -50
appview
pages
templates
repo
+12 -13
appview/pages/templates/repo/pulls/patch.html
···
{{ define "title" }}
-
viewing patch of {{ .Pull.Title }} · pull #{{ .Pull.PullId }} · {{ .RepoInfo.FullName }}
+
{{ $oneIndexedRound := add .Round 1 }}
+
patch of {{ .Pull.Title }} · round #{{ $oneIndexedRound }} · pull #{{ .Pull.PullId }} · {{ .RepoInfo.FullName }}
{{ end }}
{{ define "content" }}
{{ $oneIndexedRound := add .Round 1 }}
{{ $stat := .Diff.Stat }}
-
<div class="flex gap-2 items-center text-gray-500 mb-2 px-6">
-
<a href="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/" class="flex items-center gap-2">
-
<i data-lucide="arrow-left" class="w-4 h-4"></i>
-
back
-
</a>
-
<span class="select-none before:content-['·']"></span>
-
viewing round
-
<span class="text-black">#{{ $oneIndexedRound }}</span>
-
</div>
<div class="rounded drop-shadow-sm bg-white py-4 px-6">
-
<header class="pb-4">
-
<h1 class="text-2xl">
+
<header class="pb-2">
+
<div class="flex gap-3 items-center mb-3">
+
<a href="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/" class="flex items-center gap-2 font-medium">
+
<i data-lucide="arrow-left" class="w-5 h-5"></i>
+
</a>
+
<h2 class="text-lg">round <span class="font-medium">#{{ $oneIndexedRound }}</span></h2>
+
</div>
+
<div class="border-t border-gray-200 my-2"></div>
+
<h1 class="text-2xl mt-3">
{{ .Pull.Title }}
<span class="text-gray-500">#{{ .Pull.PullId }}</span>
</h1>
···
{{ end }}
</div>
</div>
+
<section>
{{ template "fragments/diff" (list .RepoInfo.FullName .Diff) }}
</section>
{{ end }}
-
+37 -37
appview/pages/templates/repo/pulls/pull.html
···
{{ with $item }}
{{ $oneIndexedRound := add .RoundNumber 1 }}
<details {{ if eq $idx $lastIdx }}open{{ end }}>
-
<summary id="round-#{{ $oneIndexedRound }}" class="list-none cursor-pointer text-sm">
-
<div class="flex gap-2 items-center">
-
<div class="rounded bg-white drop-shadow-sm p-3">
-
#{{ $oneIndexedRound }}
-
</div>
-
<div class="rounded drop-shadow-sm bg-white p-3 text-gray-500">
-
<span>
-
{{ $owner := index $.DidHandleMap $.Pull.OwnerDid }}
-
submitted by <a href="/{{ $owner }}">{{ $owner }}</a>
-
<span class="select-none before:content-['\00B7']"></span>
-
<time>{{ .Created | timeFmt }}</time>
-
<span class="select-none before:content-['·']"></span>
-
{{ $s := "s" }}
-
{{ if eq (len .Comments) 1 }}
-
{{ $s = "" }}
-
{{ end }}
-
{{ len .Comments }} comment{{$s}}
-
<span class="before:content-['·']"></span>
-
<a href="/{{ $.RepoInfo.FullName }}/pulls/{{ $.Pull.PullId }}/round/{{.RoundNumber}}">view patch</a>
-
</span>
-
</div>
-
</div>
-
</summary>
-
<div class="pl-12 flex flex-col gap-2 mt-2 relative">
-
{{ range .Comments }}
-
<div id="comment-{{.ID}}" class="bg-white rounded drop-shadow-sm py-2 px-4 relative w-fit">
-
<div class="absolute left-8 -top-2 w-px h-2 bg-gray-300"></div>
-
<div class="text-sm text-gray-500">
-
{{ $owner := index $.DidHandleMap .OwnerDid }}
-
<a href="/{{$owner}}">{{$owner}}</a>
-
<span class="before:content-['·']"></span>
-
<time>{{ .Created | timeFmt }}</time>
+
<summary id="round-#{{ $oneIndexedRound }}" class="list-none cursor-pointer text-sm">
+
<div class="flex gap-2 items-center">
+
<div class="rounded bg-white drop-shadow-sm p-3">
+
#{{ $oneIndexedRound }}
</div>
-
<div class="prose">
-
{{ .Body }}
+
<div class="rounded drop-shadow-sm bg-white p-3 text-gray-500">
+
<span>
+
{{ $owner := index $.DidHandleMap $.Pull.OwnerDid }}
+
submitted by <a href="/{{ $owner }}">{{ $owner }}</a>
+
<span class="select-none before:content-['\00B7']"></span>
+
<a href="#round-#{{ $oneIndexedRound }}"><time>{{ .Created | timeFmt }}</time></a>
+
<span class="select-none before:content-['·']"></span>
+
{{ $s := "s" }}
+
{{ if eq (len .Comments) 1 }}
+
{{ $s = "" }}
+
{{ end }}
+
{{ len .Comments }} comment{{$s}}
+
<span class="before:content-['·']"></span>
+
<a href="/{{ $.RepoInfo.FullName }}/pulls/{{ $.Pull.PullId }}/round/{{.RoundNumber}}">view patch</a>
+
</span>
</div>
</div>
-
{{ end }}
-
{{ block "newComment" (list $ .ID) }} {{ end }}
-
</div>
+
</summary>
+
<div class="pl-12 flex flex-col gap-2 mt-2 relative">
+
{{ range .Comments }}
+
<div id="comment-{{.ID}}" class="bg-white rounded drop-shadow-sm py-2 px-4 relative w-fit">
+
<div class="absolute left-8 -top-2 w-px h-2 bg-gray-300"></div>
+
<div class="text-sm text-gray-500">
+
{{ $owner := index $.DidHandleMap .OwnerDid }}
+
<a href="/{{$owner}}">{{$owner}}</a>
+
<span class="before:content-['·']"></span>
+
<a href="#comment-{{.ID}}"><time>{{ .Created | timeFmt }}</time></a>
+
</div>
+
<div class="prose">
+
{{ .Body }}
+
</div>
+
</div>
+
{{ end }}
+
{{ block "newComment" (list $ .ID) }} {{ end }}
+
</div>
</details>
<hr />
{{ end }}