forked from tangled.org/core
Monorepo for Tangled

appview: style commits in format-patches

Changed files
+50 -34
appview
pages
templates
repo
pulls
+50 -34
appview/pages/templates/repo/pulls/pull.html
··· 64 64 65 65 {{ if .IsFormatPatch }} 66 66 {{ $patches := .AsFormatPatch }} 67 - {{ range $patches }} 68 - <div class="rounded ml-20 drop-shadow-sm bg-white dark:bg-gray-800 dark:text-white w-fit md:max-w-3/5 flex flex-col gap-2 mt-2 relative"> 69 - <div id="commit-{{.SHA}}" class="py-2 px-2 relative w-full md:max-w-3/5 md:w-fit flex flex-col"> 70 - <div class="flex items-center justify-between gap-2"> 71 - <div class="mr-4 flex items-center justify-start"> 72 - {{ i "git-commit-horizontal" "w-4 h-4 mr-1.5" }} 73 - <span>{{ .Title }}</span> 67 + {{ $round := .RoundNumber }} 68 + <details class="group py-2 md:ml-[3.5rem] text-gray-500 dark:text-gray-400 flex flex-col gap-2 relative text-sm"> 69 + <summary class="py-1 list-none cursor-pointer hover:text-gray-500 hover:dark:text-gray-400"> 70 + {{ $s := "s" }} 71 + {{ if eq (len $patches) 1 }} 72 + {{ $s = "" }} 73 + {{ end }} 74 + <div class="group-open:hidden flex items-center gap-2 ml-2"> 75 + {{ i "chevrons-up-down" "w-4 h-4" }} expand {{ len $patches }} commit{{$s}} 76 + </div> 77 + <div class="hidden group-open:flex items-center gap-2 ml-2"> 78 + {{ i "chevrons-down-up" "w-4 h-4" }} hide {{ len $patches }} commit{{$s}} 79 + </div> 80 + </summary> 81 + {{ range $patches }} 82 + <div id="commit-{{.SHA}}" class="py-1 px-2 relative w-full md:max-w-3/5 md:w-fit flex flex-col"> 83 + <div class="flex items-center gap-2"> 84 + {{ i "git-commit-horizontal" "w-4 h-4" }} 85 + <div class="text-sm text-gray-500 dark:text-gray-400"> 86 + {{ if not $.Pull.IsPatchBased }} 87 + {{ $fullRepo := $.RepoInfo.FullName }} 88 + {{ if not $.Pull.IsBranchBased }} 89 + {{ $fullRepo = printf "%s/%s" $owner $.PullSourceRepo.Name }} 90 + {{ end }} 91 + <a href="/{{ $fullRepo }}/commit/{{ .SHA }}" class="font-mono text-gray-500 dark:text-gray-400">{{ slice .SHA 0 8 }}</a> 92 + {{ else }} 93 + <span class="font-mono">{{ slice .SHA 0 8 }}</span> 94 + {{ end }} 95 + </div> 96 + <div class="flex items-center"> 97 + <span>{{ .Title }}</span> 98 + {{ if gt (len .Body) 0 }} 99 + <button 100 + class="py-1/2 px-1 mx-2 bg-gray-200 hover:bg-gray-400 rounded dark:bg-gray-700 dark:hover:bg-gray-600" 101 + hx-on:click="document.getElementById('body-{{$round}}-{{.SHA}}').classList.toggle('hidden')" 102 + > 103 + {{ i "ellipsis" "w-3 h-3" }} 104 + </button> 105 + {{ end }} 106 + </div> 107 + </div> 74 108 {{ if gt (len .Body) 0 }} 75 - <button 76 - class="py-1/2 px-1 mx-2 bg-gray-200 hover:bg-gray-400 rounded dark:bg-gray-700 dark:hover:bg-gray-600" 77 - hx-on:click="document.getElementById('body-{{.SHA}}').classList.toggle('hidden')" 78 - > 79 - {{ i "ellipsis" "w-3 h-3" }} 80 - </button> 109 + <p id="body-{{$round}}-{{.SHA}}" class="hidden mt-1 text-sm pb-2"> 110 + {{ nl2br .Body }} 111 + </p> 81 112 {{ end }} 82 - </div> 83 - <div class="text-sm text-gray-500 dark:text-gray-400"> 84 - {{ if not $.Pull.IsPatchBased }} 85 - {{ $fullRepo := $.RepoInfo.FullName }} 86 - {{ if not $.Pull.IsBranchBased }} 87 - {{ $fullRepo = printf "%s/%s" $owner $.PullSourceRepo.Name }} 88 - {{ end }} 89 - <a href="/{{ $fullRepo }}/commit/{{ .SHA }}" class="font-mono">{{ slice .SHA 0 8 }}</a> 90 - {{ else }} 91 - <span class="font-mono">{{ slice .SHA 0 8 }}</span> 92 - {{ end }} 93 - </div> 94 113 </div> 95 - {{ if gt (len .Body) 0 }} 96 - <p id="body-{{.SHA}}" class="hidden mt-1 text-sm pb-2 dark:text-gray-300"> 97 - {{ nl2br .Body }} 98 - </p> 99 - {{ end }} 100 - </div> 101 - </div> 102 - {{ end }} 114 + {{ end }} 115 + </details> 103 116 {{ end }} 104 117 105 118 106 - <div class="md:pl-12 flex flex-col gap-2 mt-2 relative"> 119 + <div class="md:pl-[3.5rem] flex flex-col gap-2 mt-2 relative"> 107 120 {{ range $cidx, $c := .Comments }} 108 121 <div id="comment-{{$c.ID}}" class="bg-white dark:bg-gray-800 rounded drop-shadow-sm py-2 px-4 relative w-full md:max-w-3/5 md:w-fit"> 109 122 {{ if gt $cidx 0 }} ··· 204 217 </div> 205 218 {{ end }} 206 219 {{ end }} 220 + 221 + {{ define "commits" }} 222 + {{ end }}