A vibe coded tangled fork which supports pijul.
at 8a845fd93bfa2aa7d08a7fa2224dfd9b5deba8d9 156 lines 6.1 kB view raw
1{{ define "title" }}new pull &middot; {{ .RepoInfo.FullName }}{{ end }} 2 3{{ define "repoContent" }} 4 <h2 class="font-bold text-sm mb-4 uppercase dark:text-white"> 5 Create new pull request 6 </h2> 7 8 <form 9 hx-post="/{{ .RepoInfo.FullName }}/pulls/new" 10 hx-trigger="submit, keydown[(ctrlKey || metaKey) && key=='Enter'] from:(#patch,#title,#body)" 11 hx-indicator="#create-pull-spinner" 12 hx-swap="none" 13 > 14 <div class="flex flex-col gap-6"> 15 <div class="flex gap-2 items-center"> 16 <p>First, choose a target branch on {{ .RepoInfo.FullName }}:</p> 17 <div> 18 <select 19 required 20 name="targetBranch" 21 class="p-1 border border-gray-200 bg-white dark:bg-gray-700 dark:text-white dark:border-gray-600" 22 > 23 <option disabled selected>target branch</option> 24 25 26 {{ range .Branches }} 27 28 {{ $preset := false }} 29 {{ if $.TargetBranch }} 30 {{ $preset = eq .Reference.Name $.TargetBranch }} 31 {{ else }} 32 {{ $preset = .IsDefault }} 33 {{ end }} 34 35 <option value="{{ .Reference.Name }}" class="py-1" {{if $preset}}selected{{end}}> 36 {{ .Reference.Name }} 37 </option> 38 {{ end }} 39 </select> 40 </div> 41 </div> 42 43 <div class="flex flex-col gap-2"> 44 <h2 class="font-bold text-sm mb-4 uppercase dark:text-white"> 45 Choose pull strategy 46 </h2> 47 <nav class="flex space-x-4 items-center"> 48 <button 49 type="button" 50 class="btn" 51 hx-get="/{{ .RepoInfo.FullName }}/pulls/new/patch-upload" 52 hx-target="#patch-strategy" 53 hx-swap="innerHTML" 54 > 55 paste patch 56 </button> 57 58 {{ if .RepoInfo.Roles.IsPushAllowed }} 59 <span class="text-sm text-gray-500 dark:text-gray-400"> 60 or 61 </span> 62 <button 63 type="button" 64 class="btn" 65 hx-get="/{{ .RepoInfo.FullName }}/pulls/new/compare-branches" 66 hx-target="#patch-strategy" 67 hx-swap="innerHTML" 68 > 69 compare branches 70 </button> 71 {{ end }} 72 73 74 <span class="text-sm text-gray-500 dark:text-gray-400"> 75 or 76 </span> 77 <script> 78 function getQueryParams() { 79 return Object.fromEntries(new URLSearchParams(window.location.search)); 80 } 81 </script> 82 <!-- 83 since compare-forks need the server to load forks, we 84 hx-get this button; unlike simply loading the pullCompareForks template 85 as we do for the rest of the gang below. the hx-vals thing just populates 86 the query params so the forks page gets it. 87 --> 88 <button 89 type="button" 90 class="btn" 91 hx-get="/{{ .RepoInfo.FullName }}/pulls/new/compare-forks" 92 hx-target="#patch-strategy" 93 hx-swap="innerHTML" 94 {{ if eq .Strategy "fork" }} 95 hx-trigger="click, load" 96 hx-vals='js:{...getQueryParams()}' 97 {{ end }} 98 > 99 compare forks 100 </button> 101 102 103 </nav> 104 <section id="patch-strategy" class="flex flex-col gap-2"> 105 {{ if eq .Strategy "patch" }} 106 {{ template "repo/pulls/fragments/pullPatchUpload" . }} 107 {{ else if eq .Strategy "branch" }} 108 {{ template "repo/pulls/fragments/pullCompareBranches" . }} 109 {{ else }} 110 {{ template "repo/pulls/fragments/pullPatchUpload" . }} 111 {{ end }} 112 </section> 113 114 <div id="patch-error" class="error dark:text-red-300"></div> 115 </div> 116 117 <div> 118 <label for="title" class="dark:text-white">write a title</label> 119 120 <input 121 type="text" 122 name="title" 123 id="title" 124 value="{{ .Title }}" 125 class="w-full dark:bg-gray-700 dark:text-white dark:border-gray-600" 126 placeholder="One-line summary of your change." 127 /> 128 </div> 129 130 <div> 131 <label for="body" class="dark:text-white" 132 >add a description</label 133 > 134 135 <textarea 136 name="body" 137 id="body" 138 rows="6" 139 class="w-full resize-y dark:bg-gray-700 dark:text-white dark:border-gray-600" 140 placeholder="Describe your change. Markdown is supported." 141 >{{ .Body }}</textarea> 142 </div> 143 144 <div class="flex justify-start items-center gap-2 mt-4"> 145 <button type="submit" class="btn-create flex items-center gap-2"> 146 {{ i "git-pull-request-create" "w-4 h-4" }} 147 create pull 148 <span id="create-pull-spinner" class="group"> 149 {{ i "loader-circle" "w-4 h-4 animate-spin hidden group-[.htmx-request]:inline" }} 150 </span> 151 </button> 152 </div> 153 </div> 154 <div id="pull" class="error dark:text-red-300"></div> 155 </form> 156{{ end }}