diff options
| author | Joe Mou <dev@mou.fo> | 2026-09-04 21:26:21 -0400 |
|---|---|---|
| committer | Joe Mou <dev@mou.fo> | 2026-09-04 21:49:59 -0400 |
| commit | 53ac3bc511a45e4e2e3f234a8b8dcf853b0c38d9 (patch) | |
| tree | d887da14050b199aca617a4f46d52763a2da7073 /cgithub/views/layout.eta | |
| parent | 5bfe8b345d2ee92111a2363321a248adb4f5195a (diff) | |
Split the page shell out of the repository layout
layout.eta was two things at once: the HTML shell every page needs and
the repository chrome around it. owner.eta, being the one page that is
not about a repository, could use neither and carried its own copy of
the shell, which had drifted -- its footer named no build commit and
did not link to the original page on GitHub.
The shell moves to views/layouts/base.eta, taking its title and any
deferred scripts as layout data, and the chrome to views/layouts/repo.eta,
a layout over it that adds the clone commands, nav, search box, and the
"/" shortcut that focuses it. Repository pages point at repo.eta and
render as before; owner.eta uses base.eta directly and so gains the
footer it was missing.
Templates now live in more than one directory, so scripts/build.ts walks
views/ recursively and keys each template by its path underneath it.
Names crossing a directory are written from the views root
("/layouts/base.eta"), the one form both Eta's filesystem resolver and
the precompiled resolver in worker.ts agree on; siblings stay relative.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ba5p88cWtCq42vf3uweweL
Diffstat (limited to 'cgithub/views/layout.eta')
| -rw-r--r-- | cgithub/views/layout.eta | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/cgithub/views/layout.eta b/cgithub/views/layout.eta deleted file mode 100644 index 37289dd..0000000 --- a/cgithub/views/layout.eta +++ /dev/null @@ -1,66 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> -<head> - <meta charset="UTF-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <title><%= it.repo.owner %>/<%= it.repo.name %> - <%= it.path || '/' %></title> - <link rel="stylesheet" href="/static/style.css"> - <script src="/static/refs.js" defer></script> -</head> -<body> - <div class="box"> - <div class="repo"><a href="/<%= it.repo.owner %>"><%= it.repo.owner %></a>/<a href="/<%= it.repo.owner %>/<%= it.repo.name %>"><%= it.repo.name %></a></div> - <pre><code>git clone https://github.com/<%= it.repo.owner %>/<%= it.repo.name %>.git -git clone git@github.com:<%= it.repo.owner %>/<%= it.repo.name %>.git</code></pre> - <nav> - <a href="/<%= it.repo.owner %>/<%= it.repo.name %>">Code</a> - <a href="/<%= it.repo.owner %>/<%= it.repo.name %>/issues">Issues</a> - <a href="/<%= it.repo.owner %>/<%= it.repo.name %>/pulls">Pull requests</a> - <a href="/<%= it.repo.owner %>/<%= it.repo.name %>/releases">Releases</a> - <a href="/<%= it.repo.owner %>/<%= it.repo.name %>/wiki">Wiki</a> - <% if (it.branch) { %> - <a href="/<%= it.repo.owner %>/<%= it.repo.name %>/commits/<%= it.branch %><%= it.path && it.path !== '/' ? '/' + it.path : '' %>">Commits</a> - <% } %> - </nav> - <form action="/<%= it.repo.owner %>/<%= it.repo.name %>/search" method="get"> - <input id="search-input" type="text" name="q" placeholder="Search…" value="<%= it.q ?? "" %>"> - <select name="type"> - <option value="issues" <%= it.searchType === "issues" ? "selected" : "" %>>Issues</option> - <option value="pullrequests" <%= it.searchType === "pullrequests" ? "selected" : "" %>>Pull requests</option> - <option value="code" <%= it.searchType === "code" || it.searchType == null ? "selected" : "" %>>Code</option> - </select> - <button type="submit">Search</button> - </form> - </div> - - <%~ it.body %> - - <footer>Generated by cgithub commit <code><%= it.buildCommit %></code> · <a href="<%= it.githubUrl %>" rel="noreferrer">View original</a></footer> - - <script> - document.addEventListener("keydown", function(e) { - let shortcut = ""; - if (e.ctrlKey || e.metaKey) shortcut += "C-"; - if (e.altKey) shortcut += "A-"; - if (e.shiftKey) shortcut += "S-"; - shortcut += e.key; - - if (shortcut === "Escape") { - document.activeElement.blur(); - return; - } - - if (["INPUT", "TEXTAREA", "SELECT"].includes(document.activeElement.tagName)) { - return; - } - - if (shortcut === "/") { - e.preventDefault(); - const input = document.getElementById('search-input'); - input.select(); - input.scrollIntoView({ block: "nearest" }); - } - }); - </script> -</body> -</html> |
