a707646200
Update ListAllIssues and ListAllPullRequests to accept state and page parameters, returning paginated results (20 per page) with HasMore metadata. ListIssues and ListPulls handlers now read page, org, and state query params; HTMX requests for page > 1 return only card HTML fragments for seamless infinite scroll. Both templates extract a reusable "cards" block and pulls.html gains a scroll sentinel matching the existing issues.html pattern. Filter changes reset to page 1. Closes leeworks-agents/gitea-mobile#32 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
48 lines
1.5 KiB
HTML
48 lines
1.5 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}}" 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">
|
|
<option value="">All orgs</option>
|
|
{{range .Orgs}}
|
|
<option value="{{.}}" {{if eq . $.SelectedOrg}}selected{{end}}>{{.}}</option>
|
|
{{end}}
|
|
</select>
|
|
</div>
|
|
|
|
{{if .Error}}
|
|
<p class="empty">{{.Error}}</p>
|
|
{{else if not .Pulls}}
|
|
<p class="empty">No open pull requests found.</p>
|
|
{{else}}
|
|
<div id="pull-list">
|
|
{{template "cards" .}}
|
|
</div>
|
|
{{end}}
|
|
{{end}}
|