vole
Site
Clone
Read only, no credentials:
https://rodent.software/vole.git
Write over SSH with a registered key:
git clone ssh://git@rodent.software/vole.git
Self-hosted forge that lives in your Git repo.
Remove repository tab polling and rename Code to Source
cc7faea36a31373079df8fce68c1bc20a44873a0 · Keenan Nemetz · 3d ago · parent 0a12642f
Remove repository tab polling and rename Code to Source
The tab row no longer polls its open counts, so the /{name}/counts endpoint, its htmx trigger, and the badge animation are gone. The unfocused-window note has been removed while the other live regions still pause.
The Code tab is now Source, served at /{name}/source; links, sitemap entries, markdown tree links, and tests follow the new route.
server/web/templates/chrome.html +5−24
| @@ -99,16 +99,9 @@ | |||
| 99 | 99 | {{end}} | |
| 100 | 100 | ||
| 101 | 101 | {{/* The open counts beside the Issues and Changes tabs. They are templates of | |
| 102 | their own so the header's poll can replace the badges and nothing else: the | ||
| 103 | tab the reader is on, the clone menu and any open form stay where they are. | ||
| 104 | The ids are what the out-of-band swap matches, so the page and the poll | ||
| 105 | agree on where a count goes. */}} | ||
| 106 | {{define "repo_issue_count"}}<span class="chip-count" id="repo-issue-count"{{if .Live}} hx-swap-oob="outerHTML"{{end}}>{{.OpenIssues}}</span>{{end}} | ||
| 107 | {{define "repo_request_count"}}<span class="chip-count" id="repo-request-count"{{if .Live}} hx-swap-oob="outerHTML"{{end}}>{{.OpenRequests}}</span>{{end}} | ||
| 108 | {{define "repo_counts_live"}} | ||
| 109 | {{template "repo_issue_count" .}} | ||
| 110 | {{template "repo_request_count" .}} | ||
| 111 | {{end}} | ||
| 102 | their own so the tab row can place a count inside its label. */}} | ||
| 103 | {{define "repo_issue_count"}}<span class="chip-count" id="repo-issue-count">{{.OpenIssues}}</span>{{end}} | ||
| 104 | {{define "repo_request_count"}}<span class="chip-count" id="repo-request-count">{{.OpenRequests}}</span>{{end}} | ||
| 112 | 105 | ||
| 113 | 106 | {{define "repohead"}} | |
| 114 | 107 | <div class="repohead"> | |
| @@ -136,18 +129,10 @@ | |||
| 136 | 129 | </div> | |
| 137 | 130 | {{if .Description}}<p class="repo-desc">{{.Description}}</p>{{end}} | |
| 138 | 131 | </div> | |
| 139 | {{/* One poll for the header's counts. The response is out-of-band updates to | ||
| 140 | the two badges, so the tabs are not re-rendered and the page keeps its | ||
| 141 | state. It pauses while the window is unfocused, so a forgotten page does | ||
| 142 | not keep asking, and answers a vole-refresh when it comes back. */}} | ||
| 143 | <nav class="tabs" aria-label="Repository" | ||
| 144 | hx-get="/{{.Name}}/counts" | ||
| 145 | hx-trigger="every 30s, vole-refresh from:body" | ||
| 146 | hx-sync="this:replace" | ||
| 147 | hx-swap="none"> | ||
| 132 | <nav class="tabs" aria-label="Repository"> | ||
| 148 | 133 | <a class="repotab{{if eq .Tab "overview"}} active{{end}}" href="/{{.Name}}"{{if eq .Tab "overview"}} aria-current="page"{{end}}>{{icon "layout-dashboard"}}Overview</a> | |
| 149 | 134 | <a href="/{{.Name}}/activity"{{if eq .Tab "activity"}} class="active" aria-current="page"{{end}}>{{icon "activity"}}Activity</a> | |
| 150 | <a href="/{{.Name}}/code"{{if eq .Tab "code"}} class="active" aria-current="page"{{end}}>{{icon "code"}}Code</a> | ||
| 135 | <a href="/{{.Name}}/source"{{if eq .Tab "source"}} class="active" aria-current="page"{{end}}>{{icon "code"}}Source</a> | ||
| 151 | 136 | <a href="/{{.Name}}/issues"{{if eq .Tab "issues"}} class="active" aria-current="page"{{end}}>{{icon "circle-dot"}}Issues {{template "repo_issue_count" .}}</a> | |
| 152 | 137 | <a href="/{{.Name}}/changes"{{if eq .Tab "changes"}} class="active" aria-current="page"{{end}}>{{icon "git-pull-request"}}Changes {{template "repo_request_count" .}}</a> | |
| 153 | 138 | <a href="/{{.Name}}/releases"{{if eq .Tab "releases"}} class="active" aria-current="page"{{end}}>{{icon "tag"}}Releases</a> | |
| @@ -155,10 +140,6 @@ | |||
| 155 | 140 | <a href="/{{.Name}}/locks"{{if eq .Tab "locks"}} class="active" aria-current="page"{{end}}>{{icon "lock"}}Locks</a> | |
| 156 | 141 | {{if .CanAdmin}}<a href="/{{.Name}}/settings"{{if eq .Tab "settings"}} class="active" aria-current="page"{{end}}>{{icon "sliders-horizontal"}}Settings</a>{{end}} | |
| 157 | 142 | </nav> | |
| 158 | {{/* A page whose window is not focused is not being refreshed; app.js fills | ||
| 159 | this in with how old its last answer is. It is absolutely placed so | ||
| 160 | gaining and losing focus does not move the page under the reader. */}} | ||
| 161 | <p class="live-note" data-live-note hidden></p> | ||
| 162 | 143 | </div> | |
| 163 | 144 | {{end}} | |
| 164 | 145 | ||