Monorepo for Tangled tangled.org

appview/pages: keep search term when switching issue or pull tab

Signed-off-by: Thomas Karpiniec <tkarpiniec@icloud.com>

Changed files
+12 -2
appview
pages
templates
fragments
repo
issues
pulls
+8
appview/pages/templates/fragments/tabSelector.html
··· 2 2 {{ $name := .Name }} 3 3 {{ $all := .Values }} 4 4 {{ $active := .Active }} 5 + {{ $include := .Include }} 5 6 <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"> 6 7 {{ $activeTab := "bg-white dark:bg-gray-700 shadow-sm" }} 7 8 {{ $inactiveTab := "bg-gray-100 dark:bg-gray-800 shadow-inner" }} 8 9 {{ range $index, $value := $all }} 9 10 {{ $isActive := eq $value.Key $active }} 10 11 <a href="?{{ $name }}={{ $value.Key }}" 12 + {{ if $include }} 13 + hx-get="?{{ $name }}={{ $value.Key }}" 14 + hx-include="{{ $include }}" 15 + hx-push-url="true" 16 + hx-target="body" 17 + hx-on:htmx:config-request="if(!event.detail.parameters.q) delete event.detail.parameters.q" 18 + {{ end }} 11 19 class="p-2 whitespace-nowrap flex justify-center items-center gap-2 text-sm w-full block hover:no-underline text-center {{ if $isActive }} {{$activeTab }} {{ else }} {{ $inactiveTab }} {{ end }}"> 12 20 {{ if $value.Icon }} 13 21 {{ i $value.Icon "size-4" }}
+2 -1
appview/pages/templates/repo/issues/issues.html
··· 32 32 <input type="hidden" name="state" value="{{ if .FilteringByOpen }}open{{ else }}closed{{ end }}"> 33 33 <div class="flex-1 flex relative"> 34 34 <input 35 + id="search-q" 35 36 class="flex-1 py-1 pl-2 pr-10 mr-[-1px] rounded-r-none focus:border-0 focus:outline-none focus:ring focus:ring-blue-400 ring-inset peer" 36 37 type="text" 37 38 name="q" ··· 53 54 </button> 54 55 </form> 55 56 <div class="sm:row-start-1"> 56 - {{ template "fragments/tabSelector" (dict "Name" "state" "Values" $values "Active" $active) }} 57 + {{ template "fragments/tabSelector" (dict "Name" "state" "Values" $values "Active" $active "Include" "#search-q") }} 57 58 </div> 58 59 <a 59 60 href="/{{ .RepoInfo.FullName }}/issues/new"
+2 -1
appview/pages/templates/repo/pulls/pulls.html
··· 38 38 <input type="hidden" name="state" value="{{ .FilteringBy.String }}"> 39 39 <div class="flex-1 flex relative"> 40 40 <input 41 + id="search-q" 41 42 class="flex-1 py-1 pl-2 pr-10 mr-[-1px] rounded-r-none focus:border-0 focus:outline-none focus:ring focus:ring-blue-400 ring-inset peer" 42 43 type="text" 43 44 name="q" ··· 59 60 </button> 60 61 </form> 61 62 <div class="sm:row-start-1"> 62 - {{ template "fragments/tabSelector" (dict "Name" "state" "Values" $values "Active" $active) }} 63 + {{ template "fragments/tabSelector" (dict "Name" "state" "Values" $values "Active" $active "Include" "#search-q") }} 63 64 </div> 64 65 <a 65 66 href="/{{ .RepoInfo.FullName }}/pulls/new"