forge
Explore
Log in

Don't you dare go Hollow

Password refusal reaches soft-posted forms; deadline pick survives live refresh; mobile layout

Browse files at this commit

e95add145b6f5b7a0ebd95b59ec1dbe14d2a37dfAhmet Kaan GümüşParent: 183b691
Soft-post fetches declare Accept: text/html so a refused change renders
'That did not work.' instead of failing silently; the five local back_to
copies fold into one helper that strips stale refusal params.

An unsaved deadline pick lived only in the DOM and the live-refresh morph
copied the server's stale attribute over it: the input now owns its value
the moment it is picked, syncAttrs skips owned attributes both ways, and
a wire pass re-derives an open popover after each swap.

Pages hold the no-document-scrollbar rule at phone widths: board columns
become a sideways rail, the topbar pans internally down to 320px, modals
go single-column, auth pages lock to the viewport.
crates/izlek-web/src/auth.rsmodified+3 -13
@@ -18,8 +18,8 @@ use topcoat::router::response::{IntoResponse, Response};
18 use topcoat::router::{HeaderName, StatusCode, header, route};18 use topcoat::router::{HeaderName, StatusCode, header, route};
19 19
20 use crate::server::{20 use crate::server::{
21- Refusal, accounts, clear_session_cookie, client_label, mail, presented_session, require_admin,21+ Refusal, accounts, back_to, clear_session_cookie, client_label, mail, presented_session,
22- require_user, set_session_cookie,22+ require_admin, require_user, set_session_cookie,
23 };23 };
24 use crate::settings::encode_q;24 use crate::settings::encode_q;
25 25
@@ -68,16 +68,6 @@ pub async fn invited_by_token(cx: &Cx, token: &str) -> Result<Option<Invited>> {
68 }))68 }))
69 }69 }
70 70
71-/// The page a browser without script is sent back to on a 303: the page the
72-/// form was posted from, or home when there is no `Referer` to read.
73-fn back_to(cx: &Cx) -> String {
74- headers(cx)
75- .get(header::REFERER)
76- .and_then(|value| value.to_str().ok())
77- .unwrap_or("/")
78- .to_string()
79-}
80-
81 /// A 303 to [`back_to`], carrying `refusal` as the body for71 /// A 303 to [`back_to`], carrying `refusal` as the body for
82 /// `carry_refusal_on_redirect` to read and copy onto the query.72 /// `carry_refusal_on_redirect` to read and copy onto the query.
83 type Redirect = Result<(StatusCode, [(HeaderName, String); 1], Json<Option<Refusal>>)>;73 type Redirect = Result<(StatusCode, [(HeaderName, String); 1], Json<Option<Refusal>>)>;
@@ -85,7 +75,7 @@ type Redirect = Result<(StatusCode, [(HeaderName, String); 1], Json<Option<Refus
85 fn redirect(cx: &Cx, refusal: Option<Refusal>) -> Redirect {75 fn redirect(cx: &Cx, refusal: Option<Refusal>) -> Redirect {
86 Ok((76 Ok((
87 StatusCode::SEE_OTHER,77 StatusCode::SEE_OTHER,
88- [(header::LOCATION, back_to(cx))],78+ [(header::LOCATION, back_to(cx, "/"))],
89 Json(refusal),79 Json(refusal),
90 ))80 ))
91 }81 }
crates/izlek-web/src/detail.rsmodified+31 -13
@@ -26,12 +26,11 @@ use time::{Date, UtcOffset};
26 use topcoat::Result;26 use topcoat::Result;
27 use topcoat::context::Cx;27 use topcoat::context::Cx;
28 use topcoat::router::content::{Form, Json};28 use topcoat::router::content::{Form, Json};
29-use topcoat::router::request::headers;
30 use topcoat::router::{HeaderName, StatusCode, header, route};29 use topcoat::router::{HeaderName, StatusCode, header, route};
31 use topcoat::view::{class, view};30 use topcoat::view::{class, view};
32 31
33 use crate::i18n::{Key, Lang, t};32 use crate::i18n::{Key, Lang, t};
34-use crate::server::{Refusal, accounts, mail, refusal_of, require_user, require_writer};33+use crate::server::{Refusal, accounts, back_to, mail, refusal_of, require_user, require_writer};
35 34
36 /// A task this board could be linked to: enough to name it in the picker and35 /// A task this board could be linked to: enough to name it in the picker and
37 /// nothing more.36 /// nothing more.
@@ -203,18 +202,10 @@ async fn writer_and_task(
203 /// uses for every one of its mutating calls.202 /// uses for every one of its mutating calls.
204 type Redirect = Result<(StatusCode, [(HeaderName, String); 1], Json<Option<Refusal>>)>;203 type Redirect = Result<(StatusCode, [(HeaderName, String); 1], Json<Option<Refusal>>)>;
205 204
206-fn back_to(cx: &Cx) -> String {
207- headers(cx)
208- .get(header::REFERER)
209- .and_then(|value| value.to_str().ok())
210- .unwrap_or("/")
211- .to_string()
212-}
213-
214 fn redirect(cx: &Cx, refusal: Option<Refusal>) -> Redirect {205 fn redirect(cx: &Cx, refusal: Option<Refusal>) -> Redirect {
215 Ok((206 Ok((
216 StatusCode::SEE_OTHER,207 StatusCode::SEE_OTHER,
217- [(header::LOCATION, back_to(cx))],208+ [(header::LOCATION, back_to(cx, "/"))],
218 Json(refusal),209 Json(refusal),
219 ))210 ))
220 }211 }
@@ -1408,6 +1399,19 @@ pub(crate) async fn datepicker_grid(
1408 /// `Escape` closes the panel through the datepick resolver `board.rs`'s1399 /// `Escape` closes the panel through the datepick resolver `board.rs`'s
1409 /// `card_menu_script` registers (priority 100 — see the table on1400 /// `card_menu_script` registers (priority 100 — see the table on
1410 /// `layout.rs`'s `escape_manager_script`).1401 /// `layout.rs`'s `escape_manager_script`).
1402+///
1403+/// The popover is the surface the live refresh used to reset. A picked day
1404+/// lives in the hidden input's `value` — and on a hidden input the property
1405+/// *is* the attribute, so the morph's attribute sync read it as server-stale
1406+/// bytes and wrote the old date back over the pick; the label it reverted,
1407+/// the client-built grid it emptied, the month nav's `data-year`/`data-month`
1408+/// it swept. So the pick declares itself the client's the moment it happens
1409+/// (`__izlekOwn(input, [], ['value'])`, and the panel's month attrs when
1410+/// `render` first sets them), and an `izlek:wire` repair pass re-derives the
1411+/// rest from that value: the label of a popover holding an unsaved pick, and
1412+/// the grid of one standing open. The pass runs on every wire — a repair,
1413+/// not an install; closed popovers with no unsaved pick are left to the
1414+/// server's own voice.
1411 pub(crate) async fn datepicker_script(cx: &Cx, lang: Lang) -> Result {1415 pub(crate) async fn datepicker_script(cx: &Cx, lang: Lang) -> Result {
1412 use crate::i18n::datepicker_js_literals;1416 use crate::i18n::datepicker_js_literals;
1413 use topcoat::view::Unescaped;1417 use topcoat::view::Unescaped;
@@ -1421,12 +1425,13 @@ pub(crate) async fn datepicker_script(cx: &Cx, lang: Lang) -> Result {
1421 function pad(n) {{ return String(n).padStart(2, '0'); }}\1425 function pad(n) {{ return String(n).padStart(2, '0'); }}\
1422 function parseYmd(v) {{ if (!v) return null; var p = v.split('-'); if (p.length !== 3) return null; return {{ y: +p[0], m: +p[1], d: +p[2] }}; }}\1426 function parseYmd(v) {{ if (!v) return null; var p = v.split('-'); if (p.length !== 3) return null; return {{ y: +p[0], m: +p[1], d: +p[2] }}; }}\
1423 function todayYmd() {{ var t = new Date(); return {{ y: t.getFullYear(), m: t.getMonth() + 1, d: t.getDate() }}; }}\1427 function todayYmd() {{ var t = new Date(); return {{ y: t.getFullYear(), m: t.getMonth() + 1, d: t.getDate() }}; }}\
1428+ function speak(label, ymd) {{ label.textContent = ymd ? MONTHS[ymd.m - 1].slice(0, 3) + ' ' + pad(ymd.d) : (label.dataset.empty || ''); }}\
1424 function render(panel) {{\1429 function render(panel) {{\
1425 var input = panel.querySelector('.datepick-input');\1430 var input = panel.querySelector('.datepick-input');\
1426 if (!input) {{ return; }}\1431 if (!input) {{ return; }}\
1427 var sel = parseYmd(input.value);\1432 var sel = parseYmd(input.value);\
1428 var t = todayYmd();\1433 var t = todayYmd();\
1429- if (!panel.dataset.year) {{ var base = sel || t; panel.dataset.year = base.y; panel.dataset.month = base.m; }}\1434+ if (!panel.dataset.year) {{ var base = sel || t; panel.dataset.year = base.y; panel.dataset.month = base.m; window.__izlekOwn(panel, [], ['data-year', 'data-month']); }}\
1430 var y = +panel.dataset.year, m = +panel.dataset.month;\1435 var y = +panel.dataset.year, m = +panel.dataset.month;\
1431 panel.querySelector('.datepick-title').textContent = MONTHS[m - 1] + ' ' + y;\1436 panel.querySelector('.datepick-title').textContent = MONTHS[m - 1] + ' ' + y;\
1432 panel.querySelector('.datepick-weekdays').innerHTML = WEEKDAYS.map(function(w) {{ return '<span>' + w + '</span>'; }}).join('');\1437 panel.querySelector('.datepick-weekdays').innerHTML = WEEKDAYS.map(function(w) {{ return '<span>' + w + '</span>'; }}).join('');\
@@ -1446,10 +1451,11 @@ pub(crate) async fn datepicker_script(cx: &Cx, lang: Lang) -> Result {
1446 var input = panel.querySelector('.datepick-input');\1451 var input = panel.querySelector('.datepick-input');\
1447 if (!input) {{ return; }}\1452 if (!input) {{ return; }}\
1448 input.value = ymd ? (ymd.y + '-' + pad(ymd.m) + '-' + pad(ymd.d)) : '';\1453 input.value = ymd ? (ymd.y + '-' + pad(ymd.m) + '-' + pad(ymd.d)) : '';\
1454+ window.__izlekOwn(input, [], ['value']);\
1449 if (!ymd) {{ ['clock_hour', 'clock_minute'].forEach(function (name) {{ var box = panel.querySelector('[name=' + name + ']'); if (!box) {{ return; }} box.value = ''; var trig = box.__ddTrigger; if (trig) {{ trig.textContent = box.options[0].textContent; trig.setAttribute('aria-expanded', 'false'); }} var drop = box.__ddPanel; if (drop) {{ drop.classList.remove('dd-open'); drop.querySelectorAll('.dd-option-selected').forEach(function (r) {{ r.classList.remove('dd-option-selected'); r.setAttribute('aria-selected', 'false'); }}); }} }}); }} \1455 if (!ymd) {{ ['clock_hour', 'clock_minute'].forEach(function (name) {{ var box = panel.querySelector('[name=' + name + ']'); if (!box) {{ return; }} box.value = ''; var trig = box.__ddTrigger; if (trig) {{ trig.textContent = box.options[0].textContent; trig.setAttribute('aria-expanded', 'false'); }} var drop = box.__ddPanel; if (drop) {{ drop.classList.remove('dd-open'); drop.querySelectorAll('.dd-option-selected').forEach(function (r) {{ r.classList.remove('dd-option-selected'); r.setAttribute('aria-selected', 'false'); }}); }} }}); }} \
1450 var pop = panel.closest('.datepick-pop');\1456 var pop = panel.closest('.datepick-pop');\
1451 var label = pop.querySelector('.datepick-label');\1457 var label = pop.querySelector('.datepick-label');\
1452- if (label) {{ label.textContent = ymd ? (MONTHS[ymd.m - 1].slice(0, 3) + ' ' + pad(ymd.d)) : label.dataset.empty; }}\1458+ if (label) {{ speak(label, ymd); }}\
1453 var toggle = pop.querySelector('.edit-toggle');\1459 var toggle = pop.querySelector('.edit-toggle');\
1454 if (toggle) {{ toggle.checked = false; }}\1460 if (toggle) {{ toggle.checked = false; }}\
1455 if (input.hasAttribute('data-autosubmit') && input.form) {{ input.form.requestSubmit(); }}\1461 if (input.hasAttribute('data-autosubmit') && input.form) {{ input.form.requestSubmit(); }}\
@@ -1460,6 +1466,18 @@ pub(crate) async fn datepicker_script(cx: &Cx, lang: Lang) -> Result {
1460 var panel = toggle.closest('.datepick-pop').querySelector('.datepick-panel');\1466 var panel = toggle.closest('.datepick-pop').querySelector('.datepick-panel');\
1461 if (panel) {{ render(panel); }}\1467 if (panel) {{ render(panel); }}\
1462 }});\1468 }});\
1469+ document.addEventListener('izlek:wire', function () {{\
1470+ document.querySelectorAll('.datepick-pop').forEach(function (pop) {{\
1471+ var panel = pop.querySelector('.datepick-panel');\
1472+ if (!panel) {{ return; }}\
1473+ var toggle = pop.querySelector('.edit-toggle');\
1474+ if (toggle && toggle.checked) {{ render(panel); }}\
1475+ var input = panel.querySelector('.datepick-input');\
1476+ if (!input || !input.__izlekMine || input.__izlekMine.a.indexOf('value') === -1) {{ return; }}\
1477+ var label = pop.querySelector('.datepick-label');\
1478+ if (label) {{ speak(label, parseYmd(input.value)); }}\
1479+ }});\
1480+ }});\
1463 document.addEventListener('click', function(e) {{\1481 document.addEventListener('click', function(e) {{\
1464 var prev = e.target.closest('.datepick-prev');\1482 var prev = e.target.closest('.datepick-prev');\
1465 var next = e.target.closest('.datepick-next');\1483 var next = e.target.closest('.datepick-next');\
crates/izlek-web/src/layout.rsmodified+16 -4
@@ -118,7 +118,7 @@ pub async fn user_menu(cx: &Cx, me: &crate::detail::Me, lang: Lang) -> Result {
118 <div class="user-menu">118 <div class="user-menu">
119 <button type="button" class="user-menu-trigger">119 <button type="button" class="user-menu-trigger">
120 (avatar(cx, &person, "").await?)120 (avatar(cx, &person, "").await?)
121- (me.display_name.clone())121+ <span class="user-menu-trigger-name">(me.display_name.clone())</span>
122 </button>122 </button>
123 <div class="user-menu-panel">123 <div class="user-menu-panel">
124 <div class="user-menu-name">(me.display_name.clone())</div>124 <div class="user-menu-name">(me.display_name.clone())</div>
@@ -201,6 +201,14 @@ pub async fn topbar_nav(cx: &Cx, active: NavPage, role: izlek_core::Role, lang:
201 /// arrive with the swap because the redirect URL's query params rendered201 /// arrive with the swap because the redirect URL's query params rendered
202 /// them server-side; `history.replaceState` keeps the address bar honest.202 /// them server-side; `history.replaceState` keeps the address bar honest.
203 ///203 ///
204+/// The replay declares `Accept: text/html`, because a replayed form post is a
205+/// form post asking for the page back: `carry_refusal_on_redirect`
206+/// (`server.rs`) copies a refusing 303's answer onto the `Location` only for a
207+/// caller that wants the page, and a bare `fetch` asks for `*/*` — under which
208+/// the refusal stayed in a body nobody reads and the click looked like nothing
209+/// happening. The password pane was where this was first felt: a wrong
210+/// current password and a right one landed on the same silent page.
211+///
204 /// Every fetch that ends in a swap carries the navigation counter it started212 /// Every fetch that ends in a swap carries the navigation counter it started
205 /// under (`window.__izlekNav`), and its answer is thrown away if that counter213 /// under (`window.__izlekNav`), and its answer is thrown away if that counter
206 /// has moved. Without it the newest paint is not the newest intent: the live214 /// has moved. Without it the newest paint is not the newest intent: the live
@@ -338,6 +346,7 @@ pub async fn soft_nav_script(cx: &Cx) -> Result {
338 for (i = to.attributes.length - 1; i >= 0; i--) { \346 for (i = to.attributes.length - 1; i >= 0; i--) { \
339 at = to.attributes[i]; \347 at = to.attributes[i]; \
340 if (at.name === 'class') { continue; } \348 if (at.name === 'class') { continue; } \
349+ if (own && own.a.indexOf(at.name) !== -1) { continue; } \
341 if (from.getAttribute(at.name) !== at.value) { from.setAttribute(at.name, at.value); } \350 if (from.getAttribute(at.name) !== at.value) { from.setAttribute(at.name, at.value); } \
342 } \351 } \
343 for (i = from.attributes.length - 1; i >= 0; i--) { \352 for (i = from.attributes.length - 1; i >= 0; i--) { \
@@ -432,7 +441,7 @@ pub async fn soft_nav_script(cx: &Cx) -> Result {
432 }; \441 }; \
433 window.__izlekPost = function (action, fields) { \442 window.__izlekPost = function (action, fields) { \
434 var n = navStep(); \443 var n = navStep(); \
435- fetch(action, { method: 'POST', body: new URLSearchParams(fields) }).then( \444+ fetch(action, { method: 'POST', headers: { accept: 'text/html' }, body: new URLSearchParams(fields) }).then( \
436 function (r) { return r.text().then(function (t) { if (stillCurrent(n)) { swap(t, r.url); } }); }, \445 function (r) { return r.text().then(function (t) { if (stillCurrent(n)) { swap(t, r.url); } }); }, \
437 function () {} \446 function () {} \
438 ); \447 ); \
@@ -475,7 +484,7 @@ pub async fn soft_nav_script(cx: &Cx) -> Result {
475 var data = e.submitter ? new FormData(form, e.submitter) : new FormData(form); \484 var data = e.submitter ? new FormData(form, e.submitter) : new FormData(form); \
476 var multipart = (form.getAttribute('enctype') || '').indexOf('multipart') !== -1; \485 var multipart = (form.getAttribute('enctype') || '').indexOf('multipart') !== -1; \
477 var n = navStep(); \486 var n = navStep(); \
478- fetch(form.getAttribute('action'), { method: 'POST', body: multipart ? data : new URLSearchParams(data) }).then( \487+ fetch(form.getAttribute('action'), { method: 'POST', headers: { accept: 'text/html' }, body: multipart ? data : new URLSearchParams(data) }).then( \
479 function (r) { return r.text().then(function (t) { if (stillCurrent(n)) { swap(t, r.url); } }); }, \488 function (r) { return r.text().then(function (t) { if (stillCurrent(n)) { swap(t, r.url); } }); }, \
480 function () { form.submit(); } \489 function () { form.submit(); } \
481 ); \490 ); \
@@ -624,7 +633,10 @@ pub async fn soft_nav_script(cx: &Cx) -> Result {
624 /// defined here — before any script that could enhance anything runs.633 /// defined here — before any script that could enhance anything runs.
625 /// `syncAttrs` then merges `class` (the server's list plus whatever owned634 /// `syncAttrs` then merges `class` (the server's list plus whatever owned
626 /// classes are still on the node) instead of overwriting it, and skips owned635 /// classes are still on the node) instead of overwriting it, and skips owned
627-/// attributes when it sweeps. Nothing in this file mentions a dropdown.636+/// attributes both when it copies the server's over and when it sweeps the
637+/// ones the server no longer has — an owned attribute is the client's fact,
638+/// stale server bytes say nothing against it. Nothing in this file mentions
639+/// a dropdown.
628 ///640 ///
629 /// The other half of the contract is `izlek:wire`: an enhancement re-derives641 /// The other half of the contract is `izlek:wire`: an enhancement re-derives
630 /// whatever it draws from server data rather than assuming it is still true.642 /// whatever it draws from server data rather than assuming it is still true.
crates/izlek-web/src/logs.rsmodified+2 -13
@@ -15,13 +15,12 @@ use time::format_description::well_known::Rfc3339;
15 use topcoat::Result;15 use topcoat::Result;
16 use topcoat::context::Cx;16 use topcoat::context::Cx;
17 use topcoat::router::content::{Form, Json};17 use topcoat::router::content::{Form, Json};
18-use topcoat::router::request::headers;
19 use topcoat::router::{HeaderName, StatusCode, header, page, route};18 use topcoat::router::{HeaderName, StatusCode, header, page, route};
20 use topcoat::view::view;19 use topcoat::view::view;
21 20
22 use crate::detail::{Me, datepicker_grid};21 use crate::detail::{Me, datepicker_grid};
23 use crate::i18n::{Key, Lang, t};22 use crate::i18n::{Key, Lang, t};
24-use crate::server::{Refusal, accounts, require_admin};23+use crate::server::{Refusal, accounts, back_to, require_admin};
25 use crate::settings::{decode_q, encode_q};24 use crate::settings::{decode_q, encode_q};
26 25
27 /// One send still owed or refused, as the queue panel reads it.26 /// One send still owed or refused, as the queue panel reads it.
@@ -748,16 +747,6 @@ async fn current_logs(cx: &Cx) -> Result<Json<std::result::Result<LogsSnapshot,
748 ))747 ))
749 }748 }
750 749
751-/// The page a retry form was posted from, or the queue tab when there is no
752-/// `Referer` to read.
753-fn back_to(cx: &Cx) -> String {
754- headers(cx)
755- .get(header::REFERER)
756- .and_then(|value| value.to_str().ok())
757- .unwrap_or("/logs?section=queue")
758- .to_string()
759-}
760-
761 /// A 303 to [`back_to`], carrying `refusal` as the body for750 /// A 303 to [`back_to`], carrying `refusal` as the body for
762 /// `crate::server::carry_refusal_on_redirect` to read and copy onto the query.751 /// `crate::server::carry_refusal_on_redirect` to read and copy onto the query.
763 type Redirect = Result<(StatusCode, [(HeaderName, String); 1], Json<Option<Refusal>>)>;752 type Redirect = Result<(StatusCode, [(HeaderName, String); 1], Json<Option<Refusal>>)>;
@@ -765,7 +754,7 @@ type Redirect = Result<(StatusCode, [(HeaderName, String); 1], Json<Option<Refus
765 fn redirect(cx: &Cx, refusal: Option<Refusal>) -> Redirect {754 fn redirect(cx: &Cx, refusal: Option<Refusal>) -> Redirect {
766 Ok((755 Ok((
767 StatusCode::SEE_OTHER,756 StatusCode::SEE_OTHER,
768- [(header::LOCATION, back_to(cx))],757+ [(header::LOCATION, back_to(cx, "/logs?section=queue"))],
769 Json(refusal),758 Json(refusal),
770 ))759 ))
771 }760 }
crates/izlek-web/src/rules.rsmodified+2 -13
@@ -20,7 +20,6 @@ use serde::{Deserialize, Serialize};
20 use topcoat::Result;20 use topcoat::Result;
21 use topcoat::context::Cx;21 use topcoat::context::Cx;
22 use topcoat::router::content::{Form, Json};22 use topcoat::router::content::{Form, Json};
23-use topcoat::router::request::headers;
24 use topcoat::router::{HeaderName, StatusCode, header, page, query_params, route};23 use topcoat::router::{HeaderName, StatusCode, header, page, query_params, route};
25 use topcoat::view::view;24 use topcoat::view::view;
26 25
@@ -28,7 +27,7 @@ use izlek_core::board::Column;
28 use izlek_core::store::{Audience, Store, Trigger, User, Workspace};27 use izlek_core::store::{Audience, Store, Trigger, User, Workspace};
29 28
30 use crate::i18n::{Key, Lang, t};29 use crate::i18n::{Key, Lang, t};
31-use crate::server::{Refusal, accounts, refusal_of, require_admin};30+use crate::server::{Refusal, accounts, back_to, refusal_of, require_admin};
32 31
33 /// One rule as the screen reads it: a sentence, a switch and a stamp.32 /// One rule as the screen reads it: a sentence, a switch and a stamp.
34 ///33 ///
@@ -384,16 +383,6 @@ async fn current_rules(cx: &Cx) -> Result<Json<std::result::Result<RulesSnapshot
384 Ok(Json(snapshot_of(&store, &user).await))383 Ok(Json(snapshot_of(&store, &user).await))
385 }384 }
386 385
387-/// The page a browser without script is sent back to on a 303: the page the
388-/// form was posted from, or home when there is no `Referer` to read.
389-fn back_to(cx: &Cx) -> String {
390- headers(cx)
391- .get(header::REFERER)
392- .and_then(|value| value.to_str().ok())
393- .unwrap_or("/")
394- .to_string()
395-}
396-
397 /// A 303 to [`back_to`], carrying `refusal` as the body for386 /// A 303 to [`back_to`], carrying `refusal` as the body for
398 /// `crate::server::carry_refusal_on_redirect` to read and copy onto the query.387 /// `crate::server::carry_refusal_on_redirect` to read and copy onto the query.
399 type Redirect = Result<(StatusCode, [(HeaderName, String); 1], Json<Option<Refusal>>)>;388 type Redirect = Result<(StatusCode, [(HeaderName, String); 1], Json<Option<Refusal>>)>;
@@ -401,7 +390,7 @@ type Redirect = Result<(StatusCode, [(HeaderName, String); 1], Json<Option<Refus
401 fn redirect(cx: &Cx, refusal: Option<Refusal>) -> Redirect {390 fn redirect(cx: &Cx, refusal: Option<Refusal>) -> Redirect {
402 Ok((391 Ok((
403 StatusCode::SEE_OTHER,392 StatusCode::SEE_OTHER,
404- [(header::LOCATION, back_to(cx))],393+ [(header::LOCATION, back_to(cx, "/"))],
405 Json(refusal),394 Json(refusal),
406 ))395 ))
407 }396 }
crates/izlek-web/src/server.rsmodified+34 -0
@@ -655,6 +655,40 @@ pub fn refusal_of(cx: &Cx, call: &str) -> Option<Refusal> {
655 Refusal::from_code(code?)655 Refusal::from_code(code?)
656 }656 }
657 657
658+/// The page a form was posted from: the `Referer`, with the answer any
659+/// earlier post left on its query dropped, or `nowhere` when no `Referer`
660+/// came with the request.
661+///
662+/// The feedback pairs — `refusal=`, `on=`, `why=`, `saved=` — are how a page
663+/// renders what the last post did. Sending the browser back with them still
664+/// on the query re-renders that old answer under the new post's own: a change
665+/// that succeeded right after one that was refused announces the refusal
666+/// again, and reads as having failed. The answer this redirect carries — the
667+/// pairs it was built with, or the body [`carry_refusal_on_redirect`] copies
668+/// onto the query — is the one that shows; an earlier one never survives the
669+/// trip.
670+pub fn back_to(cx: &Cx, nowhere: &str) -> String {
671+ let referer = headers(cx)
672+ .get(header::REFERER)
673+ .and_then(|value| value.to_str().ok())
674+ .unwrap_or(nowhere);
675+ let (path, query) = referer.split_once('?').unwrap_or((referer, ""));
676+ let pairs: Vec<&str> = query
677+ .split('&')
678+ .filter(|pair| {
679+ !pair.is_empty()
680+ && !["refusal", "on", "why", "saved"].iter().any(|key| {
681+ pair.strip_prefix(*key)
682+ .is_some_and(|rest| rest.starts_with('='))
683+ })
684+ })
685+ .collect();
686+ if pairs.is_empty() {
687+ return path.to_string();
688+ }
689+ format!("{path}?{}", pairs.join("&"))
690+}
691+
658 /// Puts a refusal on the redirect a browser without script follows.692 /// Puts a refusal on the redirect a browser without script follows.
659 ///693 ///
660 /// A hydrated page reads the call's return value straight off the action. A694 /// A hydrated page reads the call's return value straight off the action. A
crates/izlek-web/src/settings.rsmodified+5 -0
@@ -1583,6 +1583,10 @@ async fn settings_page(cx: &Cx) -> Result {
1583 <span class="chip chip-admin">(t(lang, Key::AdminOnly))</span>1583 <span class="chip chip-admin">(t(lang, Key::AdminOnly))</span>
1584 </div>1584 </div>
1585 <div class="panel-body">1585 <div class="panel-body">
1586+ // The register keeps its named columns at every width; on a
1587+ // narrow screen this box pans it sideways, silently, instead
1588+ // of letting the columns crush the role select out.
1589+ <div class="table-pan">
1586 <table class="member-table">1590 <table class="member-table">
1587 <thead>1591 <thead>
1588 <tr>1592 <tr>
@@ -1667,6 +1671,7 @@ async fn settings_page(cx: &Cx) -> Result {
1667 }1671 }
1668 </tbody>1672 </tbody>
1669 </table>1673 </table>
1674+ </div>
1670 1675
1671 <form method="post" action="/api/invite_member" class="member-invite">1676 <form method="post" action="/api/invite_member" class="member-invite">
1672 <label class="field">1677 <label class="field">
crates/izlek-web/src/tags.rsmodified+2 -13
@@ -22,14 +22,13 @@ use serde::{Deserialize, Serialize};
22 use topcoat::Result;22 use topcoat::Result;
23 use topcoat::context::Cx;23 use topcoat::context::Cx;
24 use topcoat::router::content::{Form, Json};24 use topcoat::router::content::{Form, Json};
25-use topcoat::router::request::headers;
26 use topcoat::router::{HeaderName, StatusCode, header, page, query_params, route};25 use topcoat::router::{HeaderName, StatusCode, header, page, query_params, route};
27 use topcoat::view::view;26 use topcoat::view::view;
28 27
29 use izlek_core::store::{Store, Tag, User};28 use izlek_core::store::{Store, Tag, User};
30 29
31 use crate::i18n::{Key, Lang, t};30 use crate::i18n::{Key, Lang, t};
32-use crate::server::{Refusal, accounts, refusal_of, require_admin};31+use crate::server::{Refusal, accounts, back_to, refusal_of, require_admin};
33 32
34 /// One tag as the screen reads it: a name, an order and whether it is the33 /// One tag as the screen reads it: a name, an order and whether it is the
35 /// default every task wears when nothing else is chosen.34 /// default every task wears when nothing else is chosen.
@@ -106,16 +105,6 @@ async fn tag_of_this_workspace(
106 Ok((store, user, tag))105 Ok((store, user, tag))
107 }106 }
108 107
109-/// The page a browser without script is sent back to on a 303: the page the
110-/// form was posted from, or home when there is no `Referer` to read.
111-fn back_to(cx: &Cx) -> String {
112- headers(cx)
113- .get(header::REFERER)
114- .and_then(|value| value.to_str().ok())
115- .unwrap_or("/")
116- .to_string()
117-}
118-
119 /// A 303 to [`back_to`], carrying `refusal` as the body for108 /// A 303 to [`back_to`], carrying `refusal` as the body for
120 /// `crate::server::carry_refusal_on_redirect` to read and copy onto the query.109 /// `crate::server::carry_refusal_on_redirect` to read and copy onto the query.
121 type Redirect = Result<(StatusCode, [(HeaderName, String); 1], Json<Option<Refusal>>)>;110 type Redirect = Result<(StatusCode, [(HeaderName, String); 1], Json<Option<Refusal>>)>;
@@ -123,7 +112,7 @@ type Redirect = Result<(StatusCode, [(HeaderName, String); 1], Json<Option<Refus
123 fn redirect(cx: &Cx, refusal: Option<Refusal>) -> Redirect {112 fn redirect(cx: &Cx, refusal: Option<Refusal>) -> Redirect {
124 Ok((113 Ok((
125 StatusCode::SEE_OTHER,114 StatusCode::SEE_OTHER,
126- [(header::LOCATION, back_to(cx))],115+ [(header::LOCATION, back_to(cx, "/"))],
127 Json(refusal),116 Json(refusal),
128 ))117 ))
129 }118 }
style/_instrument.scssmodified+19 -0
@@ -262,3 +262,22 @@
262 padding: 14px 20px;262 padding: 14px 20px;
263 border-top: 1px solid var(--border);263 border-top: 1px solid var(--border);
264 }264 }
265+// -- mobile (narrow viewports) -----------------------------------------------
266+// Geometry that the skin sets with [data-ui]-prefixed rules and that the
267+// shared mobile layer in main.scss cannot out-specify.
268+@media (max-width: 620px) {
269+ // The rail is a strip; its width is a desktop's and its active rule runs
270+ // under the section, not beside it.
271+ [data-ui="instrument"] .settings-sections { width: auto; }
272+
273+ [data-ui="instrument"] .settings-section-link.active {
274+ background: none;
275+ box-shadow: inset 0 -2px 0 var(--accent);
276+ }
277+
278+ // The filterbar wraps at this width; the skin's fixed 40px would clip it.
279+ [data-ui="instrument"] .filterbar { height: auto; }
280+
281+ // A phone carries no Escape key; the hint is chrome for a keyboard.
282+ [data-ui="instrument"] .modal-task .detail-esc { display: none; }
283+}
style/_ledger.scssmodified+25 -0
@@ -476,3 +476,28 @@
476 [data-ui="ledger"] .settings-section-link.active {476 [data-ui="ledger"] .settings-section-link.active {
477 border-bottom: 2px solid var(--ink);477 border-bottom: 2px solid var(--ink);
478 }478 }
479+// -- mobile (narrow viewports) -----------------------------------------------
480+// Geometry that the skin sets with [data-ui]-prefixed rules and that the
481+// shared mobile layer in main.scss cannot out-specify.
482+@media (max-width: 620px) {
483+ // The paper page keeps its mast and foot flush; only the side margins give.
484+ [data-ui="ledger"] .modal-scrim:has(> .modal-task) { padding: 0 12px; }
485+
486+ [data-ui="ledger"] .detail-mast { padding: 20px 0 6px; }
487+
488+ [data-ui="ledger"] .detail-title,
489+ [data-ui="ledger"] .title-input { font-size: 24px; }
490+
491+ // The labeled rows stack: no third of a phone holds label and value side
492+ // by side.
493+ [data-ui="ledger"] .detail-field {
494+ flex-direction: column;
495+ align-items: stretch;
496+ gap: 4px;
497+ }
498+
499+ [data-ui="ledger"] .detail-field > .detail-label { width: auto; }
500+
501+ // The rail is a strip; the 170px column is a desktop's.
502+ [data-ui="ledger"] .settings-sections { width: auto; }
503+}
style/main.scssmodified+204 -0
@@ -329,7 +329,10 @@ body {
329 // keep their natural height, the stage absorbs the rest, the document never329 // keep their natural height, the stage absorbs the rest, the document never
330 // scrolls.330 // scrolls.
331 body:has(.board-stage) {331 body:has(.board-stage) {
332+ // dvh follows the browser chrome phones raise and lower; vh is the fallback
333+ // for engines without it.
332 height: 100vh;334 height: 100vh;
335+ height: 100dvh;
333 overflow: hidden;336 overflow: hidden;
334 display: flex;337 display: flex;
335 flex-direction: column;338 flex-direction: column;
@@ -340,6 +343,7 @@ body:has(.board-stage) {
340 343
341 body:has(.settings-shell) {344 body:has(.settings-shell) {
342 height: 100vh;345 height: 100vh;
346+ height: 100dvh;
343 overflow: hidden;347 overflow: hidden;
344 display: flex;348 display: flex;
345 flex-direction: column;349 flex-direction: column;
@@ -352,6 +356,7 @@ body:has(.settings-shell) {
352 // page here, and the document never grows a scrollbar.356 // page here, and the document never grows a scrollbar.
353 body:has(.people-shell) {357 body:has(.people-shell) {
354 height: 100vh;358 height: 100vh;
359+ height: 100dvh;
355 overflow: hidden;360 overflow: hidden;
356 display: flex;361 display: flex;
357 flex-direction: column;362 flex-direction: column;
@@ -359,6 +364,26 @@ body:has(.people-shell) {
359 > * { flex: none; }364 > * { flex: none; }
360 > .people-shell { flex: 1; min-height: 0; }365 > .people-shell { flex: 1; min-height: 0; }
361 }366 }
367+// The account screens take the same lock: the card centers in what is left
368+// of the viewport, and a card taller than it (a landscape phone) pans inside
369+// the stage instead of growing the document.
370+body:has(.auth-stage) {
371+ height: 100vh;
372+ height: 100dvh;
373+ overflow: hidden;
374+ display: flex;
375+ flex-direction: column;
376+
377+ > * { flex: none; }
378+ > .auth-stage {
379+ flex: 1;
380+ min-height: 0;
381+ overflow-y: auto;
382+ scrollbar-width: none;
383+
384+ &::-webkit-scrollbar { display: none; }
385+ }
386+}
362 387
363 a {388 a {
364 color: var(--accent);389 color: var(--accent);
@@ -441,6 +466,9 @@ a {
441 text-transform: uppercase;466 text-transform: uppercase;
442 color: var(--muted);467 color: var(--muted);
443 text-decoration: none;468 text-decoration: none;
469+ // A two-word label ("Mail rules") folds under pressure and reads as two
470+ // stacked links; the nav gives up room some other way.
471+ white-space: nowrap;
444 padding-bottom: 2px;472 padding-bottom: 2px;
445 473
446 &:hover { color: var(--ink); }474 &:hover { color: var(--ink); }
@@ -3722,6 +3750,16 @@ input[type="radio"] {
3722 3750
3723 @media (max-width: 620px) {3751 @media (max-width: 620px) {
3724 grid-template-columns: repeat(2, 1fr);3752 grid-template-columns: repeat(2, 1fr);
3753+
3754+ // Two by two: the rule runs between the columns and under the first
3755+ // row, not off the right edge of every cell.
3756+ .person-stat {
3757+ border-right: none;
3758+ border-bottom: 1px solid var(--border);
3759+
3760+ &:nth-child(odd) { border-right: 1px solid var(--border); }
3761+ &:nth-child(n + 3) { border-bottom: none; }
3762+ }
3725 }3763 }
3726 }3764 }
3727 3765
@@ -3808,3 +3846,169 @@ input[type="radio"] {
3808 color: var(--muted);3846 color: var(--muted);
3809 font-size: 12px;3847 font-size: 12px;
3810 }3848 }
3849+// --- Mobile (narrow viewports) ----------------------------------------------
3850+//
3851+// One breakpoint, at the same 620px the person stats already fold at. The
3852+// document stays viewport-locked on every page (the body:has(...) rules
3853+// above); what a narrow screen changes is geometry: chrome tightens, the
3854+// settings rail becomes a strip, the board's columns pan sideways, and the
3855+// regions that already pan keep panning. Nothing here may open a document
3856+// scrollbar, and nothing here may grow explainer text.
3857+@media (max-width: 620px) {
3858+ // -- chrome ----------------------------------------------------------------
3859+
3860+ .topbar {
3861+ gap: 10px;
3862+ padding: 0 12px;
3863+ }
3864+
3865+ .topbar-nav-links {
3866+ gap: 12px;
3867+ // Five admin links outrun the narrowest phones; the strip pans under the
3868+ // finger the way every other overflow region here does, and the wordmark
3869+ // and avatar stay pinned at the edges.
3870+ min-width: 0;
3871+ overflow-x: auto;
3872+ scrollbar-width: none;
3873+
3874+ &::-webkit-scrollbar { display: none; }
3875+ }
3876+
3877+ // The avatar says who is signed in at this width; the name is the menu's.
3878+ .user-menu-trigger-name { display: none; }
3879+
3880+ // The last squeeze, below the smallest common phone: the chrome gives up
3881+ // its air before the nav gives up legibility.
3882+ @media (max-width: 360px) {
3883+ .topbar {
3884+ gap: 8px;
3885+ padding: 0 8px;
3886+ }
3887+
3888+ .topbar-nav-links { gap: 10px; }
3889+ }
3890+
3891+ // -- board -----------------------------------------------------------------
3892+
3893+ .filterbar {
3894+ height: auto;
3895+ min-height: 44px;
3896+ flex-wrap: wrap;
3897+ row-gap: 8px;
3898+ padding: 8px 12px;
3899+ }
3900+
3901+ // A rule floating alone at the head of a wrapped row says nothing.
3902+ .filterbar .topbar-divider { display: none; }
3903+
3904+ .filterbar .primary,
3905+ .filterbar .chip { flex: none; }
3906+
3907+ .board-stage { padding: 12px; }
3908+
3909+ // The columns stop sharing one row and become a rail: each as wide as a
3910+ // card needs, the row panning sideways under the finger, silently.
3911+ .board-columns {
3912+ grid-template-columns: none;
3913+ grid-auto-flow: column;
3914+ grid-auto-columns: min(72vw, 280px);
3915+ overflow-x: auto;
3916+ scroll-snap-type: x proximity;
3917+ scrollbar-width: none;
3918+
3919+ &::-webkit-scrollbar { display: none; }
3920+ }
3921+
3922+ .column { scroll-snap-align: start; }
3923+
3924+ // -- modals ----------------------------------------------------------------
3925+
3926+ .modal-scrim { padding: 16px; }
3927+
3928+ .modal { max-height: calc(100dvh - 32px); }
3929+
3930+ .new-task-row { flex-wrap: wrap; }
3931+
3932+ .detail-head { padding: 16px 16px 0; }
3933+
3934+ // Six tabs outrun a phone; the strip pans, the way a column of cards does.
3935+ .detail-tabs {
3936+ overflow-x: auto;
3937+ scrollbar-width: none;
3938+
3939+ &::-webkit-scrollbar { display: none; }
3940+ }
3941+
3942+ .detail-tab { white-space: nowrap; }
3943+
3944+ .detail-crumb-title { max-width: 16ch; }
3945+
3946+ .detail-fields {
3947+ grid-template-columns: minmax(0, 1fr);
3948+ padding: 14px 16px 0;
3949+ }
3950+
3951+ .detail-block { padding: 16px 16px 0; }
3952+
3953+ .detail-foot { padding: 14px 16px 16px; }
3954+
3955+ // -- the settings shell: rail becomes a strip -------------------------------
3956+
3957+ .settings-shell { flex-direction: column; }
3958+
3959+ .settings-sections {
3960+ width: auto;
3961+ flex-direction: row;
3962+ padding: 0 8px;
3963+ border-right: none;
3964+ border-bottom: 1px solid var(--border);
3965+ overflow-x: auto;
3966+ scrollbar-width: none;
3967+
3968+ &::-webkit-scrollbar { display: none; }
3969+ }
3970+
3971+ .settings-section-link {
3972+ flex: none;
3973+ padding: 12px 10px;
3974+ white-space: nowrap;
3975+ }
3976+
3977+ .settings-stage { padding: 16px 16px 32px; }
3978+
3979+ // The members register keeps its named columns and pans inside the panel
3980+ // rather than squeezing the role select out of the screen.
3981+ .table-pan {
3982+ overflow-x: auto;
3983+ scrollbar-width: none;
3984+
3985+ &::-webkit-scrollbar { display: none; }
3986+
3987+ .member-table { min-width: 560px; }
3988+ }
3989+
3990+ .field-row { flex-wrap: wrap; }
3991+
3992+ // -- people -----------------------------------------------------------------
3993+
3994+ .people-shell { padding: 16px 16px 32px; }
3995+
3996+ .person-head { flex-wrap: wrap; }
3997+
3998+ .person-fields { grid-template-columns: minmax(0, 1fr); }
3999+
4000+ // Stacked cells rule underneath each other, not off their right edge.
4001+ .person-field {
4002+ border-right: none;
4003+ border-bottom: 1px solid var(--border);
4004+
4005+ &:last-child {
4006+ border-right: none;
4007+ border-bottom: none;
4008+ }
4009+ }
4010+
4011+ // -- account screens ---------------------------------------------------------
4012+
4013+ .auth-stage { padding: 0 16px 24px; }
4014+}