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 / pulls / pulls.html
7.0 kB 168 lines
1{{ define "title" }}Pulls &middot; {{ .RepoInfo.FullName }} &middot; Tangled{{ end }} 2 3{{ define "extrameta" }} 4 {{ $title := "Pulls"}} 5 {{ $url := printf "https://tangled.org/%s/pulls" .RepoInfo.FullName }} 6 7 {{ template "repo/fragments/og" (dict "RepoInfo" .RepoInfo "Title" $title "Url" $url) }} 8{{ end }} 9 10{{ define "repoContent" }} 11 {{ $active := .FilterState }} 12 {{ $open := 13 (dict 14 "Key" "open" 15 "Value" "Open" 16 "Icon" "git-pull-request" 17 "Meta" (scaleFmt .RepoInfo.Stats.PullCount.Open)) }} 18 {{ $merged := 19 (dict 20 "Key" "merged" 21 "Value" "Merged" 22 "Icon" "git-merge" 23 "Meta" (scaleFmt .RepoInfo.Stats.PullCount.Merged)) }} 24 {{ $closed := 25 (dict 26 "Key" "closed" 27 "Value" "Closed" 28 "Icon" "ban" 29 "Meta" (scaleFmt .RepoInfo.Stats.PullCount.Closed)) }} 30 {{ $values := list $open $merged $closed }} 31 <div class="grid gap-2 grid-cols-[auto_1fr_auto] grid-row-2"> 32 <form id="search-form" class="flex relative col-span-3 sm:col-span-1 sm:col-start-2" method="GET"> 33 <div class="flex-1 flex relative"> 34 <input 35 id="search-q" 36 class="flex-1 py-1 pl-2 pr-10 mr-[-1px] rounded-r-none peer" 37 type="text" 38 name="q" 39 value="{{ .FilterQuery }}" 40 placeholder="Search pulls..." 41 > 42 <a 43 {{ if $active }}href="?q=state:{{ $active }}"{{ else }}href="?"{{ end }} 44 class="absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hidden peer-[:not(:placeholder-shown)]:block" 45 > 46 {{ i "x" "w-4 h-4" }} 47 </a> 48 </div> 49 <button 50 type="submit" 51 class="p-2 text-gray-400 border rounded-r border-gray-300 dark:border-gray-600" 52 > 53 {{ i "search" "w-4 h-4" }} 54 </button> 55 </form> 56 <div class="sm:row-start-1"> 57 {{ template "fragments/tabSelector" (dict "Name" "state" "Values" $values "Active" $active "Include" "#search-q" "Form" "search-form") }} 58 </div> 59 <a 60 href="/{{ .RepoInfo.FullName }}/pulls/new" 61 class="col-start-3 btn-create text-sm flex items-center gap-2 no-underline hover:no-underline hover:text-white" 62 > 63 {{ i "git-pull-request-create" "w-4 h-4" }} 64 <span>New</span> 65 </a> 66 </div> 67 <div class="error" id="pulls"></div> 68{{ end }} 69 70{{ define "repoAfter" }} 71 <div class="flex flex-col gap-2 mt-2"> 72 {{ range $stack := .Stacks }} 73 {{ $topPR := index $stack 0 }} 74 <div class="rounded bg-white dark:bg-gray-800"> 75 <div class="px-6 py-4 z-5"> 76 <div class="pb-2"> 77 <a href="/{{ $.RepoInfo.FullName }}/pulls/{{ $topPR.PullId }}" class="dark:text-white"> 78 {{ $topPR.Title | description }} 79 <span class="text-gray-500 dark:text-gray-400">#{{ $topPR.PullId }}</span> 80 </a> 81 </div> 82 <div class="text-sm text-gray-500 dark:text-gray-400 flex flex-wrap items-center gap-1"> 83 {{ template "repo/pulls/fragments/pullState" $topPR.State }} 84 <span class="ml-1 flex items-center gap-1"> 85 {{ template "user/fragments/picLink" (list $topPR.OwnerDid "size-6" (index $.VouchRelationships (did $topPR.OwnerDid))) }} 86 <a href="/{{ resolve $topPR.OwnerDid }}">{{ resolve $topPR.OwnerDid }}</a> 87 </span> 88 89 <span class="before:content-['·']"> 90 {{ template "repo/fragments/time" $topPR.Created }} 91 </span> 92 93 <span class="before:content-['·']"> 94 {{ $commentCount := $topPR.TotalComments }} 95 {{ $commentCount }} comment{{ if ne $commentCount 1 }}s{{ end }} 96 </span> 97 98 <span class="before:content-['·']"> 99 Round 100 <span class="font-mono"> 101 #{{ $topPR.LastRoundNumber }} 102 </span> 103 </span> 104 105 <span id="pipeline-status-{{ $topPR.LatestSha }}" class="contents"></span> 106 107 {{ $state := $topPR.Labels }} 108 {{ range $k, $d := $.LabelDefs }} 109 {{ range $v, $s := $state.GetValSet $d.AtUri.String }} 110 {{ template "labels/fragments/label" (dict "def" $d "val" $v "withPrefix" true "baseFilterQuery" $.BaseFilterQuery "basePath" (printf "/%s/pulls" $.RepoInfo.FullName)) }} 111 {{ end }} 112 {{ end }} 113 </div> 114 </div> 115 {{ if gt (len $stack) 1 }} 116 <details class="group"> 117 <summary class="px-6 pb-4 text-xs list-none cursor-pointer hover:text-gray-500 hover:dark:text-gray-400"> 118 <span class="flex items-center gap-2"> 119 <span class="group-open:hidden"> 120 {{ i "chevrons-up-down" "size-3" }} 121 </span> 122 <span class="hidden group-open:flex"> 123 {{ i "chevrons-down-up" "size-3" }} 124 </span> 125 {{ $rest := sub (len $stack) 1 }} 126 Expand {{ $rest }} pull{{if ne $rest 1 }}s{{end}} in this stack 127 </span> 128 </summary> 129 {{ template "stackedPullList" (list (slice $stack 1) $) }} 130 </details> 131 {{ end }} 132 </div> 133 {{ end }} 134 </div> 135 {{if gt .PullCount .Page.Limit }} 136 {{ template "fragments/pagination" (dict 137 "Page" .Page 138 "TotalCount" .PullCount 139 "BasePath" (printf "/%s/pulls" .RepoInfo.FullName) 140 "QueryParams" (queryParams "q" .FilterQuery) 141 ) }} 142 {{ end }} 143 {{ if and .Stacks .RepoInfo.Spindle }} 144 <div 145 class="hidden" 146 hx-get="/{{ .RepoInfo.FullName }}/pulls/pipeline-statuses?{{ range .Stacks }}{{ range . }}sha={{ .LatestSha }}&{{ end }}{{ end }}" 147 hx-trigger="load" 148 hx-swap="none" 149 ></div> 150 {{ end }} 151{{ end }} 152 153{{ define "stackedPullList" }} 154 {{ $list := index . 0 }} 155 {{ $root := index . 1 }} 156 <div class="grid grid-cols-1 rounded-b border-b border-t border-gray-200 dark:border-gray-900 divide-y divide-gray-200 dark:divide-gray-900"> 157 {{ range $pull := $list }} 158 {{ $pipeline := index $root.Pipelines $pull.LatestSha }} 159 <a href="/{{ $root.RepoInfo.FullName }}/pulls/{{ $pull.PullId }}" class="no-underline hover:no-underline hover:bg-gray-100/25 hover:dark:bg-gray-700/25"> 160 <div class="flex gap-2 items-center px-6"> 161 <div class="flex-grow min-w-0 w-full py-2"> 162 {{ template "repo/pulls/fragments/summarizedPullHeader" (list $pull $pipeline $root.RepoInfo) }} 163 </div> 164 </div> 165 </a> 166 {{ end }} 167 </div> 168{{ end }}