Roles is newsdesk's feed: rail, feed and reader, with read state and tags
The Roles tab takes newsdesk's shell, ported from its index.html and
app.css rather than rewritten: a filter rail (Show read, Best first or
Newest first, first seen, tag chips with counts, the old filters behind a
disclosure), the feed in newsdesk's row layout (score gutter, title,
company, place, badges, age, tags, the summary as excerpt, judge buttons)
and the reader as a third column that replaces the list on a phone. The
router pushes /roles/{uid}, which the server also renders with the reader
open, so the separate read page and role.js go. j/k, u/n/d, S, Enter,
Escape, o, /, f and c work as in newsdesk. The phone rules come with their
comments.
Two things the row lacked: roles.read_at, stamped when the reader opens a
role or a vote is cast, behind include_read on /api/roles; and role_tags,
written by summarise alongside the summary and served with counts by
/api/filters, filtered in SQL before LIMIT. Migration 5.
PyCharm run configurations in .run/ for serve, pull, seed and pytest.
core.autocrlf=input is set locally so a Windows-side checkout commits LF.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
515d2250fc
commit
a9290a6926
23 files changed
+2252
-715
No files matched your search
+13
-7
@@ -9,7 +9,9 @@ one template. `/settings` itself is Ranking.
|
||||
|
||||
Every page is a shell. Each is filled and driven by its own script under
|
||||
`static/` from the JSON routes in `web/api.py`; Pulls and Account are shells
|
||||
around the modules' own elements. What the server renders is only what a
|
||||
around the modules' own elements. `/roles/{uid}` is the Roles page again,
|
||||
with that role open in its reader: one page, so a link to a role and the
|
||||
role opened from the feed are the same screen. What the server renders is only what a
|
||||
select needs to offer, so the options cannot drift from what the store
|
||||
accepts.
|
||||
|
||||
@@ -119,17 +121,21 @@ def page(request: Request, name: str, **context: object) -> HTMLResponse:
|
||||
@router.get("/", response_class=HTMLResponse)
|
||||
def roles(request: Request) -> HTMLResponse:
|
||||
return page(request, "roles.html", functions=FUNCTION_OPTIONS,
|
||||
remote_options=REMOTE_OPTIONS)
|
||||
remote_options=REMOTE_OPTIONS, role=None)
|
||||
|
||||
|
||||
@router.get("/roles/{uid}", response_class=HTMLResponse)
|
||||
def role(request: Request, uid: str, store: StoreDep) -> HTMLResponse:
|
||||
"""The read page of one role. A shell like the others, filled by
|
||||
`role.js`; the lookup here only makes an unknown uid a 404 page rather
|
||||
than an empty one."""
|
||||
if store.role(uid) is None:
|
||||
"""The Roles page with one role open in its reader, which is where
|
||||
opening a role from the feed puts the address bar. `roles.js` reads the
|
||||
uid from the path; the lookup here makes an unknown uid a 404 page rather
|
||||
than an empty reader, and gives the tab the role's title. `active_path`
|
||||
keeps Roles lit in the top bar."""
|
||||
found = store.role(uid)
|
||||
if found is None:
|
||||
raise HTTPException(404, f"no such role: {uid}")
|
||||
return page(request, "role.html", uid=uid)
|
||||
return page(request, "roles.html", functions=FUNCTION_OPTIONS,
|
||||
remote_options=REMOTE_OPTIONS, role=found, active_path="/")
|
||||
|
||||
|
||||
@router.get("/applications", response_class=HTMLResponse)
|
||||
|
||||
Reference in new issue
Block a user