Monorepo for Tangled tangled.org

appview: pages/repo: add sync button to ui

authored by brookjeynes.dev and committed by Tangled b73f5cec 73be26e7

Changed files
+44 -33
appview
pages
templates
repo
+44 -33
appview/pages/templates/repo/index.html
··· 32 32 {{ end }} 33 33 34 34 {{ define "branchSelector" }} 35 - <select 36 - onchange="window.location.href = '/{{ .RepoInfo.FullName }}/tree/' + encodeURIComponent(this.value)" 37 - class="p-1 border max-w-32 border-gray-200 bg-white dark:bg-gray-800 dark:text-white dark:border-gray-700" 38 - > 39 - <optgroup label="branches ({{len .Branches}})" class="bold text-sm"> 40 - {{ range .Branches }} 41 - <option 42 - value="{{ .Reference.Name }}" 43 - class="py-1" 44 - {{ if eq .Reference.Name $.Ref }} 45 - selected 46 - {{ end }} 47 - > 48 - {{ .Reference.Name }} 49 - </option> 50 - {{ end }} 51 - </optgroup> 52 - <optgroup label="tags ({{len .Tags}})" class="bold text-sm"> 53 - {{ range .Tags }} 54 - <option 55 - value="{{ .Reference.Name }}" 56 - class="py-1" 57 - {{ if eq .Reference.Name $.Ref }} 58 - selected 59 - {{ end }} 60 - > 61 - {{ .Reference.Name }} 62 - </option> 63 - {{ else }} 64 - <option class="py-1" disabled>no tags found</option> 65 - {{ end }} 66 - </optgroup> 67 - </select> 35 + <div> 36 + <select 37 + onchange="window.location.href = '/{{ .RepoInfo.FullName }}/tree/' + encodeURIComponent(this.value)" 38 + class="p-1 border max-w-32 border-gray-200 bg-white dark:bg-gray-800 dark:text-white dark:border-gray-700" 39 + > 40 + <optgroup label="branches ({{len .Branches}})" class="bold text-sm"> 41 + {{ range .Branches }} 42 + <option 43 + value="{{ .Reference.Name }}" 44 + class="py-1" 45 + {{ if eq .Reference.Name $.Ref }} 46 + selected 47 + {{ end }} 48 + > 49 + {{ .Reference.Name }} 50 + </option> 51 + {{ end }} 52 + </optgroup> 53 + <optgroup label="tags ({{len .Tags}})" class="bold text-sm"> 54 + {{ range .Tags }} 55 + <option 56 + value="{{ .Reference.Name }}" 57 + class="py-1" 58 + {{ if eq .Reference.Name $.Ref }} 59 + selected 60 + {{ end }} 61 + > 62 + {{ .Reference.Name }} 63 + </option> 64 + {{ else }} 65 + <option class="py-1" disabled>no tags found</option> 66 + {{ end }} 67 + </optgroup> 68 + </select> 69 + <button 70 + id="syncBtn" 71 + class="btn disabled:opacity-50 disabled:cursor-not-allowed" 72 + hx-post="/{{ .RepoInfo.FullName }}/fork/sync?knot={{ .RepoInfo.Knot }}&branch={{ .RepoInfo.Ref }}" 73 + hx-trigger="click" 74 + hx-swap="none" 75 + > 76 + sync 77 + </button> 78 + </div> 68 79 {{ end }} 69 80 70 81 {{ define "fileTree" }}