max / makenotwork
| 1 | //! The Askama entry point for the described publish-at field. |
| 2 | //! |
| 3 | //! One field, and it is the last site of `data-config` — a private per-app |
| 4 | //! attribute vocabulary that existed for exactly one behaviour: a |
| 5 | //! `datetime-local` box submits the characters a reader typed, and |
| 6 | //! `PUT /api/items/{id}` stores a moment. Something had to convert, and the |
| 7 | //! conversion was four lines in `frontend/src/core/dispatch.ts` keyed on an |
| 8 | //! attribute only this app understood. |
| 9 | //! |
| 10 | //! `makeover_layout::Field::as_instant` is the described version of the same |
| 11 | //! request: the value is submitted as the moment it names, and how is the |
| 12 | //! renderer's, because the browser is the only party that knows what "your |
| 13 | //! computer's time zone" means. `quasi-webview` ships the script; |
| 14 | //! `makeover-webview` marks the input; this file is the site that asks. |
| 15 | //! |
| 16 | //! # What is described here and what stays the host's |
| 17 | //! |
| 18 | //! Described: the kind, the name, the label, the standing hint, that it is |
| 19 | //! required, and that the value is submitted as an instant. |
| 20 | //! |
| 21 | //! Host: the form around it. `item_details.html` keeps the `<form>` with its |
| 22 | //! `hx-put` and its `data-after`, the same division `upload_field` makes — the |
| 23 | //! wrapper is the app's and the group inside it is the renderer's. Converting |
| 24 | //! the whole item-details tab is a screen conversion and not this. |
| 25 | //! |
| 26 | //! No wire contract moves. The route was already receiving an instant; what |
| 27 | //! changed is who computed it. |
| 28 | |
| 29 | use FieldKind; |
| 30 | use ; |
| 31 | |
| 32 | /// The publish-at field for an item's schedule form. |
| 33 | /// |
| 34 | /// The hint is the one the template carried, and it is still true for the same |
| 35 | /// reason it was: the reader types a time in their own zone. What is no longer |
| 36 | /// true is that nothing said so to the renderer. |
| 37 | |
| 38 | |
| 39 | use Serves as _; |
| 40 | |
| 41 | let field = new |
| 42 | .required |
| 43 | .hint |
| 44 | .submits_instant; |
| 45 | |
| 46 | // No shell: a fragment landing inside a document Askama already built. |
| 47 | new.fragment |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | /// The assertion the whole change is for. Without the mark the form |
| 53 | /// submits `2026-09-01T14:30` and the route stores whatever it makes of |
| 54 | /// that, which is the bug `data-config` was patching. |
| 55 | |
| 56 | |
| 57 | let html = publish_at; |
| 58 | |
| 59 | assert!; |
| 60 | assert!; |
| 61 | assert!; |
| 62 | assert!; |
| 63 | |
| 64 | |
| 65 | /// The private vocabulary does not come back in through the renderer. |
| 66 | |
| 67 | |
| 68 | assert!; |
| 69 | |
| 70 | |
| 71 | /// The label and the hint are the template's, moved rather than rewritten. |
| 72 | |
| 73 | |
| 74 | let html = publish_at; |
| 75 | |
| 76 | assert!; |
| 77 | assert! |
| 78 | html.contains, |
| 79 | "{html}" |
| 80 | ; |
| 81 | |
| 82 | |
| 83 |