7fa7d3f868
Mirror the existing issues state filter pattern: read state query param (default "open"), pass it to ListAllPullRequests instead of hardcoded "open", and add a state select widget to the pulls filter bar with proper hx-include for HTMX partial reloads and infinite scroll. Closes leeworks-agents/gitea-mobile#72 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
52 lines
1.9 KiB
HTML
52 lines
1.9 KiB
HTML
{{define "cards"}}
|
|
{{range .Pulls}}
|
|
<div class="card" hx-get="/pulls/{{.RepoOwner}}/{{.RepoName}}/{{.Number}}" hx-target="#main-content" hx-swap="innerHTML" hx-push-url="true">
|
|
<div class="card-title">
|
|
<span class="type-badge type-pull">PR</span>
|
|
{{.Title}}
|
|
</div>
|
|
<div class="card-meta">
|
|
<span>{{.RepoOwner}}/{{.RepoName}} #{{.Number}}</span>
|
|
{{range .Labels}}
|
|
<span class="label" style="color:#{{.Color}};border:1px solid #{{.Color}}">{{.Name}}</span>
|
|
{{end}}
|
|
<span class="diff-add">+{{.Additions}}</span>
|
|
<span class="diff-del">-{{.Deletions}}</span>
|
|
{{if .Mergeable}}<span style="color:var(--accent-green);font-size:0.7rem;">mergeable</span>{{end}}
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
{{if .HasMore}}
|
|
<div class="scroll-sentinel" hx-get="/pulls?page={{.NextPage}}&org={{.SelectedOrg}}&state={{.SelectedState}}" hx-trigger="revealed" hx-swap="outerHTML" hx-target="this">
|
|
<div class="spinner htmx-indicator"></div>
|
|
</div>
|
|
{{end}}
|
|
{{end}}
|
|
|
|
{{define "content"}}
|
|
<h1>Pull Requests</h1>
|
|
|
|
<div class="filter-bar">
|
|
<select name="org" hx-get="/pulls" hx-trigger="change" hx-target="#main-content" hx-swap="innerHTML" hx-push-url="true" hx-include="[name='state']">
|
|
<option value="">All orgs</option>
|
|
{{range .Orgs}}
|
|
<option value="{{.}}" {{if eq . $.SelectedOrg}}selected{{end}}>{{.}}</option>
|
|
{{end}}
|
|
</select>
|
|
<select name="state" hx-get="/pulls" hx-trigger="change" hx-target="#main-content" hx-swap="innerHTML" hx-push-url="true" hx-include="[name='org']">
|
|
<option value="open" {{if eq .SelectedState "open"}}selected{{end}}>Open</option>
|
|
<option value="closed" {{if eq .SelectedState "closed"}}selected{{end}}>Closed</option>
|
|
</select>
|
|
</div>
|
|
|
|
{{if .Error}}
|
|
<p class="empty">{{.Error}}</p>
|
|
{{else if not .Pulls}}
|
|
<p class="empty">No {{.SelectedState}} pull requests found.</p>
|
|
{{else}}
|
|
<div id="pull-list">
|
|
{{template "cards" .}}
|
|
</div>
|
|
{{end}}
|
|
{{end}}
|