+11
-4
appview/pages/templates/repo/pulls/fragments/pullPatchUpload.html
+11
-4
appview/pages/templates/repo/pulls/fragments/pullPatchUpload.html
···
1
1
{{ define "repo/pulls/fragments/pullPatchUpload" }}
2
2
<div id="patch-upload">
3
+
<p>
4
+
You can paste a <code>git diff</code> or a
5
+
<code>git format-patch</code> patch series here.
6
+
</p>
3
7
<textarea
8
+
hx-trigger="keyup changed delay:500ms, paste delay:500ms"
9
+
hx-post="/{{ .RepoInfo.FullName }}/pulls/new/validate-patch"
10
+
hx-swap="none"
4
11
name="patch"
5
12
id="patch"
6
13
rows="12"
7
-
class="w-full resize-y font-mono dark:bg-gray-700 dark:text-white dark:border-gray-600"
14
+
class="w-full mt-2 resize-y font-mono dark:bg-gray-700 dark:text-white dark:border-gray-600"
8
15
placeholder="diff --git a/file.txt b/file.txt
9
-
index 1234567..abcdefg 100644
10
-
--- a/file.txt
11
-
+++ b/file.txt"
16
+
index 1234567..abcdefg 100644
17
+
--- a/file.txt
18
+
+++ b/file.txt"
12
19
></textarea>
13
20
</div>
14
21
{{ end }}
+90
-81
appview/pages/templates/repo/pulls/new.html
+90
-81
appview/pages/templates/repo/pulls/new.html
···
7
7
hx-swap="none"
8
8
>
9
9
<div class="flex flex-col gap-4">
10
-
<div>
11
-
<label for="title" class="dark:text-white">write a title</label>
12
-
<input type="text" name="title" id="title" class="w-full dark:bg-gray-700 dark:text-white dark:border-gray-600" />
13
-
</div>
10
+
<label>configure your pull request</label>
14
11
15
-
<div>
16
-
<label for="body" class="dark:text-white">add a description</label>
17
-
<textarea
18
-
name="body"
19
-
id="body"
20
-
rows="6"
21
-
class="w-full resize-y dark:bg-gray-700 dark:text-white dark:border-gray-600"
22
-
placeholder="Describe your change. Markdown is supported."
23
-
></textarea>
24
-
</div>
12
+
<p>First, choose a target branch on {{ .RepoInfo.FullName }}.</p>
13
+
<div class="pb-2">
14
+
<select
15
+
required
16
+
name="targetBranch"
17
+
class="p-1 border border-gray-200 bg-white dark:bg-gray-700 dark:text-white dark:border-gray-600"
18
+
>
19
+
<option disabled selected>target branch</option>
20
+
{{ range .Branches }}
21
+
<option value="{{ .Reference.Name }}" class="py-1">
22
+
{{ .Reference.Name }}
23
+
</option>
24
+
{{ end }}
25
+
</select>
26
+
</div>
25
27
28
+
<p>Next, choose a pull strategy.</p>
29
+
<nav class="flex space-x-4 items-end">
30
+
<button
31
+
type="button"
32
+
class="px-3 py-2 pb-2 btn"
33
+
hx-get="/{{ .RepoInfo.FullName }}/pulls/new/patch-upload"
34
+
hx-target="#patch-strategy"
35
+
hx-swap="innerHTML"
36
+
>
37
+
paste patch
38
+
</button>
26
39
27
-
<label>configure your pull request</label>
40
+
{{ if .RepoInfo.Roles.IsPushAllowed }}
41
+
<span class="text-sm text-gray-500 dark:text-gray-400 pb-2">
42
+
or
43
+
</span>
44
+
<button
45
+
type="button"
46
+
class="px-3 py-2 pb-2 btn"
47
+
hx-get="/{{ .RepoInfo.FullName }}/pulls/new/compare-branches"
48
+
hx-target="#patch-strategy"
49
+
hx-swap="innerHTML"
50
+
>
51
+
compare branches
52
+
</button>
53
+
{{ end }}
28
54
29
-
<p>First, choose a target branch on {{ .RepoInfo.FullName }}.</p>
30
-
<div class="pb-2">
31
-
<select
32
-
required
33
-
name="targetBranch"
34
-
class="p-1 border border-gray-200 bg-white dark:bg-gray-700 dark:text-white dark:border-gray-600"
35
-
>
36
-
<option disabled selected>target branch</option>
37
-
{{ range .Branches }}
38
-
<option value="{{ .Reference.Name }}" class="py-1">
39
-
{{ .Reference.Name }}
40
-
</option>
41
-
{{ end }}
42
-
</select>
43
-
</div>
55
+
56
+
<span class="text-sm text-gray-500 dark:text-gray-400 pb-2">
57
+
or
58
+
</span>
59
+
<button
60
+
type="button"
61
+
class="px-3 py-2 pb-2 btn"
62
+
hx-get="/{{ .RepoInfo.FullName }}/pulls/new/compare-forks"
63
+
hx-target="#patch-strategy"
64
+
hx-swap="innerHTML"
65
+
>
66
+
compare forks
67
+
</button>
68
+
</nav>
69
+
70
+
<section id="patch-strategy">
71
+
{{ template "repo/pulls/fragments/pullPatchUpload" . }}
72
+
</section>
73
+
74
+
<p id="patch-preview"></p>
44
75
45
-
<p>Then, choose a pull strategy.</p>
46
-
<nav class="flex space-x-4 items-end">
47
-
<button
48
-
type="button"
49
-
class="px-3 py-2 pb-2 btn"
50
-
hx-get="/{{ .RepoInfo.FullName }}/pulls/new/patch-upload"
51
-
hx-target="#patch-strategy"
52
-
hx-swap="innerHTML"
53
-
>
54
-
paste patch
55
-
</button>
76
+
<div id="patch-error" class="error dark:text-red-300"></div>
56
77
57
-
{{ if .RepoInfo.Roles.IsPushAllowed }}
58
-
<span class="text-sm text-gray-500 dark:text-gray-400 pb-2">
59
-
or
60
-
</span>
61
-
<button
62
-
type="button"
63
-
class="px-3 py-2 pb-2 btn"
64
-
hx-get="/{{ .RepoInfo.FullName }}/pulls/new/compare-branches"
65
-
hx-target="#patch-strategy"
66
-
hx-swap="innerHTML"
67
-
>
68
-
compare branches
69
-
</button>
70
-
{{ end }}
78
+
<div>
79
+
<label for="title" class="dark:text-white">write a title</label>
71
80
72
-
<span class="text-sm text-gray-500 dark:text-gray-400 pb-2">
73
-
or
74
-
</span>
75
-
<button
76
-
type="button"
77
-
class="px-3 py-2 pb-2 btn"
78
-
hx-get="/{{ .RepoInfo.FullName }}/pulls/new/compare-forks"
79
-
hx-target="#patch-strategy"
80
-
hx-swap="innerHTML"
81
-
>
82
-
compare forks
83
-
</button>
84
-
</nav>
81
+
<input
82
+
type="text"
83
+
name="title"
84
+
id="title"
85
+
class="w-full dark:bg-gray-700 dark:text-white dark:border-gray-600"
86
+
placeholder="One-line summary of your change."
87
+
/>
88
+
</div>
85
89
86
-
<section id="patch-strategy">
87
-
{{ template "repo/pulls/fragments/pullPatchUpload" . }}
88
-
</section>
90
+
<div>
91
+
<label for="body" class="dark:text-white"
92
+
>add a description</label
93
+
>
89
94
90
-
<div class="flex justify-start items-center gap-2 mt-4">
91
-
<button type="submit" class="btn flex items-center gap-2">
92
-
{{ i "git-pull-request-create" "w-4 h-4" }}
93
-
create pull
94
-
</button>
95
-
</div>
95
+
<textarea
96
+
name="body"
97
+
id="body"
98
+
rows="6"
99
+
class="w-full resize-y dark:bg-gray-700 dark:text-white dark:border-gray-600"
100
+
placeholder="Describe your change. Markdown is supported."
101
+
></textarea>
102
+
</div>
96
103
104
+
<div class="flex justify-start items-center gap-2 mt-4">
105
+
<button type="submit" class="btn flex items-center gap-2">
106
+
{{ i "git-pull-request-create" "w-4 h-4" }}
107
+
create pull
108
+
</button>
109
+
</div>
97
110
</div>
98
111
<div id="pull" class="error dark:text-red-300"></div>
99
112
</form>
100
113
{{ end }}
101
-
102
-
{{ define "repoAfter" }}
103
-
<div id="patch-preview" class="error dark:text-red-300"></div>
104
-
{{ end }}