Open a deck in the editor, and shape the viewer as Docs shapes a document
Paul landed on the read-only viewer from the deck list and asked whether
Slides could be edited at all; and on the viewer itself, "these are all
muddled up": a wall of pills (Edit, Deck settings, Share, All notes,
Export PDF, Present) over the slide, and the slides as a grid under it.
A deck opens in the editor, as a document does in Docs. The list's
covers and rows link /d/{sqid}/edit, and the deck's bare address is a
303 there, after deckFor, so a stranger still gets the same 404. Every
signed-in reader may edit (the editor is deckFor's audience), so nobody
who can reach /d/{sqid} is stranded. The viewer is the same address with
a query, ?slide=N, which is what every link inside it already was; the
editor's <noscript> and File > Open in the viewer link ?slide=1, so it
stays reachable with scripts off, and share links keep /s/{token}.
The viewer: the deck's title is the bar's context and Share… the bar's
action (owner or roster owner on an orphan, mayShareDeck), as on a
document in Docs; the share-link viewer has the title in its bar too.
The page's own row is Edit, Present and one overflow (All notes, Export
PDF). The slides are a rail at the left from 1100px, the editor's
breakpoint, sticky and scrolling inside itself, with the slide beside it
sized to the window's height and the notes under it; below that a row
that scrolls sideways under the slide. Current slide ringed and
aria-current, as before. The deck title is the page's h1 for a screen
reader.
Deck settings leave the menus: the editor's File menu no longer lists
the form (the inspector's Deck section is those settings, and who can
open the deck is Share's); the <noscript> links it for somebody who may
retitle, as the one way in with scripts off. Delete's Cancel and back
link return to the deck rather than to the settings form.
Tests: the viewer's own tests ask for ?slide=1; new ones hold the
redirect (owner, member, stranger), the list's links, the bar's title
and Share…, the overflow, and the orphan rules on the viewer.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24 files changed,
+356
−145
internal/slides/app.go+4 −1internal/slides/chrome.go+5 −1internal/slides/decks.go+5 −4internal/slides/editor.go+13 −9internal/slides/icons/icons.go+2 −0internal/slides/locales/en.toml+4 −2internal/slides/share.go+1 −1internal/slides/team_access_test.go+15 −11internal/slides/team_review_test.go+15 −5internal/slides/team_survivors_test.go+2 −2internal/slides/templates/editor.html+10 −4internal/slides/templates/viewer.html+139 −34internal/slides/viewer.go+45 −35internal/slidestest/capabilities_test.go+1 −1internal/slidestest/decks_test.go+4 −4internal/slidestest/editor_test.go+4 −3internal/slidestest/export_test.go+2 −2internal/slidestest/fontgate_test.go+2 −2internal/slidestest/fonts_test.go+3 −3internal/slidestest/list_test.go+7 −6internal/slidestest/live_test.go+1 −1internal/slidestest/present_test.go+1 −1internal/slidestest/serving_test.go+1 −1internal/slidestest/viewer_test.go+70 −12
diff --git a/internal/slides/app.go b/internal/slides/app.go| index f814fc2..4a304fd 100644 |
| --- a/internal/slides/app.go |
| +++ b/internal/slides/app.go |
| @@ -169,7 +169,10 @@ func New(d *db.DB, cfg Config) (*http.ServeMux, *app, error) { |
| r.Get("/decks/new", a.newDeck) |
| r.Post("/decks", a.createDeck) |
| // /d/{sqid} is the deck's own short URL — short because it is |
| - // what a person pastes into a chat window. |
| + // what a person pastes into a chat window. Bare, it opens the |
| + // editor, as a document's address does in Docs; with a query |
| + // (?slide=N, which every link inside it carries) it is the |
| + // viewer (viewer.go's showDeck). |
| r.Get("/d/{sqid}", a.showDeck) |
| // Every slide's notes on one page — the crib sheet somebody |
| // presents from with scripts off (spec §8). |
diff --git a/internal/slides/chrome.go b/internal/slides/chrome.go| index 32860e1..abf1149 100644 |
| --- a/internal/slides/chrome.go |
| +++ b/internal/slides/chrome.go |
| @@ -64,8 +64,11 @@ type frame struct { |
| // is the page's h1 (spec §10). |
| parts []string |
| // context is the open deck's title, shown in the bar on the deck's |
| - // sub-pages. |
| + // own pages: the viewer and every sub-page. |
| context string |
| + // actions are the bar's page actions (Docs' Share… on a document): |
| + // buttons at wide widths, rows in the Menu sheet below 800px. |
| + actions []chrome.Action |
| // public is a read-only page a stranger reaches (the share link): |
| // the brand is plain text, and "Sign in" carries no return path, |
| // because the path is a capability and must not be copied into |
| @@ -169,6 +172,7 @@ func (a *app) frameFor(r *http.Request, v viewerState, f frame) Frame { |
| Icon: brand.Path("slides"), |
| }, |
| Context: f.context, |
| + Actions: f.actions, |
| Labels: chrome.BarLabels{Skip: rastrillo.T(r, "slides.chrome.skip"), Menu: rastrillo.T(r, "slides.chrome.menu")}, |
| } |
| switch { |
diff --git a/internal/slides/decks.go b/internal/slides/decks.go| index 1c1d6f7..4d2c231 100644 |
| --- a/internal/slides/decks.go |
| +++ b/internal/slides/decks.go |
| @@ -840,7 +840,8 @@ func splitRecent(cards []deckCard, n int) (recent, rest []deckCard) { |
| func (a *app) deckCardFor(r *http.Request, d Deck, by string, now time.Time) deckCard { |
| slides, first, counted := a.deckGlance(r.Context(), d) |
| card := deckCard{ |
| - Href: "/d/" + d.Sqid, |
| + // A deck opens in the editor, as a document does in Docs. |
| + Href: editorHref(d.Sqid), |
| Title: d.Title, |
| Sub: rowSub(r, slides, counted, by), |
| When: whenAgo(r, d.UpdatedAt, now), |
| @@ -1364,10 +1365,10 @@ func (a *app) confirmDeleteDeck(w http.ResponseWriter, r *http.Request) { |
| Body: rastrillo.T(r, "slides.deck.delete.body"), |
| Action: base + "/delete", |
| Label: rastrillo.T(r, "slides.deck.delete.confirm"), |
| - CancelHref: base + "/settings", |
| + CancelHref: base, |
| CancelLabel: rastrillo.T(r, "slides.cancel"), |
| - BackHref: base + "/settings", |
| - BackLabel: rastrillo.T(r, "slides.deck.settings"), |
| + BackHref: base, |
| + BackLabel: rastrillo.T(r, "slides.deck.back"), |
| }) |
| } |
diff --git a/internal/slides/editor.go b/internal/slides/editor.go| index 67b3e6a..813d403 100644 |
| --- a/internal/slides/editor.go |
| +++ b/internal/slides/editor.go |
| @@ -54,9 +54,6 @@ type editorPage struct { |
| ClientColour string |
| BundleSrc string |
| - BackHref string |
| - BackLabel string |
| - |
| NewSlideLabel string |
| DuplicateLabel string |
| UndoLabel string |
| @@ -96,6 +93,10 @@ type editorPage struct { |
| LinkCancel string |
| NoScriptBody string |
| NoScriptLink string |
| + // NoScriptSettings names the settings form (decks.go): the title |
| + // and theme without the inspector, for somebody with scripts off. |
| + // Shown with SettingsHref, which is the only link to that page. |
| + NoScriptSettings string |
| // Themes is the deck section's theme picker, the settings screen's |
| // own list with the deck's theme selected. |
| @@ -112,8 +113,12 @@ type editorPage struct { |
| AcceptTypes string |
| // The header (I2, after Docs' editor): the deck's own links, each |
| // empty when this person may not use it, so the File menu lists |
| - // only what works for them. ViewHref is the viewer; NewDeckHref the |
| + // only what works for them. ViewHref is the viewer (its first |
| + // slide: the deck's bare address opens this page); NewDeckHref the |
| // deck list's create page; CreditsHref Help's Open source. |
| + // SettingsHref is the scriptless title-and-theme form, linked from |
| + // the <noscript> alone: with scripts on the inspector's Deck section |
| + // is those settings, and who can open the deck is Share's. |
| ViewHref, SettingsHref, ShareHref, ExportHref, NotesPageHref string |
| DeleteHref, NewDeckHref, CreditsHref string |
| // Keys are the menus' shortcuts, formatted for this request's |
| @@ -182,7 +187,7 @@ var editorStrings = []string{ |
| "status.error", |
| "head.title", "head.menus", "head.history", "head.inspector", "head.share", "head.newslide", "head.layouts", |
| "menu.file", "menu.edit", "menu.insert", "menu.slide", "menu.view", "menu.help", |
| - "file.newdeck", "file.view", "file.notes", "file.export", "file.settings", "file.delete", |
| + "file.newdeck", "file.view", "file.notes", "file.export", "file.delete", |
| "insert.slide", "insert.block", "view.notes", "view.inspector", "help.keys", "help.credits", |
| "keys.title", "keys.close", "keys.newslide", "keys.duplicate", "keys.present", "keys.undo", "keys.redo", |
| "keys.link", "keys.bold", "keys.italic", "keys.reorder", "keys.delete", "keys.code", "keys.highlight", |
| @@ -252,7 +257,7 @@ func (a *app) deckEditor(w http.ResponseWriter, r *http.Request) { |
| } |
| page := editorPage{ |
| shell: sh, |
| - ViewHref: base, |
| + ViewHref: viewerStart(d.Sqid), |
| NotesPageHref: base + "/notes", |
| ExportHref: base + "/export", |
| CreditsHref: "/help/open-source", |
| @@ -265,9 +270,6 @@ func (a *app) deckEditor(w http.ResponseWriter, r *http.Request) { |
| ClientColour: u.Colour, |
| BundleSrc: editorBundlePath(), |
| - BackHref: base, |
| - BackLabel: rastrillo.T(r, "slides.deck.back"), |
| - |
| NewSlideLabel: rastrillo.T(r, "slides.editor.slide.new"), |
| DuplicateLabel: rastrillo.T(r, "slides.editor.slide.duplicate"), |
| UndoLabel: rastrillo.T(r, "slides.editor.undo"), |
| @@ -299,6 +301,8 @@ func (a *app) deckEditor(w http.ResponseWriter, r *http.Request) { |
| NoScriptBody: rastrillo.T(r, "slides.editor.noscript"), |
| NoScriptLink: rastrillo.T(r, "slides.editor.noscript.link"), |
| + NoScriptSettings: rastrillo.T(r, "slides.editor.noscript.settings"), |
| + |
| Themes: themeOptions(r, view.Meta.Theme), |
| HasStore: a.cfg.Blobs != nil, |
| AcceptTypes: acceptTypes(), |
diff --git a/internal/slides/icons/icons.go b/internal/slides/icons/icons.go| index 15b7d28..c052c0c 100644 |
| --- a/internal/slides/icons/icons.go |
| +++ b/internal/slides/icons/icons.go |
| @@ -33,6 +33,8 @@ var icons = map[string]template.HTML{ |
| "info": `<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg>`, |
| "kebab": `<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" viewBox="0 0 24 24"><circle cx="12" cy="12" r="1"/><circle cx="12" cy="5" r="1"/><circle cx="12" cy="19" r="1"/></svg>`, |
| "menu": `<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" viewBox="0 0 24 24"><path d="M4 12h16"/><path d="M4 6h16"/><path d="M4 18h16"/></svg>`, |
| + "pencil": `<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" viewBox="0 0 24 24"><path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/></svg>`, |
| + "ellipsis": `<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" viewBox="0 0 24 24"><circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/></svg>`, |
| "panel-right": `<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" viewBox="0 0 24 24"><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/></svg>`, |
| "play": `<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" viewBox="0 0 24 24"><polygon points="6 3 20 12 6 21 6 3"/></svg>`, |
| "redo-2": `<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" viewBox="0 0 24 24"><path d="m15 14 5-5-5-5"/><path d="M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13"/></svg>`, |
diff --git a/internal/slides/locales/en.toml b/internal/slides/locales/en.toml| index 2933b0f..a1db4c0 100644 |
| --- a/internal/slides/locales/en.toml |
| +++ b/internal/slides/locales/en.toml |
| @@ -255,7 +255,9 @@ slides.viewer.film = "All slides" |
| slides.viewer.tools = "This deck" |
| slides.viewer.notes = "Speaker notes" |
| slides.viewer.notes.page = "All notes" |
| -slides.viewer.share = "Share" |
| +# The overflow beside Edit and Present: the deck's other reading screens |
| +# (all the notes, the PDF). Its trigger is an icon; this is its name. |
| +slides.viewer.more = "More" |
| slides.viewer.present = "Present" |
| slides.viewer.edit = "Edit" |
| # A link, not a form: the export asks a question first (with the notes |
| @@ -304,6 +306,7 @@ slides.editor.link.remove = "Remove link" |
| slides.editor.link.cancel = "Cancel" |
| slides.editor.noscript = "Editing needs scripts, which are off in this browser. You can still read the deck." |
| slides.editor.noscript.link = "Open the deck" |
| +slides.editor.noscript.settings = "Rename it or change its theme" |
| # The strip's per-slide menu. "Slide actions" names the menu button, |
| # which otherwise shows only an icon; the items repeat the Slide |
| @@ -403,7 +406,6 @@ slides.editor.file.newdeck = "New deck" |
| slides.editor.file.view = "Open in the viewer" |
| slides.editor.file.notes = "All speaker notes" |
| slides.editor.file.export = "Export as PDF…" |
| -slides.editor.file.settings = "Deck settings…" |
| slides.editor.file.delete = "Delete deck…" |
| slides.editor.insert.slide = "New slide" |
| slides.editor.insert.block = "On this slide" |
diff --git a/internal/slides/share.go b/internal/slides/share.go| index 5be9e9f..e4c4126 100644 |
| --- a/internal/slides/share.go |
| +++ b/internal/slides/share.go |
| @@ -448,7 +448,7 @@ func (a *app) sharedDeck(w http.ResponseWriter, r *http.Request) { |
| // A stranger's page: the brand is plain text and "Sign in" carries |
| // no return path, because this path is the capability. |
| - a.renderViewer(w, r, d, modeLink, "/s/"+token, a.publicShell(r, frame{parts: []string{d.Title}, public: true})) |
| + a.renderViewer(w, r, d, modeLink, "/s/"+token, a.publicShell(r, frame{parts: []string{d.Title}, context: d.Title, public: true})) |
| } |
| // --- GET /s/{token}/stream --- |
diff --git a/internal/slides/team_access_test.go b/internal/slides/team_access_test.go| index 19d5d01..d5f2681 100644 |
| --- a/internal/slides/team_access_test.go |
| +++ b/internal/slides/team_access_test.go |
| @@ -16,6 +16,10 @@ import ( |
| func deckPath(d Deck) string { return "/d/" + d.Sqid } |
| +// viewerPath is the deck's viewer: its bare address opens the editor |
| +// (viewer.go's showDeck). |
| +func viewerPath(d Deck) string { return viewerStart(d.Sqid) } |
| + |
| func countRows(t *testing.T, f *teamFixture, model any) int64 { |
| t.Helper() |
| var n int64 |
| @@ -51,10 +55,10 @@ func TestTeamHomeOnlyMemberSignsInAndReachesTheTeamRung(t *testing.T) { |
| if !strings.Contains(body, `action="/signout"`) || !strings.Contains(body, homeOnlyLabel(teamSubject('a'))) { |
| t.Fatalf("Home-only member's chrome is not signed in as %q", homeOnlyLabel(teamSubject('a'))) |
| } |
| - if got := f.get(deckPath(plan)); got.Code != 200 { |
| + if got := f.get(viewerPath(plan)); got.Code != 200 { |
| t.Fatalf("team deck = %d", got.Code) |
| } |
| - if got := f.get(deckPath(private)); got.Code != 404 { |
| + if got := f.get(viewerPath(private)); got.Code != 404 { |
| t.Fatalf("another member's private deck = %d, want 404", got.Code) |
| } |
| } |
| @@ -131,14 +135,14 @@ func TestTeamRemovalRevokesAHomeOnlyMembersExistingSession(t *testing.T) { |
| u := f.member(teamSubject('a'), "member") |
| own := f.deck(u, "My own", rungPrivate) |
| for _, d := range []Deck{plan, own} { |
| - if got := f.get(deckPath(d)); got.Code != 200 { |
| + if got := f.get(viewerPath(d)); got.Code != 200 { |
| t.Fatalf("before removal %s = %d", d.Title, got.Code) |
| } |
| } |
| f.dir.Set(teamSubject('a'), "") |
| f.refreshed() |
| for _, d := range []Deck{plan, own} { |
| - if got := f.get(deckPath(d)); got.Code != 404 { |
| + if got := f.get(viewerPath(d)); got.Code != 404 { |
| t.Fatalf("after removal %s = %d, want 404", d.Title, got.Code) |
| } |
| } |
| @@ -161,7 +165,7 @@ func TestTeamRemovalRevokesAHomeOnlyMembersExistingSession(t *testing.T) { |
| } |
| // And a grant somebody else gave still reaches. |
| f.grant(plan, u, colleague) |
| - if got := f.get(deckPath(plan)); got.Code != 200 { |
| + if got := f.get(viewerPath(plan)); got.Code != 200 { |
| t.Fatalf("granted deck after removal = %d, want 200", got.Code) |
| } |
| } |
| @@ -176,7 +180,7 @@ func TestTeamStandingIsTheRostersNeverTheAllowlists(t *testing.T) { |
| f.jar = map[string]*http.Cookie{} |
| f.localSession("local@example.com") |
| - if got := f.get(deckPath(plan)); got.Code != 404 { |
| + if got := f.get(viewerPath(plan)); got.Code != 404 { |
| t.Fatalf("unlinked local account on a team deck = %d, want 404", got.Code) |
| } |
| if got := f.get("/decks/new"); got.Code != http.StatusForbidden { |
| @@ -187,7 +191,7 @@ func TestTeamStandingIsTheRostersNeverTheAllowlists(t *testing.T) { |
| if got := f.get(deckPath(plan) + "/settings"); got.Code != 404 { |
| t.Fatalf("a member's settings on a colleague's deck = %d, want 404", got.Code) |
| } |
| - if got := f.get(deckPath(plan)); got.Code != 200 { |
| + if got := f.get(viewerPath(plan)); got.Code != 200 { |
| t.Fatalf("a member's team deck = %d", got.Code) |
| } |
| } |
| @@ -201,11 +205,11 @@ func TestTeamStandingEndsAtTheLeaseUnderAFailingRefresh(t *testing.T) { |
| f.member(teamSubject('a'), "member") |
| f.dir.SetDown(true) |
| f.clock.Step(59 * time.Second) |
| - if got := f.get(deckPath(plan)); got.Code != 200 { |
| + if got := f.get(viewerPath(plan)); got.Code != 200 { |
| t.Fatalf("at 59 s = %d, want 200", got.Code) |
| } |
| f.clock.Step(2 * time.Second) |
| - got := f.get(deckPath(plan)) |
| + got := f.get(viewerPath(plan)) |
| if got.Code != http.StatusServiceUnavailable || got.Header().Get("Retry-After") == "" || got.Header().Get("Cache-Control") != "no-store" { |
| t.Fatalf("at 61 s = %d %v, want a retryable no-store 503", got.Code, got.Header()) |
| } |
| @@ -232,10 +236,10 @@ func TestTeamUnknownListIsPartialAndItemsAreRetryable(t *testing.T) { |
| if list.Code != 200 || !strings.Contains(body, "data-partial") || !strings.Contains(body, "Shared with you") || strings.Contains(body, "Team plan") || strings.Contains(body, sampleDeckTitle) { |
| t.Fatalf("Unknown list = %d, want the grant alone, marked partial:\n%s", list.Code, body) |
| } |
| - if got := f.get(deckPath(shared)); got.Code != 200 { |
| + if got := f.get(viewerPath(shared)); got.Code != 200 { |
| t.Fatalf("granted deck under Unknown = %d", got.Code) |
| } |
| - if got := f.get(deckPath(plan)); got.Code != http.StatusServiceUnavailable { |
| + if got := f.get(viewerPath(plan)); got.Code != http.StatusServiceUnavailable { |
| t.Fatalf("team deck under Unknown = %d, want 503", got.Code) |
| } |
| if got := f.get("/decks/new"); got.Code != http.StatusServiceUnavailable { |
diff --git a/internal/slides/team_review_test.go b/internal/slides/team_review_test.go| index 8137a5e..52f8e72 100644 |
| --- a/internal/slides/team_review_test.go |
| +++ b/internal/slides/team_review_test.go |
| @@ -104,8 +104,18 @@ func TestTeamRosterOwnerSharesAndRetitlesOrphansOnly(t *testing.T) { |
| if page.Code != 200 || strings.Contains(page.Body.String(), `name="rung"`) || strings.Contains(page.Body.String(), deckPath(orphan)+"/delete") { |
| t.Fatalf("roster owner's settings on an orphan = %d (rung or delete offered?)", page.Code) |
| } |
| - if got := f.get(deckPath(orphan)); !strings.Contains(got.Body.String(), deckPath(orphan)+"/settings") || !strings.Contains(got.Body.String(), deckPath(orphan)+"/share") { |
| - t.Fatal("the roster owner's viewer of an orphan offers no settings or share") |
| + // The viewer offers Share… in the bar, and never the settings form |
| + // (the editor's inspector holds those, for everybody). |
| + if got := f.get(viewerPath(orphan)); strings.Contains(got.Body.String(), deckPath(orphan)+"/settings") || !strings.Contains(got.Body.String(), deckPath(orphan)+"/share") { |
| + t.Fatal("the roster owner's viewer of an orphan offers no share, or links the settings form") |
| + } |
| + // The share page shows the rung and offers no way to change it, and |
| + // the access POST is refused like any other owner screen. |
| + if got := f.get(deckPath(orphan) + "/share"); strings.Contains(got.Body.String(), `name="rung"`) || !strings.Contains(got.Body.String(), "<section slides-share-access") { |
| + t.Fatalf("roster owner's share page on an orphan offers the rung:\n%s", got.Body.String()) |
| + } |
| + if got := f.post(deckPath(orphan)+"/share/access", url.Values{"rung": {rungPrivate}}); got.Code != 404 { |
| + t.Fatalf("roster owner making an orphan private from the share page = %d, want 404", got.Code) |
| } |
| if got := f.post(deckPath(orphan)+"/settings", url.Values{"title": {"Rescued"}, "theme": {"ink"}}); got.Code != http.StatusSeeOther { |
| t.Fatalf("roster owner retitling an orphan = %d %s", got.Code, got.Body.String()) |
| @@ -130,7 +140,7 @@ func TestTeamRosterOwnerSharesAndRetitlesOrphansOnly(t *testing.T) { |
| t.Fatalf("a refused narrowing changed the orphan: %q %q", row.Title, row.Rung) |
| } |
| // A departed member's private deck, readable by grant: no owner powers. |
| - if got := f.get(deckPath(private)); got.Code != 200 || strings.Contains(got.Body.String(), deckPath(private)+"/settings") { |
| + if got := f.get(viewerPath(private)); got.Code != 200 || strings.Contains(got.Body.String(), deckPath(private)+"/share") { |
| t.Fatalf("roster owner's granted private orphan = %d (owner mode?)", got.Code) |
| } |
| for _, p := range []string{"/settings", "/share", "/delete"} { |
| @@ -306,13 +316,13 @@ func TestTeamLinkedAccountStandsOnTheRoster(t *testing.T) { |
| if f.userFor(teamSubject('k')).ID != linked.ID { |
| t.Fatal("the linked account signed in as somebody else") |
| } |
| - page := f.get(deckPath(plan)) |
| + page := f.get(viewerPath(plan)) |
| if page.Code != 200 || !strings.Contains(page.Body.String(), "linked@example.com") { |
| t.Fatalf("linked member on a team deck = %d (signed in as the account?)", page.Code) |
| } |
| f.dir.Set(teamSubject('k'), "") |
| f.refreshed() |
| - if got := f.get(deckPath(plan)); got.Code != 404 { |
| + if got := f.get(viewerPath(plan)); got.Code != 404 { |
| t.Fatalf("linked account after removal = %d, want 404", got.Code) |
| } |
| } |
diff --git a/internal/slides/team_survivors_test.go b/internal/slides/team_survivors_test.go| index d4fd998..a789be5 100644 |
| --- a/internal/slides/team_survivors_test.go |
| +++ b/internal/slides/team_survivors_test.go |
| @@ -30,8 +30,8 @@ func TestTeamRemovedOwnerOwnsNothing(t *testing.T) { |
| f.grant(own, u, colleague) |
| f.dir.Set(teamSubject('a'), "") |
| f.refreshed() |
| - page := f.get(deckPath(own)) |
| - if page.Code != 200 || strings.Contains(page.Body.String(), deckPath(own)+"/settings") { |
| + page := f.get(viewerPath(own)) |
| + if page.Code != 200 || strings.Contains(page.Body.String(), deckPath(own)+"/share") { |
| t.Fatalf("removed owner's granted deck = %d (owner mode?)", page.Code) |
| } |
| for _, p := range []string{"/settings", "/share", "/delete"} { |
diff --git a/internal/slides/templates/editor.html b/internal/slides/templates/editor.html| index 6e12b26..5fb18ce 100644 |
| --- a/internal/slides/templates/editor.html |
| +++ b/internal/slides/templates/editor.html |
| @@ -78,7 +78,11 @@ |
| <div rst-callout rst-tone="warning"> |
| <div rst-callout-body> |
| <p>{{.NoScriptBody}}</p> |
| - <p><a rst-btn href="{{.BackHref}}">{{.NoScriptLink}}</a></p> |
| + {{/* The viewer by its first slide, never the deck's bare address, |
| + which opens this page again (viewer.go's showDeck). And the |
| + title and theme as a form, the one link to it, for somebody |
| + who may change them. */}} |
| + <p><a rst-btn href="{{.ViewHref}}">{{.NoScriptLink}}</a>{{with .SettingsHref}} <a rst-btn href="{{.}}">{{$.NoScriptSettings}}</a>{{end}}</p> |
| </div> |
| </div> |
| </noscript> |
| @@ -106,10 +110,12 @@ |
| <a estilo-menu-item href="{{.ViewHref}}"><span estilo-menu-label>{{.L "file.view"}}</span></a> |
| <a estilo-menu-item href="{{.NotesPageHref}}"><span estilo-menu-label>{{.L "file.notes"}}</span></a> |
| <a estilo-menu-item href="{{.ExportHref}}"><span estilo-menu-label>{{.L "file.export"}}</span></a> |
| - {{- if or .SettingsHref .ShareHref}} |
| + {{- /* Share… alone: the deck's title, theme and fonts are the |
| + inspector's Deck section, and who can open it is Share's, |
| + as general access is in Docs. */}} |
| + {{- with .ShareHref}} |
| <hr> |
| - {{- with .ShareHref}}<a estilo-menu-item href="{{.}}"><span estilo-menu-label>{{$.L "head.share"}}</span></a>{{end}} |
| - {{- with .SettingsHref}}<a estilo-menu-item href="{{.}}"><span estilo-menu-label>{{$.L "file.settings"}}</span></a>{{end}} |
| + <a estilo-menu-item href="{{.}}"><span estilo-menu-label>{{$.L "head.share"}}</span></a> |
| {{- end}} |
| {{- with .DeleteHref}} |
| <hr> |
diff --git a/internal/slides/templates/viewer.html b/internal/slides/templates/viewer.html| index 77ef5ad..a0ab4a6 100644 |
| --- a/internal/slides/templates/viewer.html |
| +++ b/internal/slides/templates/viewer.html |
| @@ -15,7 +15,15 @@ |
| Present is task 6's surface in its scriptless form: one slide, two |
| links, nothing else on the page. §8's floor, and the thing the |
| fullscreen presenter will be an enhancement OF rather than a |
| - replacement for. */}} |
| + replacement for. |
| + |
| + Shaped as Docs shapes a document (Paul, 2026-11-11: "Share should go |
| + where it does on Docs"): the deck's title is the bar's context and |
| + Share… the bar's action (viewer.go's frame), so the page itself is |
| + the slide, a short row of what a reader reaches for — Edit, Present, |
| + and an overflow for the rest — and the slides as a rail at its side. |
| + The h1 is the deck's title for a screen reader; on screen the bar |
| + says it. */}} |
| {{/* The slide's own stylesheet, on the screens that render a slide and |
| nowhere else: it is a document's look, not the app's chrome, and |
| every other screen would pay for it without using it. */}} |
| @@ -26,40 +34,83 @@ |
| is slides.css; these rules only place the viewer's own parts, each |
| an app attribute (slides-*) so nothing here can collide with the |
| rst-* vocabulary. The look is the editor's (I2, after Docs): the |
| - slide is paper on a desk, the deck's actions one set of pills, and |
| - the filmstrip the slides' own pictures. */ |
| + slide is paper on a desk, the slides a rail of their own pictures |
| + beside it, as the editor's strip is. |
| + |
| + The DOM is the slide's column first and the rail after it, so a |
| + screen reader and the Tab key meet the slide before thirty |
| + thumbnails; the grid puts the rail at the inline start from 1100px |
| + (the editor's own breakpoint) and under the slide below that, where |
| + it is one row that scrolls sideways. */ |
| [slides-viewer] { |
| - margin-inline: auto; |
| - max-inline-size: 72rem; |
| + display: grid; |
| + gap: var(--rst-sp-4); |
| + grid-template-columns: minmax(0, 1fr); |
| } |
| - [slides-viewer] [rst-page-header] { |
| - border: 0; |
| - margin-block-end: var(--rst-sp-3); |
| - padding: 0; |
| + /* The page column is a form's measure (tokens.css's 64rem); a slide |
| + and its rail want the desk's width, as the deck list does. */ |
| + [rst-page]:has(> [slides-viewer]) { |
| + max-width: 88rem; |
| } |
| - [slides-viewer] [rst-page-header] h1 { |
| - font-size: clamp(1.6rem, 1.1rem + 1.6vw, 2.4rem); |
| - letter-spacing: -0.02em; |
| + /* The slide fits the window's height as well as its width, so the |
| + pager is on screen under it on a laptop: never wider than the |
| + height left after the bar, the row and the pager allows. */ |
| + [slides-viewer-main] { |
| + inline-size: 100%; |
| + justify-self: center; |
| + max-inline-size: max(36rem, calc((100dvh - 15rem) * 16 / 9)); |
| + min-inline-size: 0; |
| } |
| [slides-tools] { |
| align-items: center; |
| display: flex; |
| flex-wrap: wrap; |
| gap: var(--rst-sp-2); |
| + justify-content: flex-end; |
| } |
| [slides-tools] form { |
| margin: 0; |
| } |
| [slides-tools] [rst-btn] { |
| border-radius: 999px; |
| + gap: 6px; |
| min-block-size: 36px; |
| padding-inline: 16px; |
| } |
| + [slides-tools] [rst-btn] .icon { |
| + block-size: 16px; |
| + inline-size: 16px; |
| + } |
| [slides-tools] [rst-btn]:not([rst-btn="primary"]) { |
| background: var(--rst-surface); |
| } |
| + /* The overflow: a <details>, so it opens with scripts off, holding |
| + estilo's own menu rows. Its trigger is the same pill, round. */ |
| + [slides-more] { |
| + position: relative; |
| + } |
| + [slides-tools] [slides-more] > summary { |
| + list-style: none; |
| + min-inline-size: 36px; |
| + padding-inline: 0; |
| + justify-content: center; |
| + } |
| + [slides-more] > summary::-webkit-details-marker { |
| + display: none; |
| + } |
| + [slides-more] > summary::marker { |
| + content: ""; |
| + } |
| + [slides-more][open] > summary { |
| + background: var(--rst-accent-soft); |
| + } |
| + [slides-more] > [estilo-menu] { |
| + inset-block-start: calc(100% + 4px); |
| + inset-inline-end: 0; |
| + position: absolute; |
| + } |
| [slides-viewer] [slides-stage] { |
| - margin-block: var(--rst-sp-4) var(--rst-sp-3); |
| + margin-block: var(--rst-sp-3); |
| } |
| [slides-viewer] [slides-stage] > [slides-slide] { |
| border-radius: 6px; |
| @@ -108,20 +159,25 @@ |
| font-weight: 600; |
| min-block-size: 24px; |
| } |
| + /* The slides, as their own pictures. Below 1100px one row that |
| + scrolls sideways under the slide; from 1100px the rail. */ |
| [slides-film-nav] { |
| - margin-block-start: var(--rst-sp-5); |
| + min-inline-size: 0; |
| } |
| [slides-film] { |
| counter-reset: slides-film; |
| - display: grid; |
| + display: flex; |
| gap: var(--rst-sp-3); |
| - grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); |
| list-style: none; |
| margin: 0; |
| - padding: 0; |
| + overflow-x: auto; |
| + padding: 6px 6px var(--rst-sp-2); |
| + scrollbar-width: thin; |
| } |
| [slides-film] > li { |
| counter-increment: slides-film; |
| + flex: none; |
| + inline-size: 9.5rem; |
| } |
| [slides-film] a { |
| color: var(--rst-text-muted); |
| @@ -133,8 +189,14 @@ |
| min-height: 24px; |
| text-decoration: none; |
| } |
| + [slides-film] a > span { |
| + overflow: hidden; |
| + text-overflow: ellipsis; |
| + white-space: nowrap; |
| + } |
| [slides-film] a > span::before { |
| content: counter(slides-film) " "; |
| + font-variant-numeric: tabular-nums; |
| font-weight: 500; |
| white-space: pre; |
| } |
| @@ -169,6 +231,39 @@ |
| outline: 2px solid var(--rst-accent); |
| outline-offset: 3px; |
| } |
| + @media (min-width: 1100px) { |
| + [slides-viewer] { |
| + align-items: start; |
| + column-gap: var(--rst-sp-5); |
| + grid-template-areas: "film main"; |
| + grid-template-columns: 12rem minmax(0, 1fr); |
| + } |
| + [slides-viewer-main] { |
| + grid-area: main; |
| + } |
| + /* The rail stays in view while the slide and its notes scroll, and |
| + scrolls inside itself (the editor's strip does the same). */ |
| + /* Its first picture level with the slide's top edge, under the |
| + row of buttons rather than beside it. */ |
| + [slides-film-nav] { |
| + grid-area: film; |
| + margin-block-start: calc(36px + var(--rst-sp-3) - 6px); |
| + max-block-size: calc(100dvh - 2 * var(--rst-sp-4)); |
| + overflow-y: auto; |
| + position: sticky; |
| + inset-block-start: var(--rst-sp-4); |
| + scrollbar-width: thin; |
| + } |
| + [slides-film] { |
| + flex-direction: column; |
| + gap: var(--rst-sp-4); |
| + overflow-x: visible; |
| + padding: 6px; |
| + } |
| + [slides-film] > li { |
| + inline-size: auto; |
| + } |
| + } |
| </style>{{end}} |
| {{define "content"}} |
| {{/* The slide's announcement when the script changes it in place |
| @@ -190,18 +285,11 @@ |
| </div> |
| {{else}} |
| <div slides-viewer data-vp="{{.VP}}"{{with .Announce}} data-announce="{{.}}"{{end}}> |
| -{{if .BackHref}}{{template "back-nav" dict "Href" .BackHref "Label" .BackLabel}}{{end}} |
| -{{template "page-header" dict "Title" .Title}} |
| -{{if or .EditHref .SettingsHref .ShareHref .NotesHref .ExportHref .PresentHref .PresentAction .FollowHref}} |
| +<h1 class="rst-sr-only">{{.Title}}</h1> |
| +<div slides-viewer-main> |
| +{{if or .EditHref .NotesHref .ExportHref .PresentHref .PresentAction .FollowHref}} |
| <nav slides-tools aria-label="{{.ToolsLabel}}"> |
| - {{if .EditHref}}<a rst-btn="primary" href="{{.EditHref}}">{{.EditLabel}}</a>{{end}} |
| - {{if .SettingsHref}}<a rst-btn href="{{.SettingsHref}}">{{.SettingsLabel}}</a>{{end}} |
| - {{if .ShareHref}}<a rst-btn href="{{.ShareHref}}">{{.ShareLabel}}</a>{{end}} |
| - {{if .NotesHref}}<a rst-btn href="{{.NotesHref}}">{{.NotesPageLabel}}</a>{{end}} |
| - {{/* Export is a LINK to a screen of its own, not a form button: it |
| - asks whether the speaker notes go in the file before it starts |
| - anything (exports.go). */}} |
| - {{if .ExportHref}}<a rst-btn href="{{.ExportHref}}">{{.ExportLabel}}</a>{{end}} |
| + {{if .EditHref}}<a rst-btn href="{{.EditHref}}">{{icon "pencil"}}<span>{{.EditLabel}}</span></a>{{end}} |
| {{/* Present is a FORM on the signed-in screens, because pressing it |
| writes: it opens a session and mints the remote's capability |
| (presentation.go). Over a share link it stays a link to the same |
| @@ -210,12 +298,26 @@ |
| somebody else's deck. */}} |
| {{if .PresentAction}} |
| <form method="post" action="{{.PresentAction}}"> |
| - <button rst-btn="primary" type="submit">{{.PresentLabel}}</button> |
| + <button rst-btn="primary" type="submit">{{icon "play"}}<span>{{.PresentLabel}}</span></button> |
| </form> |
| - {{else if .PresentHref}}<a rst-btn href="{{.PresentHref}}">{{.PresentLabel}}</a>{{end}} |
| + {{else if .PresentHref}}<a rst-btn href="{{.PresentHref}}">{{icon "play"}}<span>{{.PresentLabel}}</span></a>{{end}} |
| {{/* Somebody is presenting this deck right now, and this is the |
| offer to watch along (spec §3.4). Only ever on a share link. */}} |
| {{if .FollowHref}}<a rst-btn="primary" href="{{.FollowHref}}">{{.FollowLabel}}</a>{{end}} |
| + {{/* The rest of what a reader may do with the deck, in one overflow |
| + rather than a row of pills: all the notes on one page, and the PDF. |
| + Export is a LINK to a screen of its own, not a form button: it |
| + asks whether the speaker notes go in the file before it starts |
| + anything (exports.go). */}} |
| + {{if or .NotesHref .ExportHref}} |
| + <details slides-more name="estilo-menus"> |
| + <summary rst-btn title="{{.MoreLabel}}">{{icon "ellipsis"}}<span class="rst-sr-only">{{.MoreLabel}}</span></summary> |
| + <div estilo-menu> |
| + {{if .NotesHref}}<a estilo-menu-item href="{{.NotesHref}}"><span estilo-menu-label>{{.NotesPageLabel}}</span></a>{{end}} |
| + {{if .ExportHref}}<a estilo-menu-item href="{{.ExportHref}}"><span estilo-menu-label>{{.ExportLabel}}</span></a>{{end}} |
| + </div> |
| + </details> |
| + {{end}} |
| </nav> |
| {{end}} |
| @@ -236,7 +338,14 @@ |
| {{.Notes}} |
| </details> |
| {{end}} |
| +{{else}} |
| +<div rst-box> |
| + {{template "empty-state" dict "Title" .EmptyTitle "Body" .EmptyBody "ActionHref" .EditHref "ActionLabel" .EditLabel}} |
| +</div> |
| +{{end}} |
| +</div> |
| +{{if .HasSlides}} |
| <nav slides-film-nav aria-label="{{.FilmLabel}}"> |
| <ol slides-film> |
| {{range .Film}} |
| @@ -244,10 +353,6 @@ |
| {{end}} |
| </ol> |
| </nav> |
| -{{else}} |
| -<div rst-box> |
| - {{template "empty-state" dict "Title" .EmptyTitle "Body" .EmptyBody "ActionHref" .EditHref "ActionLabel" .EditLabel}} |
| -</div> |
| {{end}} |
| </div> |
| {{end}} |
diff --git a/internal/slides/viewer.go b/internal/slides/viewer.go| index 4187cc3..535c78d 100644 |
| --- a/internal/slides/viewer.go |
| +++ b/internal/slides/viewer.go |
| @@ -21,6 +21,8 @@ import ( |
| "strconv" |
| "strings" |
| + "amadan.net/oficina/estilo.git/chrome" |
| + estilomenu "amadan.net/oficina/estilo.git/menu" |
| "amadan.net/rastrillo/rastrillo" |
| "amadan.net/oficina/slides/internal/slides/deck" |
| @@ -100,12 +102,13 @@ type viewerPage struct { |
| // EditHref opens the editor (editor.go). Owner and member alike: |
| // the editor is deckFor's audience, the same people the live-sync |
| // endpoints behind it let write. |
| - EditHref string |
| - EditLabel string |
| - SettingsHref string |
| - SettingsLabel string |
| - ShareHref string |
| - ShareLabel string |
| + EditHref string |
| + EditLabel string |
| + // The overflow (MoreLabel): the deck's other reading screens, kept |
| + // out of the row so the row is what a reader reaches for — Edit and |
| + // Present. Share… is in the bar (Docs' place for it), and the deck's |
| + // settings are the editor's inspector and the share page's. |
| + MoreLabel string |
| NotesHref string |
| NotesPageLabel string |
| // ExportHref opens the export screen (exports.go). Owner and |
| @@ -125,17 +128,26 @@ type viewerPage struct { |
| // the rest of the time, which is nearly always. |
| FollowHref string |
| FollowLabel string |
| - |
| - BackHref string |
| - BackLabel string |
| } |
| // --- GET /d/{sqid} --- |
| -// showDeck serves the signed-in viewer. Which of the two signed-in |
| -// modes it renders is the ownership question and nothing else: a |
| -// member reached this deck through visibleDecks, so they read the |
| -// notes, and only the owner is offered the screens that change it. |
| +// showDeck serves the signed-in viewer, or opens the editor. |
| +// |
| +// A deck's own address opens it to be worked on, as a document's does |
| +// in Docs (Paul, 2026-11-11: he opened a deck and landed on a read-only |
| +// page): everybody deckFor lets in may edit (editor.go), so the bare |
| +// address is a 303 to /edit. The viewer is the same address with a |
| +// query — ?slide=N, which is what every link inside it already is — so |
| +// it stays reachable for somebody with scripts off (the editor's |
| +// <noscript> links it), for the File menu's "Open in the viewer", and |
| +// for the in-place paging that fetches its pages. The redirect comes |
| +// after deckFor, so a stranger still gets the same 404 either way. |
| +// |
| +// Which of the two signed-in modes it renders is the ownership |
| +// question and nothing else: a member reached this deck through |
| +// visibleDecks, so they read the notes, and only the owner is offered |
| +// the screens that change it. |
| func (a *app) showDeck(w http.ResponseWriter, r *http.Request) { |
| u, ok := a.viewer(w, r) |
| if !ok { |
| @@ -145,13 +157,28 @@ func (a *app) showDeck(w http.ResponseWriter, r *http.Request) { |
| if !ok { |
| return |
| } |
| + if r.URL.RawQuery == "" { |
| + http.Redirect(w, r, editorHref(d.Sqid), http.StatusSeeOther) |
| + return |
| + } |
| mode := modeMember |
| + f := frame{parts: []string{d.Title}, context: d.Title} |
| if a.mayShareDeck(r.Context(), u, d) { |
| mode = modeOwner |
| + // Share… in the bar's actions, where Docs puts it on a |
| + // document (Docs' handlers.go, docs.share.action). |
| + f.actions = []chrome.Action{{Item: estilomenu.Item{Href: "/d/" + d.Sqid + "/share", Label: rastrillo.T(r, "slides.share.action")}}} |
| } |
| - a.renderViewer(w, r, d, mode, "/d/"+d.Sqid, a.shellFor(r, u, titled(d.Title))) |
| + a.renderViewer(w, r, d, mode, "/d/"+d.Sqid, a.shellFor(r, u, f)) |
| } |
| +// editorHref is a deck's editor: where a deck opens. |
| +func editorHref(sqid string) string { return "/d/" + sqid + "/edit" } |
| + |
| +// viewerStart is the viewer's first slide: the deck's address with the |
| +// query that keeps it the viewer (showDeck). |
| +func viewerStart(sqid string) string { return viewerHref("/d/"+sqid, 1, "desktop", false) } |
| + |
| // renderViewer is the one viewer, for all three audiences. base is the |
| // URL every link on the page hangs off — "/d/{sqid}" signed in, |
| // "/s/{token}" over a share link — so the page never has to know which |
| @@ -182,37 +209,20 @@ func (a *app) renderViewer(w http.ResponseWriter, r *http.Request, d Deck, mode, |
| VP: vp, |
| Title: view.Meta.Title, |
| } |
| - if mode != modeLink { |
| - page.BackHref = "/" |
| - page.BackLabel = rastrillo.T(r, "slides.decks.title") |
| - } |
| // The buttons, before anything about which slide is being shown: |
| - // they are about the deck, not about the slide, so an owner whose |
| - // document has come back empty still has a way to its settings. |
| + // they are about the deck, not about the slide, so a deck whose |
| + // document has come back empty still has a way into the editor. |
| // modeLink's present link is the exception and waits for the index, |
| // because it is a link to a slide. |
| page.ToolsLabel = rastrillo.T(r, "slides.viewer.tools") |
| switch mode { |
| - case modeOwner: |
| - page.EditHref = base + "/edit" |
| - page.EditLabel = rastrillo.T(r, "slides.viewer.edit") |
| - page.SettingsHref = base + "/settings" |
| - page.SettingsLabel = rastrillo.T(r, "slides.deck.settings") |
| - page.ShareHref = base + "/share" |
| - page.ShareLabel = rastrillo.T(r, "slides.viewer.share") |
| - page.NotesHref = base + "/notes" |
| - page.NotesPageLabel = rastrillo.T(r, "slides.viewer.notes.page") |
| - page.ExportHref = base + "/export" |
| - page.ExportLabel = rastrillo.T(r, "slides.viewer.export") |
| - page.PresentAction = base + "/present" |
| - page.PresentLabel = rastrillo.T(r, "slides.viewer.present") |
| - case modeMember: |
| + case modeOwner, modeMember: |
| page.EditHref = base + "/edit" |
| page.EditLabel = rastrillo.T(r, "slides.viewer.edit") |
| + page.MoreLabel = rastrillo.T(r, "slides.viewer.more") |
| page.NotesHref = base + "/notes" |
| page.NotesPageLabel = rastrillo.T(r, "slides.viewer.notes.page") |
| - // A member exports too, for the same reason. |
| page.ExportHref = base + "/export" |
| page.ExportLabel = rastrillo.T(r, "slides.viewer.export") |
| // A member presents too: reading a deck to a room is reading |
diff --git a/internal/slidestest/capabilities_test.go b/internal/slidestest/capabilities_test.go| index 840b817..380ba6d 100644 |
| --- a/internal/slidestest/capabilities_test.go |
| +++ b/internal/slidestest/capabilities_test.go |
| @@ -325,7 +325,7 @@ func TestRemovingAnAddressEndsItsSessionsAndItsAgents(t *testing.T) { |
| sqid := apiDeck(t, before, token, "Leaving") |
| deck := "/d/" + sqid |
| // Both credentials work while the address is on the list. |
| - mustGet(t, before, deck, http.StatusOK, cookies) |
| + mustGet(t, before, deck+"?slide=1", http.StatusOK, cookies) |
| apiJSON(t, before, http.MethodGet, "/api/v1/decks/"+sqid, token, "", http.StatusOK) |
| // Somebody presenting on the way out, so the lifecycle question the |
diff --git a/internal/slidestest/decks_test.go b/internal/slidestest/decks_test.go| index 88bfa01..d77a614 100644 |
| --- a/internal/slidestest/decks_test.go |
| +++ b/internal/slidestest/decks_test.go |
| @@ -65,7 +65,7 @@ func TestNewDeckAppearsInList(t *testing.T) { |
| path := createDeck(t, a, cookies, "Roadmap") |
| - deckPage := mustGet(t, a, path, http.StatusOK, cookies).Body.String() |
| + deckPage := mustGet(t, a, path+"?slide=1", http.StatusOK, cookies).Body.String() |
| if !strings.Contains(deckPage, "Roadmap") { |
| t.Errorf("GET %s does not name the deck:\n%s", path, deckPage) |
| } |
| @@ -95,7 +95,7 @@ func TestSampleDeckSeededOnFirstSignin(t *testing.T) { |
| if path == "" { |
| t.Fatalf("GET / lists no deck link:\n%s", list) |
| } |
| - page := mustGet(t, a, path, http.StatusOK, cookies).Body.String() |
| + page := mustGet(t, a, path+"?slide=1", http.StatusOK, cookies).Body.String() |
| // Eight slides, every flow template plus two canvas slides, and |
| // notes on each: the sample is what teaches the model, so an empty |
| // one would pass every other assertion here. |
| @@ -160,7 +160,7 @@ func TestTeamDeckVisibleToOthers(t *testing.T) { |
| t.Fatalf("POST %s/settings: status %d, want 303\n%s", path, rec.Code, rec.Body) |
| } |
| - mustGet(t, a, path, http.StatusOK, theirs) |
| + mustGet(t, a, path+"?slide=1", http.StatusOK, theirs) |
| list := mustGet(t, a, "/", http.StatusOK, theirs).Body.String() |
| if !strings.Contains(list, "All hands") { |
| t.Errorf("a team deck is missing from another person's list:\n%s", list) |
| @@ -195,7 +195,7 @@ func TestRenameAndDelete(t *testing.T) { |
| } |
| // The document carries the title too, not only the row: the deck |
| // page renders what the core holds. |
| - page := mustGet(t, a, path, http.StatusOK, mine).Body.String() |
| + page := mustGet(t, a, path+"?slide=1", http.StatusOK, mine).Body.String() |
| if !strings.Contains(page, "Final") { |
| t.Errorf("the rename did not reach the document:\n%s", page) |
| } |
diff --git a/internal/slidestest/editor_test.go b/internal/slidestest/editor_test.go| index 80a219f..ee30f06 100644 |
| --- a/internal/slidestest/editor_test.go |
| +++ b/internal/slidestest/editor_test.go |
| @@ -99,7 +99,8 @@ func TestEditorPageLinksTheCommittedBundle(t *testing.T) { |
| t.Errorf("the editor page lacks %s:\n%s", want, page) |
| } |
| } |
| - if !strings.Contains(page, `href="`+path+`"`) { |
| + // The viewer by its first slide: the bare address opens this page. |
| + if !strings.Contains(page, `href="`+path+`?slide=1"`) { |
| t.Errorf("the noscript fallback does not link the viewer:\n%s", page) |
| } |
| // Every shortcut has a visible menu equivalent. |
| @@ -123,7 +124,7 @@ func TestEditorRequiresMembership(t *testing.T) { |
| mustGet(t, a, path+"/edit", http.StatusNotFound, theirs) |
| mustGet(t, a, path+"/edit", http.StatusOK, mine) |
| - owner := mustGet(t, a, path, http.StatusOK, mine).Body.String() |
| + owner := mustGet(t, a, path+"?slide=1", http.StatusOK, mine).Body.String() |
| if !strings.Contains(owner, `href="`+path+`/edit"`) { |
| t.Errorf("the owner's viewer offers no Edit:\n%s", owner) |
| } |
| @@ -134,7 +135,7 @@ func TestEditorRequiresMembership(t *testing.T) { |
| t.Fatalf("raising the rung: status %d\n%s", rec.Code, rec.Body) |
| } |
| mustGet(t, a, path+"/edit", http.StatusOK, theirs) |
| - member := mustGet(t, a, path, http.StatusOK, theirs).Body.String() |
| + member := mustGet(t, a, path+"?slide=1", http.StatusOK, theirs).Body.String() |
| if !strings.Contains(member, `href="`+path+`/edit"`) { |
| t.Errorf("a member's viewer offers no Edit:\n%s", member) |
| } |
diff --git a/internal/slidestest/export_test.go b/internal/slidestest/export_test.go| index 097073b..2234fd7 100644 |
| --- a/internal/slidestest/export_test.go |
| +++ b/internal/slidestest/export_test.go |
| @@ -66,7 +66,7 @@ func TestExportJobProducesADownload(t *testing.T) { |
| deck := sampleDeck(t, a, cookies) |
| // The viewer offers it, to the person who can read the deck. |
| - page := mustGet(t, a, deck, http.StatusOK, cookies).Body.String() |
| + page := mustGet(t, a, deck+"?slide=1", http.StatusOK, cookies).Body.String() |
| if !strings.Contains(page, `href="`+deck+`/export"`) { |
| t.Errorf("the viewer has no export button:\n%s", page) |
| } |
| @@ -303,7 +303,7 @@ func TestExportPdfIsOwnersOnly(t *testing.T) { |
| if rec.Code != http.StatusSeeOther { |
| t.Fatalf("POST %s/settings: status %d\n%s", deck, rec.Code, rec.Body) |
| } |
| - mustGet(t, a, deck, http.StatusOK, theirs) |
| + mustGet(t, a, deck+"?slide=1", http.StatusOK, theirs) |
| status := startExport(t, a, deck, mine, nil) |
| waitForExport(t, a, status, mine) |
diff --git a/internal/slidestest/fontgate_test.go b/internal/slidestest/fontgate_test.go| index c069e3a..5bd9590 100644 |
| --- a/internal/slidestest/fontgate_test.go |
| +++ b/internal/slidestest/fontgate_test.go |
| @@ -99,7 +99,7 @@ func TestOnlySlideSurfacesCarryTheGateAndPreloadOnlyDeckFaces(t *testing.T) { |
| cookies []*http.Cookie |
| gated bool |
| }{ |
| - {deck, cookies, true}, |
| + {deck + "?slide=1", cookies, true}, |
| {deck + "?slide=2&vp=phone", cookies, true}, |
| {deck + "?present=1", cookies, true}, |
| {deck + "/edit", cookies, true}, |
| @@ -155,7 +155,7 @@ func TestThePreloadsAreEveryStyleOfEveryFamilyTheDeckUses(t *testing.T) { |
| t.Run(c.name, func(t *testing.T) { |
| deck := opsDeck(t, a, token, c.name, c.ops) |
| for _, path := range []string{deck, deck + "/edit"} { |
| - page := mustGet(t, a, path, http.StatusOK, cookies).Body.String() |
| + page := mustGet(t, a, path+"?slide=1", http.StatusOK, cookies).Body.String() |
| preloads, carries := gateOn(t, path, page) |
| if !carries { |
| t.Fatalf("%s carries no gate", path) |
diff --git a/internal/slidestest/fonts_test.go b/internal/slidestest/fonts_test.go| index 438f23d..6582574 100644 |
| --- a/internal/slidestest/fonts_test.go |
| +++ b/internal/slidestest/fonts_test.go |
| @@ -115,7 +115,7 @@ func TestSlidesCSSDeclaresNoFontFace(t *testing.T) { |
| // cannot fetch is the divergence this whole font set exists to close. |
| func TestTheFontManifestDeclaresEveryEmbeddedFace(t *testing.T) { |
| a, deck, cookies := sampleViewer(t) |
| - m, ok := readManifest(t, mustGet(t, a, deck, http.StatusOK, cookies).Body.String()) |
| + m, ok := readManifest(t, mustGet(t, a, deck+"?slide=1", http.StatusOK, cookies).Body.String()) |
| if !ok { |
| t.Fatal("the viewer carries no font manifest") |
| } |
| @@ -158,7 +158,7 @@ func TestTheFontManifestDeclaresEveryEmbeddedFace(t *testing.T) { |
| // paying for files that never change. |
| func TestTheFontManifestURLsCarryTheirContentHash(t *testing.T) { |
| a, deck, cookies := sampleViewer(t) |
| - m, _ := readManifest(t, mustGet(t, a, deck, http.StatusOK, cookies).Body.String()) |
| + m, _ := readManifest(t, mustGet(t, a, deck+"?slide=1", http.StatusOK, cookies).Body.String()) |
| faces := manifestFaces(m) |
| if len(faces) != 12 { |
| t.Fatalf("the manifest has %d faces", len(faces)) |
| @@ -206,7 +206,7 @@ func TestSlidesCSSFallbackStacksAreTheEmbeddedFamilies(t *testing.T) { |
| // manifest names, with the immutable Cache-Control the hash buys. |
| func TestTheAppServesTheDeclaredFontFiles(t *testing.T) { |
| a, deck, cookies := sampleViewer(t) |
| - m, _ := readManifest(t, mustGet(t, a, deck, http.StatusOK, cookies).Body.String()) |
| + m, _ := readManifest(t, mustGet(t, a, deck+"?slide=1", http.StatusOK, cookies).Body.String()) |
| faces := manifestFaces(m) |
| if len(faces) != 12 { |
| t.Fatalf("the viewer's font manifest names %d faces, want twelve", len(faces)) |
diff --git a/internal/slidestest/list_test.go b/internal/slidestest/list_test.go| index f54a754..b0502c6 100644 |
| --- a/internal/slidestest/list_test.go |
| +++ b/internal/slidestest/list_test.go |
| @@ -9,11 +9,12 @@ import ( |
| ) |
| // shelfTile is one cover on the shelf: the tile's link and the picture |
| -// inside it. |
| -var shelfTile = regexp.MustCompile(`<a slides-tile slides-lift href="(/d/[a-z0-9]{10})">\s*<span slides-cover[^>]*>(?:<img src="([^"]+)")?`) |
| +// inside it. A deck opens in the editor, as a document does in Docs, so |
| +// the link is /edit and the captured path is the deck's own. |
| +var shelfTile = regexp.MustCompile(`<a slides-tile slides-lift href="(/d/[a-z0-9]{10})/edit">\s*<span slides-cover[^>]*>(?:<img src="([^"]+)")?`) |
| -// rowLink is one row's title link. |
| -var rowLink = regexp.MustCompile(`<span rst-row-main><a href="(/d/[a-z0-9]{10})">([^<]*)</a>`) |
| +// rowLink is one row's title link, to the editor like a cover's. |
| +var rowLink = regexp.MustCompile(`<span rst-row-main><a href="(/d/[a-z0-9]{10})/edit">([^<]*)</a>`) |
| // TestListShowsTheNewestFiveAsCoversAndTheRestAsRows: the newest five |
| // decks are their first slides, newest first; everything older is a row |
| @@ -81,7 +82,7 @@ func TestAnEmptyDeckGetsABlankCoverInItsTheme(t *testing.T) { |
| `{"ops":[{"op":"remove_slide","id":`+quote(slide)+`}]}`, http.StatusOK) |
| page := mustGet(t, a, "/", http.StatusOK, cookies).Body.String() |
| - m := regexp.MustCompile(`<a slides-tile slides-lift href="/d/` + sqid + `">\s*<span slides-cover[^>]*>(<img)?`).FindStringSubmatch(page) |
| + m := regexp.MustCompile(`<a slides-tile slides-lift href="/d/` + sqid + `/edit">\s*<span slides-cover[^>]*>(<img)?`).FindStringSubmatch(page) |
| if m == nil { |
| t.Fatalf("the empty deck is not on the shelf:\n%s", page) |
| } |
| @@ -159,7 +160,7 @@ func TestNewDeckNeedsNoTitleAndOpensTheEditor(t *testing.T) { |
| t.Fatalf("POST /decks with nothing = %d to %q, want 303 to the editor", rec.Code, loc) |
| } |
| mustGet(t, a, loc, http.StatusOK, cookies) |
| - if page := mustGet(t, a, path, http.StatusOK, cookies).Body.String(); !strings.Contains(page, "Untitled deck") { |
| + if page := mustGet(t, a, path+"?slide=1", http.StatusOK, cookies).Body.String(); !strings.Contains(page, "Untitled deck") { |
| t.Errorf("a deck made with no title is not called Untitled deck") |
| } |
diff --git a/internal/slidestest/live_test.go b/internal/slidestest/live_test.go| index 4243603..08acb25 100644 |
| --- a/internal/slidestest/live_test.go |
| +++ b/internal/slidestest/live_test.go |
| @@ -594,7 +594,7 @@ var poisonSlides = map[string]string{ |
| // one down took them all down, because they share openDeck. |
| func stillRenders(t *testing.T, a *testApp, path, name string, cookies []*http.Cookie) { |
| t.Helper() |
| - mustGet(t, a, path, http.StatusOK, cookies) |
| + mustGet(t, a, path+"?slide=1", http.StatusOK, cookies) |
| mustGet(t, a, path+"/edit", http.StatusOK, cookies) |
| if slide, ok := poisonSlides[name]; ok { |
| mustGet(t, a, path+"/slides/"+slide+".html", http.StatusOK, cookies) |
diff --git a/internal/slidestest/present_test.go b/internal/slidestest/present_test.go| index 1ce2eab..c261f6a 100644 |
| --- a/internal/slidestest/present_test.go |
| +++ b/internal/slidestest/present_test.go |
| @@ -89,7 +89,7 @@ func TestPresentCreatesSessionWithCodeAndRemoteUrl(t *testing.T) { |
| cookies := signedIn(t, a, allowedAddress) |
| path := sampleDeck(t, a, cookies) |
| - viewer := mustGet(t, a, path, http.StatusOK, cookies).Body.String() |
| + viewer := mustGet(t, a, path+"?slide=1", http.StatusOK, cookies).Body.String() |
| if !strings.Contains(viewer, `action="`+path+`/present"`) { |
| t.Errorf("the viewer offers no Present form:\n%s", viewer) |
| } |
diff --git a/internal/slidestest/serving_test.go b/internal/slidestest/serving_test.go| index 36236d1..f1c77f9 100644 |
| --- a/internal/slidestest/serving_test.go |
| +++ b/internal/slidestest/serving_test.go |
| @@ -89,7 +89,7 @@ func TestStandaloneServesInlineStyles(t *testing.T) { |
| cookies := signedIn(t, a, allowedAddress) |
| path := sampleDeck(t, a, cookies) |
| h := productionHandler(t, a) |
| - req := httptest.NewRequest(http.MethodGet, path, nil) |
| + req := httptest.NewRequest(http.MethodGet, path+"?slide=1", nil) |
| for _, c := range cookies { |
| req.AddCookie(c) |
| } |
diff --git a/internal/slidestest/viewer_test.go b/internal/slidestest/viewer_test.go| index dacc0e8..55762d4 100644 |
| --- a/internal/slidestest/viewer_test.go |
| +++ b/internal/slidestest/viewer_test.go |
| @@ -83,7 +83,7 @@ func TestViewerPagesThroughSlides(t *testing.T) { |
| } |
| // The ends are ends: no link off either edge of the deck. |
| - first := mustGet(t, a, path, http.StatusOK, cookies).Body.String() |
| + first := mustGet(t, a, path+"?vp=desktop", http.StatusOK, cookies).Body.String() |
| if strings.Contains(first, `?slide=0"`) { |
| t.Errorf("the first slide offers a previous link:\n%s", first) |
| } |
| @@ -152,39 +152,97 @@ func TestViewerShowsNotesToItsPeople(t *testing.T) { |
| } |
| } |
| -// TestViewerOwnerButtons: settings and share are the owner's, and a |
| -// team member reading the same deck is offered neither. |
| +// TestViewerOwnerButtons: the viewer is shaped as Docs shapes a |
| +// document. Share… is the owner's, and it is in the bar's actions, not |
| +// a pill on the page; the settings form is nobody's link (the editor's |
| +// inspector holds the deck's settings); and the page's own row is what a |
| +// reader reaches for — Edit, Present — with the rest in one overflow. |
| +// A team member reading the same deck is offered no Share…. |
| func TestViewerOwnerButtons(t *testing.T) { |
| a := newSharedApp(t) |
| mine := signedIn(t, a, allowedAddress) |
| theirs := signedIn(t, a, otherAddress) |
| path := createDeck(t, a, mine, "All hands") |
| - if rec := post(t, a, path+"/settings", url.Values{ |
| - "title": {"All hands"}, "theme": {"ink"}, "rung": {"team"}, |
| - }, mine...); rec.Code != http.StatusSeeOther { |
| + if rec := post(t, a, path+"/share/access", url.Values{"rung": {"team"}}, mine...); rec.Code != http.StatusSeeOther { |
| t.Fatalf("raising the rung: status %d\n%s", rec.Code, rec.Body) |
| } |
| - owner := mustGet(t, a, path, http.StatusOK, mine).Body.String() |
| - if !strings.Contains(owner, path+"/settings") { |
| - t.Errorf("the owner's viewer offers no settings:\n%s", owner) |
| + owner := mustGet(t, a, path+"?slide=1", http.StatusOK, mine).Body.String() |
| + bar := owner[strings.Index(owner, "<header estilo-bar"):strings.Index(owner, "</header>")] |
| + if !strings.Contains(bar, `<span estilo-bar-context dir="auto" title="All hands">All hands</span>`) { |
| + t.Errorf("the deck's title is not the bar's context:\n%s", bar) |
| } |
| - if !strings.Contains(owner, path+"/share") { |
| - t.Errorf("the owner's viewer offers no share page:\n%s", owner) |
| + if !strings.Contains(bar, `<a rst-btn href="`+path+`/share">Share…</a>`) { |
| + t.Errorf("the owner's bar offers no Share…:\n%s", bar) |
| + } |
| + if strings.Contains(owner, path+"/settings") { |
| + t.Errorf("the viewer links the settings form:\n%s", owner) |
| + } |
| + main := owner[strings.Index(owner, "<main"):] |
| + if strings.Contains(main, path+"/share") { |
| + t.Errorf("the page repeats Share… outside the bar:\n%s", main) |
| + } |
| + tools := main[strings.Index(main, "<nav slides-tools"):strings.Index(main, "</nav>")] |
| + for _, want := range []string{`href="` + path + `/edit"`, `action="` + path + `/present"`, "<details slides-more", `href="` + path + `/notes"`, `href="` + path + `/export"`} { |
| + if !strings.Contains(tools, want) { |
| + t.Errorf("the viewer's row lacks %s:\n%s", want, tools) |
| + } |
| + } |
| + if more := tools[strings.Index(tools, "<details slides-more"):]; !strings.Contains(more, `href="`+path+`/notes"`) || !strings.Contains(more, `href="`+path+`/export"`) { |
| + t.Errorf("All notes and Export are not in the overflow:\n%s", tools) |
| } |
| - member := mustGet(t, a, path, http.StatusOK, theirs).Body.String() |
| + member := mustGet(t, a, path+"?slide=1", http.StatusOK, theirs).Body.String() |
| if strings.Contains(member, path+"/settings") { |
| t.Errorf("a member's viewer offers the owner's settings:\n%s", member) |
| } |
| if strings.Contains(member, path+"/share") { |
| t.Errorf("a member's viewer offers the owner's share page:\n%s", member) |
| } |
| + if !strings.Contains(member, `href="`+path+`/edit"`) { |
| + t.Errorf("a member's viewer offers no Edit:\n%s", member) |
| + } |
| // And the screens themselves are the owner's, not just their links. |
| mustGet(t, a, path+"/share", http.StatusNotFound, theirs) |
| } |
| +// TestADeckOpensInTheEditor: a deck's own address opens it to be worked |
| +// on, as a document's does in Docs — for the owner and a member alike, |
| +// since both may edit — and a stranger gets the same 404 as ever, never |
| +// a redirect that says the deck is real. The viewer is the same address |
| +// with a query, and the editor's <noscript> and File menu reach it. |
| +func TestADeckOpensInTheEditor(t *testing.T) { |
| + a := newSharedApp(t) |
| + mine := signedIn(t, a, allowedAddress) |
| + theirs := signedIn(t, a, otherAddress) |
| + path := createDeck(t, a, mine, "Roadmap") |
| + |
| + if rec := mustGet(t, a, path, http.StatusSeeOther, mine); rec.Header().Get("Location") != path+"/edit" { |
| + t.Errorf("GET %s = %s, want a 303 to %s/edit", path, rec.Header().Get("Location"), path) |
| + } |
| + mustGet(t, a, path, http.StatusNotFound, theirs) |
| + if rec := post(t, a, path+"/share/access", url.Values{"rung": {"team"}}, mine...); rec.Code != http.StatusSeeOther { |
| + t.Fatalf("raising the rung: status %d", rec.Code) |
| + } |
| + if rec := mustGet(t, a, path, http.StatusSeeOther, theirs); rec.Header().Get("Location") != path+"/edit" { |
| + t.Errorf("a member's GET %s = %s, want the editor", path, rec.Header().Get("Location")) |
| + } |
| + for _, q := range []string{"?slide=1", "?vp=phone", "?present=1"} { |
| + mustGet(t, a, path+q, http.StatusOK, mine) |
| + } |
| + |
| + // The list opens the editor too. |
| + list := mustGet(t, a, "/", http.StatusOK, mine).Body.String() |
| + if !strings.Contains(list, `href="`+path+`/edit"`) || strings.Contains(list, `href="`+path+`"`) { |
| + t.Errorf("the list does not open the deck in the editor:\n%s", list) |
| + } |
| + editor := mustGet(t, a, path+"/edit", http.StatusOK, mine).Body.String() |
| + if !strings.Contains(editor, `href="`+path+`?slide=1"`) { |
| + t.Errorf("the editor offers no way to the viewer:\n%s", editor) |
| + } |
| +} |
| + |
| // TestPresentSurfaceIsBare: ?present=1 is the scriptless presenting |
| // page — one slide, two links, and none of the chrome. Task 6 replaces |
| // it with the live fullscreen surface; this is the floor it has to keep |