feat(marking): print stylesheet + .json session save/load (nightly-build threshold)#61
Open
hyperpolymath wants to merge 1 commit into
Open
Conversation
Pushes the composer to the threshold of "first nightly build": output is no longer just two textareas to copy-paste — it can be printed cleanly and saved/restored as a portable .json artifact. Print - New @media print block in assets/css/app.css with composer-specific classes (composer-print-hide / composer-print-page) so the interactive form, header and aside are hidden in print mode and a dedicated, paper-friendly layout takes their place - Print page shows: student name + band + rubric summary + generation timestamp; the manual-override warning when present; both prose boxes as paragraph-flowed text; per-component breakdown table; and a borderline-review list if any flags fired - New "Print" button next to "Clear / new student" — uses a JS hook + window.print() Session save/load - "Save session (.json)" button bundles current form_state + outputs (did_well, improve, band) and triggers a browser download via the DownloadSession JS hook. Filename: exam-feedback[-Student]-<ISO8601>.json - "Open session (.json)" button opens a hidden file input via the OpenSession hook; selecting a file pushes "restore_session" to the server, which normalises the form_state through the existing normalize_form_params path (so a tampered file is re-validated) and restores the cached outputs - JSON schema: {schema_version, saved_at, form_state, outputs: {did_well, improve, band:{key,label,mark}}} - Atom safety: map_to_band/1 uses String.to_existing_atom + rescue so a malformed band key cannot poison the BEAM atom table LiveView - 3 new buttons in the form actions row (Save / Open / Print) - Hidden <input type=file id=open-session-input> with phx-hook - 4 new private helpers: band_to_map, map_to_band, build_filename, plus the 3 new handle_event clauses (download_session, restore_session, open_session) JS - Hooks.DownloadSession, Hooks.OpenSession, Hooks.PrintTrigger - All silent-on-failure (no JS exception breaks the page) Tests (68 still pass — the new wiring is LiveView-only; helpers are trivial map round-trips. Browser walkthrough still pending.) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pushes the composer to the threshold of "first nightly build": output is no longer just two textareas to copy-paste — it can be printed cleanly and saved/restored as a portable .json artefact.
Print
Session save/load
```json
{
"schema_version": 1,
"saved_at": "2026-06-10T07:42:00Z",
"form_state": { /* full normalised form params */ },
"outputs": {
"did_well": "...",
"improve": "...",
"band": {"key": "good", "label": "good / Pass 2", "mark": 72}
}
}
```
What this closes
With PRs #51–#59 + #60 (deps) + this:
What this does not close
Test plan
Generated with Claude Code.