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