A vibe coded tangled fork which supports pijul.
at 86d0b4060de074759eff40666b90be86c244ab23 105 lines 4.3 kB view raw
1{{ define "repo/pulls/fragments/pullActions" }} 2 {{ $lastIdx := sub (len .Pull.Submissions) 1 }} 3 {{ $roundNumber := .RoundNumber }} 4 {{ $stack := .Stack }} 5 6 {{ $totalPulls := sub 0 1 }} 7 {{ $below := sub 0 1 }} 8 {{ $stackCount := "" }} 9 {{ if .Pull.IsStacked }} 10 {{ $totalPulls = len $stack }} 11 {{ $below = $stack.Below .Pull }} 12 {{ $mergeable := len $below.Mergeable }} 13 {{ $stackCount = printf "%d/%d" $mergeable $totalPulls }} 14 {{ end }} 15 16 {{ $isPushAllowed := .RepoInfo.Roles.IsPushAllowed }} 17 {{ $isMerged := .Pull.State.IsMerged }} 18 {{ $isClosed := .Pull.State.IsClosed }} 19 {{ $isOpen := .Pull.State.IsOpen }} 20 {{ $isConflicted := and .MergeCheck (or .MergeCheck.Error .MergeCheck.IsConflicted) }} 21 {{ $isPullAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Pull.OwnerDid) }} 22 {{ $isLastRound := eq $roundNumber $lastIdx }} 23 {{ $isSameRepoBranch := .Pull.IsBranchBased }} 24 {{ $isUpToDate := .ResubmitCheck.No }} 25 <div class="relative w-fit"> 26 <div id="actions-{{ $roundNumber }}" class="flex flex-wrap gap-2"> 27 <button 28 hx-get="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/round/{{ $roundNumber }}/comment" 29 hx-target="#actions-{{ $roundNumber }}" 30 hx-swap="outerHtml" 31 class="btn p-2 flex items-center gap-2 no-underline hover:no-underline group"> 32 {{ i "message-square-plus" "w-4 h-4" }} 33 <span>comment</span> 34 {{ i "loader-circle" "w-4 h-4 animate-spin hidden group-[.htmx-request]:inline" }} 35 </button> 36 {{ if and $isPushAllowed $isOpen $isLastRound }} 37 {{ $disabled := "" }} 38 {{ if $isConflicted }} 39 {{ $disabled = "disabled" }} 40 {{ end }} 41 <button 42 hx-post="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/merge" 43 hx-swap="none" 44 hx-confirm="Are you sure you want to merge pull #{{ .Pull.PullId }} into the `{{ .Pull.TargetBranch }}` branch?" 45 class="btn p-2 flex items-center gap-2 group" 46 {{ $disabled }}> 47 {{ i "git-merge" "w-4 h-4" }} 48 <span>merge{{ if $stackCount }}{{ $stackCount }}{{ end }}</span> 49 {{ i "loader-circle" "w-4 h-4 animate-spin hidden group-[.htmx-request]:inline" }} 50 </button> 51 {{ end }} 52 53 {{ if and $isPullAuthor $isOpen $isLastRound }} 54 {{ $disabled := "" }} 55 {{ if $isUpToDate }} 56 {{ $disabled = "disabled" }} 57 {{ end }} 58 <button 59 id="resubmitBtn" 60 {{ if not .Pull.IsPatchBased }} 61 hx-post="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/resubmit" 62 {{ else }} 63 hx-get="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/resubmit" 64 hx-target="#actions-{{ $roundNumber }}" hx-swap="outerHtml" 65 {{ end }} 66 67 hx-disabled-elt="#resubmitBtn" 68 class="btn p-2 flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed group" 69 {{ $disabled }} 70 71 {{ if $disabled }} 72 title="Update this branch to resubmit this pull request" 73 {{ else }} 74 title="Resubmit this pull request" 75 {{ end }}> 76 {{ i "rotate-ccw" "w-4 h-4" }} 77 <span>resubmit</span> 78 {{ i "loader-circle" "w-4 h-4 animate-spin hidden group-[.htmx-request]:inline" }} 79 </button> 80 {{ end }} 81 82 {{ if and (or $isPullAuthor $isPushAllowed) $isOpen $isLastRound }} 83 <button 84 hx-post="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/close" 85 hx-swap="none" 86 class="btn p-2 flex items-center gap-2 group"> 87 {{ i "ban" "w-4 h-4" }} 88 <span>close</span> 89 {{ i "loader-circle" "w-4 h-4 animate-spin hidden group-[.htmx-request]:inline" }} 90 </button> 91 {{ end }} 92 93 {{ if and (or $isPullAuthor $isPushAllowed) $isClosed $isLastRound }} 94 <button 95 hx-post="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/reopen" 96 hx-swap="none" 97 class="btn p-2 flex items-center gap-2 group"> 98 {{ i "refresh-ccw-dot" "w-4 h-4" }} 99 <span>reopen</span> 100 {{ i "loader-circle" "w-4 h-4 animate-spin hidden group-[.htmx-request]:inline" }} 101 </button> 102 {{ end }} 103 </div> 104 </div> 105{{ end }}