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
+14
-3
@@ -1,6 +1,13 @@
|
||||
{# The frame every page is in. The top bar is `TABS` from app/web/pages.py
|
||||
plus the cog, and the cog's sub-tabs are `SETTINGS` there: adding a page is
|
||||
one entry in one of those lists, never a link here. #}
|
||||
one entry in one of those lists, never a link here.
|
||||
|
||||
Three blocks let a page go past the default frame, which only the Roles
|
||||
page does: `body_attrs` for attributes on `<body>`, `header_tools` for
|
||||
controls between the brand and the tabs (its burger and search box), and
|
||||
`page` to replace the centred `<main>` with a layout of its own (its rail,
|
||||
feed and reader). A page setting `active_path` lights the tab for that path
|
||||
rather than its own, which is how `/roles/{uid}` keeps Roles lit. #}
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@@ -29,13 +36,15 @@
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="default">
|
||||
<link rel="stylesheet" href="{{ asset('app.css') }}">
|
||||
</head>
|
||||
<body>
|
||||
<body{% block body_attrs %}{% endblock %}>
|
||||
{% set here = active_path | default(request.url.path, true) %}
|
||||
<header class="top">
|
||||
<a class="brand" href="/">role<span>desk</span></a>
|
||||
{% block header_tools %}{% endblock %}
|
||||
<nav>
|
||||
{% for tab in TABS %}
|
||||
<a href="{{ tab.path }}"
|
||||
{% if request.url.path == tab.path %}class="active" aria-current="page"{% endif %}>{{ tab.label }}</a>
|
||||
{% if here == tab.path %}class="active" aria-current="page"{% endif %}>{{ tab.label }}</a>
|
||||
{% endfor %}
|
||||
{# health's cog: an icon because it is not a place you go to often, and a
|
||||
word would take a third of the bar on a phone. #}
|
||||
@@ -46,9 +55,11 @@
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
{% block page %}
|
||||
<main>
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
{% endblock %}
|
||||
|
||||
{# toasts first, and the order is load-bearing: it owns `window.toast`, which
|
||||
app.js calls on a failed fetch and live.js feeds server notices into, and
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Role — roledesk{% endblock %}
|
||||
|
||||
{# The read page of one role, news's reader: a bar with the back arrow,
|
||||
▲ ● ▼ ★ and ↗, then the posting. An empty shell like every page;
|
||||
`static/role.js` fetches `/api/roles/{uid}` and fills it. #}
|
||||
{% block content %}
|
||||
<article id="role" class="reader" data-uid="{{ uid }}" aria-busy="true">
|
||||
<div class="reader-bar">
|
||||
<a class="reader-back" id="role-back" href="/" title="Back to the roles"
|
||||
aria-label="Back to the roles">←</a>
|
||||
<span class="judge" id="role-judge"></span>
|
||||
<span class="spacer"></span>
|
||||
<a class="reader-external" id="role-out" target="_blank" rel="noopener"
|
||||
title="Open the posting" aria-label="Open the posting" hidden>↗</a>
|
||||
</div>
|
||||
<div class="reader-body">
|
||||
<div class="reader-meta">
|
||||
<b id="role-company"></b>
|
||||
<span id="role-affinity"></span>
|
||||
<span id="role-place"></span>
|
||||
<span id="role-age"></span>
|
||||
</div>
|
||||
<h1 id="role-title">Loading…</h1>
|
||||
<div class="role-badges" id="role-badges"></div>
|
||||
<p class="reader-salary" id="role-salary" hidden></p>
|
||||
<section class="reader-summary" id="role-summary" hidden>
|
||||
<h2 class="reader-label">Summary</h2>
|
||||
<p></p>
|
||||
</section>
|
||||
<div class="reader-tools">
|
||||
<button type="button" class="secondary" id="role-summarise" hidden>Summarise</button>
|
||||
<button type="button" class="secondary" id="role-fetch" hidden>Fetch the posting</button>
|
||||
<span class="muted small" id="role-note" role="status"></span>
|
||||
</div>
|
||||
<div class="prose" id="role-text"></div>
|
||||
<p class="reader-out" id="role-out-end" hidden>
|
||||
<a target="_blank" rel="noopener"></a>
|
||||
</p>
|
||||
</div>
|
||||
</article>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script src="{{ asset('judge.js') }}"></script>
|
||||
<script src="{{ asset('role.js') }}"></script>
|
||||
{% endblock %}
|
||||
+98
-77
@@ -1,86 +1,107 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Roles — roledesk{% endblock %}
|
||||
{% block title %}{% if role %}{{ role.title or "Role" }}{% else %}Roles{% endif %} — roledesk{% endblock %}
|
||||
|
||||
{# An empty shell: `static/roles.js` fills it and drives every action. The
|
||||
server renders only the select options, from `app.models` and
|
||||
{# newsdesk's feed and reader (news/newsdesk/web/templates/index.html), as
|
||||
three panes: the rail of filters, the feed of roles, and the reader, which
|
||||
opens as a third column beside the feed and replaces it below 60rem.
|
||||
`static/roles.js` fills all three and drives every action. The server
|
||||
renders only the select options, from `app.models` and
|
||||
`plugins.ats.FUNCTIONS`, so they cannot drift from what the store accepts.
|
||||
|
||||
The bar is one row at any width: the order, the search box, and a Filters
|
||||
toggle. The toggle is a `<details>` whose summary is lifted into that row
|
||||
by the stylesheet, so the panel it opens is in the flow under the row and
|
||||
pushes the list down rather than covering it. #}
|
||||
{% block content %}
|
||||
<form id="filters" class="filters roles-filters" autocomplete="off">
|
||||
<div class="filter-line">
|
||||
<select id="f-agent" aria-label="Order">
|
||||
<option value="">Newest</option>
|
||||
</select>
|
||||
<input type="search" id="f-q" placeholder="Search titles" aria-label="Search titles">
|
||||
</div>
|
||||
<details id="f-more" class="filter-more">
|
||||
<summary>Filters<span id="f-active" class="filter-active"></span></summary>
|
||||
<div class="filter-panel">
|
||||
<input type="text" id="f-company" placeholder="Company" aria-label="Company">
|
||||
<input type="text" id="f-place" placeholder="Place" aria-label="Place">
|
||||
<select id="f-function" aria-label="Function">
|
||||
<option value="">Any function</option>
|
||||
{% for value, label in functions %}
|
||||
<option value="{{ value }}">{{ label }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<select id="f-remote" aria-label="Remote">
|
||||
<option value="">Any remote</option>
|
||||
{% for value, label in remote_options %}
|
||||
<option value="{{ value }}">{{ label }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<select id="f-days" aria-label="New in">
|
||||
<option value="">Any time</option>
|
||||
<option value="1">New in 1 day</option>
|
||||
<option value="3">New in 3 days</option>
|
||||
<option value="7">New in 7 days</option>
|
||||
<option value="30">New in 30 days</option>
|
||||
</select>
|
||||
<select id="f-judged" aria-label="Judged">
|
||||
<option value="">Any vote</option>
|
||||
<option value="liked">Liked</option>
|
||||
<option value="unjudged">Unjudged</option>
|
||||
<option value="passed">Passed</option>
|
||||
</select>
|
||||
<label class="check">
|
||||
<input type="checkbox" id="f-show-muted"> Show hidden companies
|
||||
</label>
|
||||
<label class="check" id="show-gated" hidden>
|
||||
<input type="checkbox" id="f-gated"> Show gated
|
||||
</label>
|
||||
</div>
|
||||
</details>
|
||||
</form>
|
||||
`/roles/{uid}` renders this same page with `role` set: the reader starts
|
||||
open, so a phone lands on the role rather than on the list for as long as
|
||||
the script takes. No `data-rail` on `<body>` until the script sets one:
|
||||
the stylesheet shows the rail beside the feed and keeps the overlay shut,
|
||||
which is right at either width before anything has been chosen. #}
|
||||
|
||||
<p id="roles-count" class="count" role="status"></p>
|
||||
<ul id="roles-list" class="roles"></ul>
|
||||
<div id="roles-end" class="roles-end" aria-hidden="true"></div>
|
||||
{% block body_attrs %}{% if role %} data-reader="open"{% endif %}{% endblock %}
|
||||
|
||||
<template id="role-row">
|
||||
<li class="role">
|
||||
<div class="role-body">
|
||||
<a class="role-title"></a>
|
||||
<div class="role-meta">
|
||||
<b class="role-company"></b>
|
||||
<span class="role-place"></span>
|
||||
<span class="role-age"></span>
|
||||
</div>
|
||||
<div class="role-badges">
|
||||
<span class="role-remote badge"></span>
|
||||
<span class="role-function badge"></span>
|
||||
<span class="role-score badge"></span>
|
||||
<span class="role-gated"></span>
|
||||
</div>
|
||||
<p class="role-excerpt"></p>
|
||||
</div>
|
||||
<div class="role-actions judge"></div>
|
||||
</li>
|
||||
</template>
|
||||
{% block header_tools %}
|
||||
{# The rail's only opener, labelled with the number of filters on when there
|
||||
are any, since with the rail shut nothing else says the list is narrowed. #}
|
||||
<button type="button" id="rail-toggle" title="Menu (f)" aria-label="Menu"
|
||||
aria-controls="rail"><span class="burger" aria-hidden="true"></span><span
|
||||
class="rail-toggle-label">Menu</span></button>
|
||||
<input type="search" id="search" placeholder="Search" aria-label="Search titles"
|
||||
autocomplete="off">
|
||||
{% endblock %}
|
||||
|
||||
{% block page %}
|
||||
{# Only ever visible under the rail overlay, which only exists narrow.
|
||||
Tapping it is how the rail is put away. #}
|
||||
<div id="scrim"></div>
|
||||
|
||||
<div class="shell">
|
||||
<aside id="rail" aria-label="Filters">
|
||||
<section>
|
||||
<h3>Filters</h3>
|
||||
<button type="button" class="rail-row" id="show-read" aria-pressed="true"
|
||||
title="Include the roles you have already opened"><span>Show read</span><span
|
||||
class="count" aria-hidden="true">👁</span></button>
|
||||
</section>
|
||||
<section>
|
||||
<h3>Order and period</h3>
|
||||
{# Best first and Newest first. With more than one ranking enabled the
|
||||
segmented control gives way to the select, one entry per ranking. #}
|
||||
<div class="seg" id="sort" role="group" aria-label="Order"></div>
|
||||
<select id="agent" class="rail-select" aria-label="Order" hidden></select>
|
||||
<label class="rail-field" for="period">First seen</label>
|
||||
<select id="period" class="rail-select"></select>
|
||||
</section>
|
||||
<section>
|
||||
<h3>Tags <button type="button" class="linky" id="clear-tags" hidden>clear</button></h3>
|
||||
<div id="tags"></div>
|
||||
<p class="rail-note" id="tag-note" hidden></p>
|
||||
</section>
|
||||
<section>
|
||||
<details id="f-more" class="rail-more">
|
||||
<summary>More filters<span id="f-active" class="filter-active"></span></summary>
|
||||
<div class="rail-fields">
|
||||
<input type="text" id="f-company" placeholder="Company" aria-label="Company">
|
||||
<input type="text" id="f-place" placeholder="Place" aria-label="Place">
|
||||
<select id="f-function" aria-label="Function">
|
||||
<option value="">Any function</option>
|
||||
{% for value, label in functions %}
|
||||
<option value="{{ value }}">{{ label }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<select id="f-remote" aria-label="Remote">
|
||||
<option value="">Any remote</option>
|
||||
{% for value, label in remote_options %}
|
||||
<option value="{{ value }}">{{ label }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<select id="f-judged" aria-label="Judged">
|
||||
<option value="">Any vote</option>
|
||||
<option value="liked">Liked</option>
|
||||
<option value="unjudged">Unjudged</option>
|
||||
<option value="passed">Passed</option>
|
||||
</select>
|
||||
<label class="check">
|
||||
<input type="checkbox" id="f-show-muted"> Show hidden companies
|
||||
</label>
|
||||
<label class="check" id="show-gated" hidden>
|
||||
<input type="checkbox" id="f-gated"> Show gated
|
||||
</label>
|
||||
</div>
|
||||
</details>
|
||||
</section>
|
||||
<p class="rail-stats" id="rail-stats" role="status"></p>
|
||||
<p class="rail-keys"><kbd>j</kbd><kbd>k</kbd> move · <kbd>u</kbd><kbd>n</kbd><kbd>d</kbd> vote ·
|
||||
<kbd>S</kbd> save · <kbd>enter</kbd> read · <kbd>o</kbd> posting · <kbd>/</kbd> search ·
|
||||
<kbd>f</kbd> menu · <kbd>c</kbd> clear</p>
|
||||
</aside>
|
||||
|
||||
<main id="list">
|
||||
<div id="roles-list" class="feed"></div>
|
||||
<div id="feed-empty" class="empty" hidden></div>
|
||||
<div id="feed-end" class="feed-end" role="status"></div>
|
||||
</main>
|
||||
|
||||
<article id="reader" aria-label="Role"{% if not role %} hidden{% endif %}>
|
||||
{%- if role %}<div class="reader-body"><p class="reader-note">Loading…</p></div>{% endif -%}
|
||||
</article>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
|
||||
Reference in new issue
Block a user