forked from tangled.org/core
this repo has no description

appview: pages/templates/repo/pulls: rework new pull creation flow

Changed files
+101 -85
appview
pages
templates
repo
pulls
+11 -4
appview/pages/templates/repo/pulls/fragments/pullPatchUpload.html
···
{{ define "repo/pulls/fragments/pullPatchUpload" }}
<div id="patch-upload">
+
<p>
+
You can paste a <code>git diff</code> or a
+
<code>git format-patch</code> patch series here.
+
</p>
<textarea
+
hx-trigger="keyup changed delay:500ms, paste delay:500ms"
+
hx-post="/{{ .RepoInfo.FullName }}/pulls/new/validate-patch"
+
hx-swap="none"
name="patch"
id="patch"
rows="12"
-
class="w-full resize-y font-mono dark:bg-gray-700 dark:text-white dark:border-gray-600"
+
class="w-full mt-2 resize-y font-mono dark:bg-gray-700 dark:text-white dark:border-gray-600"
placeholder="diff --git a/file.txt b/file.txt
-
index 1234567..abcdefg 100644
-
--- a/file.txt
-
+++ b/file.txt"
+
index 1234567..abcdefg 100644
+
--- a/file.txt
+
+++ b/file.txt"
></textarea>
</div>
{{ end }}
+90 -81
appview/pages/templates/repo/pulls/new.html
···
hx-swap="none"
>
<div class="flex flex-col gap-4">
-
<div>
-
<label for="title" class="dark:text-white">write a title</label>
-
<input type="text" name="title" id="title" class="w-full dark:bg-gray-700 dark:text-white dark:border-gray-600" />
-
</div>
+
<label>configure your pull request</label>
-
<div>
-
<label for="body" class="dark:text-white">add a description</label>
-
<textarea
-
name="body"
-
id="body"
-
rows="6"
-
class="w-full resize-y dark:bg-gray-700 dark:text-white dark:border-gray-600"
-
placeholder="Describe your change. Markdown is supported."
-
></textarea>
-
</div>
+
<p>First, choose a target branch on {{ .RepoInfo.FullName }}.</p>
+
<div class="pb-2">
+
<select
+
required
+
name="targetBranch"
+
class="p-1 border border-gray-200 bg-white dark:bg-gray-700 dark:text-white dark:border-gray-600"
+
>
+
<option disabled selected>target branch</option>
+
{{ range .Branches }}
+
<option value="{{ .Reference.Name }}" class="py-1">
+
{{ .Reference.Name }}
+
</option>
+
{{ end }}
+
</select>
+
</div>
+
<p>Next, choose a pull strategy.</p>
+
<nav class="flex space-x-4 items-end">
+
<button
+
type="button"
+
class="px-3 py-2 pb-2 btn"
+
hx-get="/{{ .RepoInfo.FullName }}/pulls/new/patch-upload"
+
hx-target="#patch-strategy"
+
hx-swap="innerHTML"
+
>
+
paste patch
+
</button>
-
<label>configure your pull request</label>
+
{{ if .RepoInfo.Roles.IsPushAllowed }}
+
<span class="text-sm text-gray-500 dark:text-gray-400 pb-2">
+
or
+
</span>
+
<button
+
type="button"
+
class="px-3 py-2 pb-2 btn"
+
hx-get="/{{ .RepoInfo.FullName }}/pulls/new/compare-branches"
+
hx-target="#patch-strategy"
+
hx-swap="innerHTML"
+
>
+
compare branches
+
</button>
+
{{ end }}
-
<p>First, choose a target branch on {{ .RepoInfo.FullName }}.</p>
-
<div class="pb-2">
-
<select
-
required
-
name="targetBranch"
-
class="p-1 border border-gray-200 bg-white dark:bg-gray-700 dark:text-white dark:border-gray-600"
-
>
-
<option disabled selected>target branch</option>
-
{{ range .Branches }}
-
<option value="{{ .Reference.Name }}" class="py-1">
-
{{ .Reference.Name }}
-
</option>
-
{{ end }}
-
</select>
-
</div>
+
+
<span class="text-sm text-gray-500 dark:text-gray-400 pb-2">
+
or
+
</span>
+
<button
+
type="button"
+
class="px-3 py-2 pb-2 btn"
+
hx-get="/{{ .RepoInfo.FullName }}/pulls/new/compare-forks"
+
hx-target="#patch-strategy"
+
hx-swap="innerHTML"
+
>
+
compare forks
+
</button>
+
</nav>
+
+
<section id="patch-strategy">
+
{{ template "repo/pulls/fragments/pullPatchUpload" . }}
+
</section>
+
+
<p id="patch-preview"></p>
-
<p>Then, choose a pull strategy.</p>
-
<nav class="flex space-x-4 items-end">
-
<button
-
type="button"
-
class="px-3 py-2 pb-2 btn"
-
hx-get="/{{ .RepoInfo.FullName }}/pulls/new/patch-upload"
-
hx-target="#patch-strategy"
-
hx-swap="innerHTML"
-
>
-
paste patch
-
</button>
+
<div id="patch-error" class="error dark:text-red-300"></div>
-
{{ if .RepoInfo.Roles.IsPushAllowed }}
-
<span class="text-sm text-gray-500 dark:text-gray-400 pb-2">
-
or
-
</span>
-
<button
-
type="button"
-
class="px-3 py-2 pb-2 btn"
-
hx-get="/{{ .RepoInfo.FullName }}/pulls/new/compare-branches"
-
hx-target="#patch-strategy"
-
hx-swap="innerHTML"
-
>
-
compare branches
-
</button>
-
{{ end }}
+
<div>
+
<label for="title" class="dark:text-white">write a title</label>
-
<span class="text-sm text-gray-500 dark:text-gray-400 pb-2">
-
or
-
</span>
-
<button
-
type="button"
-
class="px-3 py-2 pb-2 btn"
-
hx-get="/{{ .RepoInfo.FullName }}/pulls/new/compare-forks"
-
hx-target="#patch-strategy"
-
hx-swap="innerHTML"
-
>
-
compare forks
-
</button>
-
</nav>
+
<input
+
type="text"
+
name="title"
+
id="title"
+
class="w-full dark:bg-gray-700 dark:text-white dark:border-gray-600"
+
placeholder="One-line summary of your change."
+
/>
+
</div>
-
<section id="patch-strategy">
-
{{ template "repo/pulls/fragments/pullPatchUpload" . }}
-
</section>
+
<div>
+
<label for="body" class="dark:text-white"
+
>add a description</label
+
>
-
<div class="flex justify-start items-center gap-2 mt-4">
-
<button type="submit" class="btn flex items-center gap-2">
-
{{ i "git-pull-request-create" "w-4 h-4" }}
-
create pull
-
</button>
-
</div>
+
<textarea
+
name="body"
+
id="body"
+
rows="6"
+
class="w-full resize-y dark:bg-gray-700 dark:text-white dark:border-gray-600"
+
placeholder="Describe your change. Markdown is supported."
+
></textarea>
+
</div>
+
<div class="flex justify-start items-center gap-2 mt-4">
+
<button type="submit" class="btn flex items-center gap-2">
+
{{ i "git-pull-request-create" "w-4 h-4" }}
+
create pull
+
</button>
+
</div>
</div>
<div id="pull" class="error dark:text-red-300"></div>
</form>
{{ end }}
-
-
{{ define "repoAfter" }}
-
<div id="patch-preview" class="error dark:text-red-300"></div>
-
{{ end }}