Monorepo for Tangled
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

appview/pages: rework label panel and new-pull shell for compose

Lewis: May this revision serve well! <lewis@tangled.org>

authored by

Lewis and committed by
Tangled
cf76a576 697c6664

+163 -232
+1 -1
appview/pages/templates/repo/fragments/compareAllowPull.html
··· 9 9 discussed. 10 10 </p> 11 11 12 - {{ $newPullUrl := printf "/%s/pulls/new?strategy=branch&targetBranch=%s&sourceBranch=%s" .RepoInfo.FullName .Base .Head }} 12 + {{ $newPullUrl := printf "/%s/pulls/new?source=branch&sourceBranch=%s&targetBranch=%s" .RepoInfo.FullName (urlquery .Head) (urlquery .Base) }} 13 13 14 14 15 15 <div class="flex justify-start items-center gap-2 mt-2">
+7 -4
appview/pages/templates/repo/fragments/diff.html
··· 101 101 {{ define "diffLayout" }} 102 102 {{ $diff := index . 0 }} 103 103 {{ $opts := index . 1 }} 104 + {{ $padBottom := gt (len .) 2 }} 104 105 105 106 <div class="flex col-span-full flex-grow"> 106 107 <!-- left panel --> 107 - <div id="files" class="w-0 hidden md:block overflow-hidden sticky top-12 max-h-screen overflow-y-auto pb-12"> 108 + <div id="files" class="w-0 hidden md:block overflow-hidden sticky top-12 max-h-screen overflow-y-auto {{ if $padBottom }}pb-12{{ end }}"> 108 109 <section class="overflow-x-auto text-sm px-6 py-2 border border-gray-200 dark:border-gray-700 w-full mx-auto min-h-full rounded bg-white dark:bg-gray-800 drop-shadow-sm"> 109 110 {{ template "repo/fragments/fileTree" $diff.FileTree }} 110 111 </section> ··· 113 114 {{ template "resize-grip" (list "resize-files" "files" "before") }} 114 115 115 116 <!-- main content --> 116 - <div id="diff-files" class="flex-1 min-w-0 sticky top-12 pb-12"> 117 + <div id="diff-files" class="flex-1 min-w-0 sticky top-12 {{ if $padBottom }}pb-12{{ end }}"> 117 118 {{ template "diffFiles" (list $diff $opts) }} 118 119 </div> 119 120 ··· 142 143 {{ $idx := index . 0 }} 143 144 {{ $file := index . 1 }} 144 145 {{ $isSplit := index . 2 }} 146 + {{ $collapsed := false }} 147 + {{ if gt (len .) 3 }}{{ $collapsed = index . 3 }}{{ end }} 145 148 {{ $isGenerated := false }} 146 149 {{ $isDeleted := false }} 147 150 {{ with $file }} ··· 152 155 {{ else if $n.Old }} 153 156 {{ $isGenerated = isGenerated $n.Old }} 154 157 {{ end }} 155 - <details {{ if and (not $isGenerated) (not $isDeleted) }}open{{ end }} id="file-{{ .Id }}" class="group border border-gray-200 dark:border-gray-700 w-full mx-auto rounded bg-white dark:bg-gray-800 drop-shadow-sm" tabindex="{{ add $idx 1 }}"> 158 + <details {{ if and (not $isGenerated) (not $isDeleted) (not $collapsed) }}open{{ end }} id="file-{{ .Id }}" class="group border border-gray-200 dark:border-gray-700 w-full mx-auto rounded bg-white dark:bg-gray-800 drop-shadow-sm" tabindex="{{ add $idx 1 }}"> 156 159 <summary class="list-none cursor-pointer sticky top-12 group-open:border-b border-gray-200 dark:border-gray-700"> 157 160 <div id="diff-file-header" class="rounded cursor-pointer bg-white dark:bg-gray-800 flex justify-between"> 158 161 <div id="left-side-items" class="p-2 flex gap-2 items-center overflow-x-auto"> ··· 214 217 {{ end }} 215 218 216 219 {{ define "filesCheckbox" }} 217 - <input type="checkbox" id="filesToggle" class="peer/files hidden" checked/> 220 + <input type="checkbox" id="filesToggle" class="peer/files hidden" {{ if gt (len .) 2 }}checked{{ end }}/> 218 221 {{ end }} 219 222 220 223 {{ define "filesToggle" }}
+33 -14
appview/pages/templates/repo/fragments/diffOpts.html
··· 4 4 {{ $active = "split" }} 5 5 {{ end }} 6 6 7 - {{ $activeTab := "bg-white dark:bg-gray-700 shadow-sm" }} 8 - {{ $inactiveTab := "bg-gray-100 dark:bg-gray-800 shadow-inner" }} 7 + {{ $activeTab := "bg-white dark:bg-gray-800 shadow-sm cursor-default" }} 8 + {{ $inactiveTab := "hover:text-gray-900 dark:hover:text-white" }} 9 + {{ $usePost := ne .RefreshUrl "" }} 10 + {{ $target := .Target }} 11 + {{ if eq $target "" }}{{ $target = "#diff-files" }}{{ end }} 12 + {{ $field := .Field }} 13 + {{ if eq $field "" }}{{ $field = "diff" }}{{ end }} 9 14 10 - <div class="flex justify-between divide-x divide-gray-200 dark:divide-gray-700 rounded border border-gray-200 dark:border-gray-700 overflow-hidden" 11 - hx-on::before-request="const t=event.target.closest('button'); if(!t||t.classList.contains('shadow-sm'))return event.preventDefault(); this.querySelectorAll('button').forEach(b => { const active=b===t; b.classList.toggle('bg-white',active); b.classList.toggle('dark:bg-gray-700',active); b.classList.toggle('shadow-sm',active); b.classList.toggle('bg-gray-100',!active); b.classList.toggle('dark:bg-gray-800',!active); b.classList.toggle('shadow-inner',!active); })"> 15 + <div class="inline-flex items-center gap-1 p-1 bg-slate-100 dark:bg-gray-900 rounded-md text-gray-600 dark:text-gray-300" 16 + hx-on::before-request="const t=event.target.closest('button'); if(!t||t.classList.contains('shadow-sm'))return event.preventDefault(); this.querySelectorAll('button').forEach(b => { const active=b===t; b.classList.toggle('bg-white',active); b.classList.toggle('dark:bg-gray-800',active); b.classList.toggle('shadow-sm',active); b.classList.toggle('cursor-default',active); b.classList.toggle('hover:text-gray-900',!active); b.classList.toggle('dark:hover:text-white',!active); })"> 12 17 <button 13 - hx-get="?diff=unified" 14 - hx-target="#diff-files" 15 - hx-select="#diff-files" 18 + {{ if $usePost }} 19 + hx-post="{{ .RefreshUrl }}" 20 + hx-vals='{"{{ $field }}":"unified"}' 21 + hx-include="closest form" 22 + {{ else }} 23 + hx-get="?{{ $field }}=unified" 24 + hx-push-url="true" 25 + {{ end }} 26 + hx-target="{{ $target }}" 27 + hx-select="{{ $target }}" 16 28 hx-swap="outerHTML" 17 - hx-push-url="true" 18 - class="group p-2 whitespace-nowrap flex justify-center items-center gap-2 text-sm w-full hover:no-underline text-center {{ if eq $active "unified" }} {{ $activeTab }} {{ else }} {{ $inactiveTab }} {{ end }}"> 29 + hx-indicator="this" 30 + class="group flex items-center justify-center gap-2 px-3 py-1 text-sm whitespace-nowrap rounded hover:no-underline {{ if eq $active "unified" }} {{ $activeTab }} {{ else }} {{ $inactiveTab }} {{ end }}"> 19 31 {{ i "square-split-vertical" "size-4 inline group-[.htmx-request]:hidden" }} 20 32 {{ i "loader-circle" "size-4 animate-spin hidden group-[.htmx-request]:inline" }} 21 33 unified 22 34 </button> 23 35 <button 24 - hx-get="?diff=split" 25 - hx-target="#diff-files" 26 - hx-select="#diff-files" 36 + {{ if $usePost }} 37 + hx-post="{{ .RefreshUrl }}" 38 + hx-vals='{"{{ $field }}":"split"}' 39 + hx-include="closest form" 40 + {{ else }} 41 + hx-get="?{{ $field }}=split" 42 + hx-push-url="true" 43 + {{ end }} 44 + hx-target="{{ $target }}" 45 + hx-select="{{ $target }}" 27 46 hx-swap="outerHTML" 28 - hx-push-url="true" 29 - class="group p-2 whitespace-nowrap flex justify-center items-center gap-2 text-sm w-full hover:no-underline text-center {{ if eq $active "split" }} {{ $activeTab }} {{ else }} {{ $inactiveTab }} {{ end }}"> 47 + hx-indicator="this" 48 + class="group flex items-center justify-center gap-2 px-3 py-1 text-sm whitespace-nowrap rounded hover:no-underline {{ if eq $active "split" }} {{ $activeTab }} {{ else }} {{ $inactiveTab }} {{ end }}"> 30 49 {{ i "square-split-horizontal" "size-4 inline group-[.htmx-request]:hidden" }} 31 50 {{ i "loader-circle" "size-4 animate-spin hidden group-[.htmx-request]:inline" }} 32 51 split
+97 -49
appview/pages/templates/repo/fragments/editLabelPanel.html
··· 20 20 {{ $defs := .Defs }} 21 21 {{ $subject := .Subject }} 22 22 {{ $state := .State }} 23 + {{ $prefix := .Prefix }} 23 24 {{ $labelStyle := "flex items-center gap-2 rounded py-1 px-2 border border-gray-200 dark:border-gray-700 text-sm bg-white dark:bg-gray-800 text-black dark:text-white" }} 24 - <div> 25 - {{ template "repo/fragments/labelSectionHeaderText" "Labels" }} 25 + {{ $hasNullDefs := false }} 26 + {{ range $k, $d := $defs }} 27 + {{ if $d.ValueType.IsNull }}{{ $hasNullDefs = true }}{{ end }} 28 + {{ end }} 29 + {{ if or $hasNullDefs (not $defs) }} 30 + <div> 31 + {{ template "repo/fragments/labelSectionHeaderText" "Labels" }} 26 32 27 - <div class="flex gap-1 items-center flex-wrap"> 28 - {{ range $k, $d := $defs }} 29 - {{ $isChecked := $state.ContainsLabel $k }} 30 - {{ if $d.ValueType.IsNull }} 31 - {{ $fieldName := $d.AtUri }} 32 - <label class="{{$labelStyle}}"> 33 - <input type="checkbox" id="{{ $fieldName }}" name="{{ $fieldName }}" value="null" {{if $isChecked}}checked{{end}}> 34 - {{ template "labels/fragments/labelDef" $d }} 35 - </label> 33 + <div class="flex flex-col gap-1 items-start"> 34 + {{ range $k, $d := $defs }} 35 + {{ $isChecked := $state.ContainsLabel $k }} 36 + {{ if $d.ValueType.IsNull }} 37 + {{ $fieldName := $d.AtUri.String }} 38 + {{ if $prefix }}{{ $fieldName = printf "%s[%s]" $prefix $d.AtUri }}{{ end }} 39 + <label class="{{$labelStyle}}"> 40 + <input type="checkbox" name="{{ $fieldName }}" value="null" {{if $isChecked}}checked{{end}}> 41 + {{ template "labels/fragments/labelDef" $d }} 42 + </label> 43 + {{ end }} 44 + {{ else }} 45 + <p class="text-gray-500 dark:text-gray-400 text-sm py-1"> 46 + No labels defined yet. You can choose default labels or define custom 47 + labels in <a class="underline" href="/{{ $.RepoInfo.FullName }}/settings">settings</a>. 48 + </p> 36 49 {{ end }} 37 - {{ else }} 38 - <p class="text-gray-500 dark:text-gray-400 text-sm py-1"> 39 - No labels defined yet. You can choose default labels or define custom 40 - labels in <a class="underline" href="/{{ $.RepoInfo.FullName }}/settings">settings</a>. 41 - </p> 42 - {{ end }} 50 + </div> 43 51 </div> 44 - </div> 52 + {{ end }} 45 53 {{ end }} 46 54 47 55 {{ define "editKvLabels" }} 48 56 {{ $defs := .Defs }} 49 57 {{ $subject := .Subject }} 50 58 {{ $state := .State }} 59 + {{ $prefix := .Prefix }} 60 + {{ $groupSuffix := "" }} 61 + {{ if $prefix }}{{ $groupSuffix = printf "-%s" $prefix }}{{ end }} 51 62 {{ $labelStyle := "font-normal normal-case flex items-center gap-2 p-0" }} 52 63 53 64 {{ range $k, $d := $defs }} 54 65 {{ if (not $d.ValueType.IsNull) }} 55 - {{ $fieldName := $d.AtUri }} 66 + {{ $fieldName := $d.AtUri.String }} 67 + {{ if $prefix }}{{ $fieldName = printf "%s[%s]" $prefix $d.AtUri }}{{ end }} 56 68 {{ $valset := $state.GetValSet $k }} 57 - <div id="label-{{$d.Id}}" class="flex flex-col gap-1"> 58 - {{ template "repo/fragments/labelSectionHeaderText" $d.Name }} 69 + <div id="label-{{$d.Id}}{{ $groupSuffix }}" class="flex flex-col gap-1"> 70 + {{ if not $d.ValueType.IsBool }} 71 + {{ template "repo/fragments/labelSectionHeaderText" $d.Name }} 72 + {{ end }} 59 73 {{ if (and $d.Multiple $d.ValueType.IsEnum) }} 60 74 <!-- checkbox --> 61 75 {{ range $variant := $d.ValueType.Enum }} ··· 67 81 {{ else if $d.Multiple }} 68 82 <!-- dynamically growing input fields --> 69 83 {{ range $v, $s := $valset }} 70 - {{ template "multipleInputField" (dict "def" $d "value" $v "key" $k) }} 84 + {{ template "multipleInputField" (dict "def" $d "value" $v "key" $k "prefix" $prefix) }} 71 85 {{ else }} 72 - {{ template "multipleInputField" (dict "def" $d "value" "" "key" $k) }} 86 + {{ template "multipleInputField" (dict "def" $d "value" "" "key" $k "prefix" $prefix) }} 73 87 {{ end }} 74 - {{ template "addFieldButton" $d }} 88 + {{ template "addFieldButton" (dict "def" $d "prefix" $prefix "groupSuffix" $groupSuffix) }} 89 + {{ if and $.LoggedInUser $d.ValueType.IsString $d.ValueType.IsDidFormat }} 90 + {{ template "assignToMeButton" (dict "def" $d "user" $.LoggedInUser "groupSuffix" $groupSuffix) }} 91 + {{ end }} 75 92 {{ else if $d.ValueType.IsEnum }} 76 93 <!-- radio buttons --> 77 94 {{ $isUsed := $state.ContainsLabel $k }} ··· 88 105 {{ else }} 89 106 <!-- single input field based on value type --> 90 107 {{ range $v, $s := $valset }} 91 - {{ template "valueTypeInput" (dict "def" $d "value" $v "key" $k) }} 108 + {{ template "valueTypeInput" (dict "def" $d "value" $v "key" $k "prefix" $prefix) }} 92 109 {{ else }} 93 - {{ template "valueTypeInput" (dict "def" $d "value" "" "key" $k) }} 110 + {{ template "valueTypeInput" (dict "def" $d "value" "" "key" $k "prefix" $prefix) }} 94 111 {{ end }} 95 112 {{ end }} 96 113 </div> ··· 100 117 101 118 {{ define "multipleInputField" }} 102 119 <div class="flex gap-1 items-stretch"> 103 - {{ template "valueTypeInput" . }} 120 + <div class="flex-1 min-w-0"> 121 + {{ template "valueTypeInput" . }} 122 + </div> 104 123 {{ template "removeFieldButton" }} 105 124 </div> 106 125 {{ end }} 107 126 127 + {{ define "assignToMeButton" }} 128 + {{ $def := .def }} 129 + {{ $user := .user }} 130 + {{ $groupSuffix := .groupSuffix }} 131 + {{ $handle := trimPrefix (resolve $user.Did) "@" }} 132 + <button type="button" 133 + data-assign-to-me="{{ $def.Id }}{{ $groupSuffix }}" 134 + data-handle="{{ $handle }}" 135 + onclick="(() => { 136 + const group = document.getElementById('label-' + this.dataset.assignToMe); 137 + const handle = this.dataset.handle; 138 + const inputs = group.querySelectorAll('input[type=text]'); 139 + const empty = Array.from(inputs).find(i => !i.value.trim()); 140 + if (empty) { empty.value = handle; return; } 141 + if (Array.from(inputs).some(i => i.value.trim() === handle)) return; 142 + const tpl = document.getElementById('tpl-' + this.dataset.assignToMe); 143 + if (!tpl) return; 144 + const addBtn = tpl.nextElementSibling; 145 + addBtn.insertAdjacentHTML('beforebegin', tpl.innerHTML); 146 + const newInput = addBtn.previousElementSibling.querySelector('input[type=text]'); 147 + if (newInput) newInput.value = handle; 148 + })()" 149 + class="text-xs text-gray-500 dark:text-gray-400 hover:underline self-end inline-flex items-center gap-1"> 150 + {{ i "user-round-plus" "size-3.5" }} 151 + assign to me 152 + </button> 153 + {{ end }} 154 + 108 155 {{ define "addFieldButton" }} 109 - <div style="display:none" id="tpl-{{ .Id }}"> 110 - {{ template "multipleInputField" (dict "def" . "value" "" "key" .AtUri.String) }} 156 + {{ $def := .def }} 157 + {{ $prefix := .prefix }} 158 + {{ $groupSuffix := .groupSuffix }} 159 + <div style="display:none" id="tpl-{{ $def.Id }}{{ $groupSuffix }}"> 160 + {{ template "multipleInputField" (dict "def" $def "value" "" "key" $def.AtUri.String "prefix" $prefix) }} 111 161 </div> 112 - <button type="button" onClick="this.insertAdjacentHTML('beforebegin', document.getElementById('tpl-{{ .Id }}').innerHTML)" class="w-full btn flex items-center gap-2"> 162 + <button type="button" onClick="this.insertAdjacentHTML('beforebegin', document.getElementById('tpl-{{ $def.Id }}{{ $groupSuffix }}').innerHTML)" class="w-full btn flex items-center gap-2"> 113 163 {{ i "plus" "size-4" }} add 114 164 </button> 115 165 {{ end }} ··· 139 189 140 190 {{ define "boolTypeInput" }} 141 191 {{ $def := .def }} 142 - {{ $fieldName := $def.AtUri }} 192 + {{ $prefix := .prefix }} 193 + {{ $fieldName := $def.AtUri.String }} 194 + {{ if $prefix }}{{ $fieldName = printf "%s[%s]" $prefix $def.AtUri }}{{ end }} 143 195 {{ $value := .value }} 144 - {{ $labelStyle = "font-normal normal-case flex items-center gap-2" }} 145 - <div class="flex flex-col gap-1"> 146 - <label class="{{$labelStyle}}"> 147 - <input type="radio" name="{{ $fieldName }}" value="true" {{ if not $value }}checked{{ end }}> 148 - None 149 - </label> 150 - <label class="{{$labelStyle}}"> 151 - <input type="radio" name="{{ $fieldName }}" value="true" {{ if not $value }}checked{{ end }}> 152 - None 153 - </label> 154 - <label class="{{$labelStyle}}"> 155 - <input type="radio" name="{{ $fieldName }}" value="true" {{ if not $value }}checked{{ end }}> 156 - None 157 - </label> 158 - </div> 196 + {{ $isOn := eq $value "true" }} 197 + <label class="font-normal normal-case flex items-center gap-2"> 198 + <input type="checkbox" name="{{ $fieldName }}" value="true" {{ if $isOn }}checked{{ end }}> 199 + {{ $def.Name }} 200 + </label> 159 201 {{ end }} 160 202 161 203 {{ define "intTypeInput" }} 162 204 {{ $def := .def }} 163 - {{ $fieldName := $def.AtUri }} 205 + {{ $prefix := .prefix }} 206 + {{ $fieldName := $def.AtUri.String }} 207 + {{ if $prefix }}{{ $fieldName = printf "%s[%s]" $prefix $def.AtUri }}{{ end }} 164 208 {{ $value := .value }} 165 209 <input class="p-1 w-full" type="number" name="{{$fieldName}}" value="{{$value}}"> 166 210 {{ end }} 167 211 168 212 {{ define "stringTypeInput" }} 169 213 {{ $def := .def }} 170 - {{ $fieldName := $def.AtUri }} 214 + {{ $prefix := .prefix }} 215 + {{ $fieldName := $def.AtUri.String }} 216 + {{ if $prefix }}{{ $fieldName = printf "%s[%s]" $prefix $def.AtUri }}{{ end }} 171 217 {{ $valueType := $def.ValueType }} 172 218 {{ $value := .value }} 173 219 ··· 192 238 193 239 {{ define "nullTypeInput" }} 194 240 {{ $def := .def }} 195 - {{ $fieldName := $def.AtUri }} 241 + {{ $prefix := .prefix }} 242 + {{ $fieldName := $def.AtUri.String }} 243 + {{ if $prefix }}{{ $fieldName = printf "%s[%s]" $prefix $def.AtUri }}{{ end }} 196 244 <input class="p-1" type="hidden" name="{{$fieldName}}" value="null"> 197 245 {{ end }} 198 246
+23 -11
appview/pages/templates/repo/fragments/fileTree.html
··· 1 1 {{ define "repo/fragments/fileTree" }} 2 + {{ template "fileTreeImpl" (dict "Node" . "Prefix" "file-") }} 3 + {{ end }} 4 + 5 + {{ define "repo/fragments/fileTreePrefixed" }} 6 + {{ $prefix := .Prefix }} 7 + {{ if eq $prefix "" }}{{ $prefix = "file-" }}{{ end }} 8 + {{ template "fileTreeImpl" (dict "Node" .Tree "Prefix" $prefix) }} 9 + {{ end }} 10 + 11 + {{ define "fileTreeImpl" }} 12 + {{ $n := .Node }} 13 + {{ $prefix := .Prefix }} 2 14 {{/* tailwind safelist: 3 15 group/level-1 group/level-2 group/level-3 group/level-4 group/level-5 group/level-6 4 16 group/level-7 group/level-8 group/level-9 group/level-10 group/level-11 group/level-12 ··· 7 19 group-open/level-1:block group-open/level-2:block group-open/level-3:block group-open/level-4:block group-open/level-5:block group-open/level-6:block 8 20 group-open/level-7:block group-open/level-8:block group-open/level-9:block group-open/level-10:block group-open/level-11:block group-open/level-12:block 9 21 */}} 10 - {{ if and .Name .IsDirectory }} 11 - <details open class="group/level-{{ .Level }}"> 22 + {{ if and $n.Name $n.IsDirectory }} 23 + <details open class="group/level-{{ $n.Level }}"> 12 24 <summary class="cursor-pointer list-none pt-1"> 13 25 <span class="tree-directory inline-flex items-center gap-2"> 14 - {{ i "folder" (printf "flex-shrink-0 size-4 group-open/level-%d:hidden" .Level)}} 15 - {{ i "folder-open" (printf "flex-shrink-0 size-4 hidden group-open/level-%d:block" .Level)}} 16 - <span class="filename truncate text-black dark:text-white">{{ .Name }}</span> 26 + {{ i "folder" (printf "flex-shrink-0 size-4 group-open/level-%d:hidden" $n.Level)}} 27 + {{ i "folder-open" (printf "flex-shrink-0 size-4 hidden group-open/level-%d:block" $n.Level)}} 28 + <span class="filename truncate text-black dark:text-white">{{ $n.Name }}</span> 17 29 </span> 18 30 </summary> 19 31 <div class="ml-1 pl-2 border-l border-gray-200 dark:border-gray-700"> 20 - {{ range $child := .Children }} 21 - {{ template "repo/fragments/fileTree" $child }} 32 + {{ range $child := $n.Children }} 33 + {{ template "fileTreeImpl" (dict "Node" $child "Prefix" $prefix) }} 22 34 {{ end }} 23 35 </div> 24 36 </details> 25 - {{ else if .Name }} 37 + {{ else if $n.Name }} 26 38 <div class="tree-file flex items-center gap-2 pt-1"> 27 39 {{ i "file" "flex-shrink-0 size-4" }} 28 - <a href="#file-{{ .Path }}" data-path="{{ .Path }}" class="filetree-link filename truncate text-black dark:text-white no-underline hover:underline">{{ .Name }}</a> 40 + <a href="#{{ $prefix }}{{ $n.Path }}" data-path="{{ $n.Path }}" class="filetree-link filename truncate text-black dark:text-white no-underline hover:underline">{{ $n.Name }}</a> 29 41 </div> 30 42 {{ else }} 31 - {{ range $child := .Children }} 32 - {{ template "repo/fragments/fileTree" $child }} 43 + {{ range $child := $n.Children }} 44 + {{ template "fileTreeImpl" (dict "Node" $child "Prefix" $prefix) }} 33 45 {{ end }} 34 46 {{ end }} 35 47 {{ end }}
+1 -1
appview/pages/templates/repo/fragments/labelSectionHeaderText.html
··· 1 1 {{ define "repo/fragments/labelSectionHeaderText" }} 2 - <span class="text-sm py-1 font-bold text-gray-500 dark:text-gray-400 capitalize">{{ . }}</span> 2 + <span class="text-xs uppercase tracking-wide text-gray-800 dark:text-gray-200">{{ . }}</span> 3 3 {{ end }}
+1 -152
appview/pages/templates/repo/pulls/new.html
··· 1 1 {{ define "title" }}new pull &middot; {{ .RepoInfo.FullName }}{{ end }} 2 2 3 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> 4 + {{ template "repo/pulls/fragments/pullComposeHost" . }} 156 5 {{ end }}