Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.

0 downloads

Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-object-server.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-object-server.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-object-server.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

danq9 signup: the person chooses the password and name on the confirm page 83c7aa6 2 weeks, 5 days ago History
docs_index.py · 6.3 KB · 137 lines
1"""Docs site landing page, GET /docs.
2
3A real, public, unauthenticated documentation site in the Rails Guides /
4Django docs mold: a left sidebar grouped by category with a client-side
5search box (window.dbbasicDocsNav, /docs-nav), a clean content pane, and
6no dependency on the internal signed-in app's chrome -- no /nav script, no
7sign-in prompt, nothing that assumes a session. This landing pane itself
8is deliberately small: a heading and one paragraph inviting the visitor to
9pick a topic from the sidebar. The guides themselves live at
10/docs/{slug} (site_docs_detail).
11
12Page-unique layout only; palette, chrome, and inputs come from /style (see
13app-theme/style.py), so this page reskins with the active theme like every
14other page. The sidebar/off-canvas layout is duplicated verbatim in
15docs_detail.py -- package objects cannot import each other (see
16app-documents' manifest description for why that split exists), so a small
17shared layout block is repeated rather than invented as a second styling
18mechanism on top of /style.
19"""
20
21_STYLE = """
22.docslayout { display: flex; align-items: flex-start; gap: 0; max-width: 1180px; margin: 0 auto; }
23.navtoggle { display: none; }
24.scrim { display: none; }
25
26.docsidebar { width: 260px; flex: none; box-sizing: border-box; padding: 1rem 1.25rem 1rem 0;
27 position: sticky; top: 0; align-self: flex-start; max-height: 100vh; overflow-y: auto; }
28.docsbrand { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; color: var(--text);
29 margin-bottom: 1rem; }
30.docsbrand:hover { text-decoration: none; color: var(--accent-strong); }
31.docslogo { background: var(--accent); color: var(--accent-ink); border-radius: var(--radius-sm);
32 padding: 0.05rem 0.4rem; font-size: 0.78rem; font-weight: 700; }
33#docsearch { margin-bottom: 0.75rem; }
34.navempty { color: var(--muted); font-size: 0.85rem; }
35.navheading { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em;
36 margin: 1rem 0 0.3rem; }
37.navgroup:first-child .navheading { margin-top: 0; }
38.navlist { list-style: none; margin: 0; padding: 0; }
39.navitem a { display: block; padding: 0.3rem 0.5rem; border-radius: var(--radius-sm); color: var(--text);
40 font-size: 0.88rem; }
41.navitem a:hover { background: var(--panel-2); text-decoration: none; }
42.navitem.active a { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
43
44.docsmain { flex: 1; min-width: 0; padding: 1.5rem 1rem 3rem 2rem; border-left: 1px solid var(--line); }
45.docsmain h1 { margin-top: 0; }
46.docscontent { display: flex; align-items: flex-start; gap: 2rem; }
47.docbody { flex: 1; min-width: 0; }
48.doctoc { width: 200px; flex: none; padding-left: 1rem; border-left: 1px solid var(--line);
49 font-size: 0.82rem; position: sticky; top: 1rem; }
50.doctochead { color: var(--muted); text-transform: uppercase; font-size: 0.72rem; margin-bottom: 0.4rem; }
51.doctoclist { list-style: none; margin: 0; padding: 0; }
52.doctocitem a { display: block; padding: 0.15rem 0; color: var(--muted); }
53.doctocitem a:hover { color: var(--accent-strong); }
54.doctocitem.doctocsub { padding-left: 0.75rem; }
55
56.docpager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem;
57 padding-top: 1rem; border-top: 1px solid var(--line); }
58.docpagerside { flex: 1; display: flex; }
59.docpagerlink { display: block; width: 100%; color: var(--text); border: 1px solid var(--line);
60 border-radius: var(--radius-md); padding: 0.6rem 0.8rem; font-size: 0.85rem; }
61.docpagerlink:hover { border-color: var(--accent); text-decoration: none; }
62.docpagerlink.next { text-align: right; }
63
64@media (max-width: 900px) {
65 .doctoc { display: none; }
66}
67
68@media (max-width: 720px) {
69 .navtoggle { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0.75rem 0 0 0.75rem;
70 background: var(--panel); border: 1px solid var(--line); color: var(--text);
71 border-radius: var(--radius-sm); padding: 0.4rem 0.7rem; font: inherit; cursor: pointer; }
72 .docslayout { display: block; }
73 .docsidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 280px; max-width: 82vw;
74 background: var(--panel); border-right: 1px solid var(--line); padding: 1rem;
75 transform: translateX(-100%); transition: transform 160ms ease; z-index: 80; }
76 .docsidebar.open { transform: translateX(0); }
77 .scrim.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 70; }
78 .docsmain { border-left: none; padding: 1rem; }
79 .docscontent { display: block; }
80 .doctoc { display: none; }
81}
82"""
83
84_BODY = """
85<button type="button" id="navtoggle" class="navtoggle" aria-label="Toggle documentation navigation" aria-expanded="false">&#9776; Menu</button>
86<div id="scrim" class="scrim"></div>
87<div class="docslayout">
88<aside id="sidebar" class="docsidebar">
89<div id="docsheader"></div>
90<input id="docsearch" type="search" class="search" placeholder="Search docs&hellip;" aria-label="Search documentation">
91<div id="docsnav"><div class="navempty">Loading&hellip;</div></div>
92</aside>
93<main class="docsmain">
94<h1>DBBASIC Object Server Documentation</h1>
95<p>Guides for building on the DBBASIC Object Server &mdash; packages, objects, routing, permissions,
96and everything else that turns a directory of source into a running app. Pick a topic from the
97sidebar to get started.</p>
98</main>
99</div>
100"""
101
102_SCRIPT = """
103(function () {
104 document.title = "DBBASIC Object Server Documentation";
105 if (!window.dbbasicDocsNav) return;
106 window.dbbasicDocsNav.mount({
107 headerEl: document.getElementById("docsheader"),
108 navListEl: document.getElementById("docsnav"),
109 searchEl: document.getElementById("docsearch"),
110 drawerEl: document.getElementById("sidebar"),
111 toggleEl: document.getElementById("navtoggle"),
112 scrimEl: document.getElementById("scrim"),
113 activeSlug: null,
114 });
115})();
116"""
117
118
119def GET(request):
120 _logger.info("site_docs_index served")
121 html = f"""<!doctype html>
122<html lang="en">
123<head>
124<meta charset="utf-8">
125<meta name="viewport" content="width=device-width, initial-scale=1">
126<title>DBBASIC Object Server Documentation</title>
127<link rel="stylesheet" href="/style">
128<style>{_STYLE}</style>
129</head>
130<body>
131{_BODY}
132<script src="/markdown"></script>
133<script src="/docs-nav"></script>
134<script>{_SCRIPT}</script>
135</body>
136</html>"""
137 return {"content_type": "text/html; charset=utf-8", "body": html}