web: legacy Build keeps its note; optional notes on option answers
Task 5 review, fix round 1.
- The fix for the legacy card: a direction with no Rounds, and more
than one option, keeps today's Build note composer. Its submission
posts choice=build with the required note. The per-option forms
appear only when Rounds exist.
- Optional notes:
- Each option's form holds the option fields and one optional note
input (maxlength 1000, placeholder from the new pending key
chat.card.option_note, "Add a note (optional)"), followed by Build
this one and More like this. With the note left empty, Build still
takes one tap.
- More options is now a small form of its own with the same note
input, on the card and on the task page.
- The card's own answers sit in one row, in this order: More options,
Try again, Drop it. Try again's <details> summary is the button
itself (rst-btn) and shows a focus outline. Once opened, it becomes
the card's bottom drawer after the row. The CSS rule that hid the
summary on enhanced pages is removed.
- The header now says Design: the fixture gives the task its Design
maker, and the existing rosterAuthor uses it. TestCardPerOptionBuild
asserts the header names Design.
TDD evidence
- Tests: form submissions are now checked through a small
x/net/html form parser in direction_card_test.go. It records what a
browser would post for a given button and typed note.
- Red: the new tests ran against 4952a854's templates and views and
failed:
TestConversationDirectionCardOptions found no legacy Build note form.
TestCardPerOptionBuild and TestTaskPageRounds found no note field in
the posted data.
TestCardMoreButtons failed with "option form has no note control".
- Green: the targeted tests pass, and so do the whole internal/equipo
package (76s), go vet (with and without -tags browser) and
make spacing.
- Mutations (each one fails the tests named):
legacy composer dropped: TestConversationDirectionCardOptions
card Build kept with options: TestConversationDirectionCardOptions
and TestCardPerOptionBuild
Drop it before Try again: TestCardMoreButtons
option note removed: TestCardPerOptionBuild, TestCardMoreButtons and
TestTaskPageRounds
option note required: TestCardPerOptionBuild and TestTaskPageRounds
card More options note removed: TestCardMoreButtons
Try again summary plain again: TestCardMoreButtons
task page More options not shown: TestTaskPageRounds
task page More options note removed: TestTaskPageRounds
maker ignored in rosterAuthor: TestCardPerOptionBuild
summary focus rule removed: TestBrowserDirectionCard (outline "auto",
the browser's default, instead of the app's)
One redundant clause was found and removed: "BuildNote &&
!perOption" on the card. Its mutation survived because the card
already leaves Build out when options have their own.
- Browser: TestBrowserDirectionCard now also checks that Try again's
summary has Drop it's look, and that a real Tab from More options
focuses it with an outline. Screenshots retaken in
.superpowers/sdd/2026-11-30-design-feedback-1/task-5-shots/
(direction-card-phone.png, direction-card-desktop.png,
direction-task-phone.png, direction-task-desktop.png).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
10 files changed,
+263
−105
docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md+1 −0internal/equipo/chat_page.go+14 −5internal/equipo/copy.go+1 −0internal/equipo/design_views_test.go+26 −22internal/equipo/direction_card_browser_test.go+21 −0internal/equipo/direction_card_test.go+179 −71internal/equipo/static/equipo.css+14 −3internal/equipo/templates/chat.html+1 −1internal/equipo/templates/work_parts.html+2 −2internal/equipo/work_views.go+4 −1
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md| index a6706513..8ea6c758 100644 |
| --- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md |
| +++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md |
| @@ -7228,6 +7228,7 @@ records remain unchanged. |
| | `work.captures.earlier` | Earlier options are on the task page | Copy specialist | COPY REVIEW PENDING | |
| | `chat.card.more_options` | More options | Copy specialist | COPY REVIEW PENDING | |
| | `chat.card.like` | More like this | Copy specialist | COPY REVIEW PENDING | |
| +| `chat.card.option_note` | Add a note (optional) | Copy specialist | COPY REVIEW PENDING | |
| ## Task 21 |
diff --git a/internal/equipo/chat_page.go b/internal/equipo/chat_page.go| index 1ea0b18b..323a919c 100644 |
| --- a/internal/equipo/chat_page.go |
| +++ b/internal/equipo/chat_page.go |
| @@ -115,10 +115,14 @@ type chatCard struct { |
| // labelled from code-derived console and account words. |
| PlaceChoices []placeChoice |
| // Gallery is an open direction card's newest kept Design round, by |
| - // option; OptionBuild: each option has its own Build this one, so |
| - // the card's answers leave theirs out. |
| - Gallery *designGallery |
| - OptionBuild bool |
| + // option. DirectionAnswers are the card's own answers in the order |
| + // it shows them (Build, unless each option has its own; More options, |
| + // Try again, Drop it). BuildNote: with more than one option, the |
| + // card's Build (left out once options have their own, so only on a |
| + // direction from before rounds) takes the person's note saying which. |
| + Gallery *designGallery |
| + DirectionAnswers []string |
| + BuildNote bool |
| } |
| // placeChoice is one button of a place card. |
| @@ -262,7 +266,12 @@ func cardView(c wire.Card, choices []string, tasks map[string]wire.Task) chatCar |
| if v.Gallery != nil { |
| v.Gallery.Answer.Like = slices.Contains(c.Options, wire.ChoiceLike) |
| } |
| - v.OptionBuild = v.Gallery.perOption() |
| + v.BuildNote = t.Direction.NoteNeeded |
| + } |
| + for _, o := range []string{wire.ChoiceBuild, wire.ChoiceMore, wire.ChoiceAgain, wire.ChoiceDrop} { |
| + if slices.Contains(c.Options, o) && (o != wire.ChoiceBuild || !v.Gallery.perOption()) { |
| + v.DirectionAnswers = append(v.DirectionAnswers, o) |
| + } |
| } |
| switch { |
| case c.State == wire.CardAnswered: |
diff --git a/internal/equipo/copy.go b/internal/equipo/copy.go| index 2e45751f..7d1d480b 100644 |
| --- a/internal/equipo/copy.go |
| +++ b/internal/equipo/copy.go |
| @@ -2074,6 +2074,7 @@ var pageCopy = map[string]string{ |
| "work.captures.earlier": "Earlier options are on the task page", // COPY REVIEW PENDING |
| "chat.card.more_options": "More options", // COPY REVIEW PENDING |
| "chat.card.like": "More like this", // COPY REVIEW PENDING |
| + "chat.card.option_note": "Add a note (optional)", // COPY REVIEW PENDING |
| // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): preferences.title |
| "preferences.title": "Preferences", |
diff --git a/internal/equipo/design_views_test.go b/internal/equipo/design_views_test.go| index 7059353a..91e3c433 100644 |
| --- a/internal/equipo/design_views_test.go |
| +++ b/internal/equipo/design_views_test.go |
| @@ -102,31 +102,35 @@ func TestDirectionDecisionShowsOptions(t *testing.T) { |
| } |
| // TestConversationDirectionCardOptions: the conversation's direction |
| -// card shows the captures. A direction without kept rounds (from before |
| -// they were recorded) shows its options with no answer naming one; the |
| -// Build note composer is gone either way (Build this one is per option, |
| -// direction_card_test.go). |
| +// card shows the captures. A direction from before rounds were kept, |
| +// with more than one option, keeps Build with the person's note saying |
| +// which: no bare Build, which the instance refuses (ErrDirectionNote). |
| +// With one option, or none, Build is one tap as before. |
| func TestConversationDirectionCardOptions(t *testing.T) { |
| - render := func(task wire.Task, card *wire.Card) string { |
| + render := func(c directionCase) []htmlForm { |
| t.Helper() |
| - v := cardView(*card, nil, map[string]wire.Task{task.ID: task}) |
| - var b bytes.Buffer |
| - if err := pages["chat"].ExecuteTemplate(&b, "chat-card", v); err != nil { |
| - t.Fatal(err) |
| + page := renderDirectionCard(t, c) |
| + if len(c.task.Direction.Options) > 0 { |
| + mustContain(t, page, galleryWants("tk1")[0]) |
| } |
| - return b.String() |
| - } |
| - html := render(directionTask(true, designOptions())) |
| - mustContain(t, html, galleryWants("tk1")...) |
| - if strings.Contains(html, "data-direction-build") || strings.Contains(html, `name="option_step"`) { |
| - t.Fatalf("legacy options: %s", html) |
| - } |
| - html = render(directionTask(false, designOptions()[:1])) |
| - mustContain(t, html, `name="choice" value="build" type="submit"`, "Option 1: Calm") |
| - // No Design: the card as it was. |
| - html = render(directionTask(false, nil)) |
| - if strings.Contains(html, "equipo-captures") || strings.Contains(html, "data-direction-build") || !strings.Contains(html, `name="choice" value="build" type="submit"`) { |
| - t.Fatalf("no options: %s", html) |
| + return formsOf(t, page) |
| + } |
| + legacy := func(note bool, opts []wire.StepDesignOption) directionCase { |
| + task, card := directionTask(note, opts) |
| + return directionCase{task, card} |
| + } |
| + forms := render(legacy(true, designOptions())) |
| + builds := formsWith(forms, "build") |
| + if len(builds) != 1 || !builds[0].Text["note"] || len(builds[0].Choices) != 0 || len(formsWith(forms, "option_step")) != 0 { |
| + t.Fatalf("legacy Build %+v", forms) |
| + } |
| + wantPost(t, builds[0].submit(t, "", "the calm one"), "revision", "2", "choice", "build", "note", "the calm one") |
| + for _, c := range []directionCase{legacy(false, designOptions()[:1]), legacy(false, nil)} { |
| + builds := formsWith(render(c), "build") |
| + if len(builds) != 1 { |
| + t.Fatalf("Build forms %+v", builds) |
| + } |
| + wantPost(t, builds[0].submit(t, "build", ""), "revision", "2", "choice", "build") |
| } |
| } |
diff --git a/internal/equipo/direction_card_browser_test.go b/internal/equipo/direction_card_browser_test.go| index 3e4cf932..5e62c0fe 100644 |
| --- a/internal/equipo/direction_card_browser_test.go |
| +++ b/internal/equipo/direction_card_browser_test.go |
| @@ -111,6 +111,27 @@ func TestBrowserDirectionCard(t *testing.T) { |
| if err != nil { |
| t.Fatal(err) |
| } |
| + if page == "card" { |
| + // Try again's summary looks like Drop it and shows its |
| + // keyboard focus. |
| + same, err := chromedp.Run(ctx, chromedp.Evaluate[string](`(() => { |
| + const s = document.querySelector('[data-direction-thread] > summary'), d = document.querySelector('[data-direction-choice="drop"]'); |
| + const a = getComputedStyle(s), b = getComputedStyle(d); |
| + document.querySelector('[data-direction-choice="more"]').focus(); |
| + return ['border-top-style', 'border-top-color', 'background-color', 'font-weight', 'block-size'].filter(p => a.getPropertyValue(p) !== b.getPropertyValue(p)).join(','); |
| + })()`)) |
| + if err == nil { |
| + _, err = chromedp.Run(ctx, chromedp.KeyEvent("\t")) |
| + } |
| + if err == nil { |
| + var focus string |
| + focus, err = chromedp.Run(ctx, chromedp.Evaluate[string](`(() => { const s = document.querySelector('[data-direction-thread] > summary'); return '|' + (document.activeElement === s) + '|' + getComputedStyle(s).outlineStyle; })()`)) |
| + same += focus |
| + } |
| + if err != nil || same != "|true|solid" { |
| + t.Errorf("card at %s: Try again differs from Drop it (differs|focused|outline): %q %v", vp.name, same, err) |
| + } |
| + } |
| want := 3 |
| if page == "task" { |
| want = 6 |
diff --git a/internal/equipo/direction_card_test.go b/internal/equipo/direction_card_test.go| index a56dc590..163e20b8 100644 |
| --- a/internal/equipo/direction_card_test.go |
| +++ b/internal/equipo/direction_card_test.go |
| @@ -2,9 +2,14 @@ package equipo |
| import ( |
| "bytes" |
| + "net/url" |
| + "slices" |
| + "strconv" |
| "strings" |
| "testing" |
| + "golang.org/x/net/html" |
| + |
| "amadan.net/oficina/equipo/internal/wire" |
| ) |
| @@ -47,7 +52,7 @@ type directionCase struct { |
| func feedbackTask(rounds []wire.DirectionRound) directionCase { |
| card := &wire.Card{ID: "c1", Kind: wire.CardDirection, State: wire.CardOpen, Revision: 2, TaskID: "tk1", Options: []string{wire.ChoiceBuild, wire.ChoiceAgain, wire.ChoiceDrop, wire.ChoiceMore, wire.ChoiceLike}} |
| opts := rounds[0].Options |
| - return directionCase{wire.Task{ID: "tk1", Creator: "owner@example.com", Stage: wire.StageInReview, Kind: wire.KindExplore, NeedsYou: wire.NeedsDirection, Direction: &wire.TaskDirection{BranchURL: "https://amadan.net/x?branch=y", Options: opts, NoteNeeded: len(opts) > 1, Rounds: rounds}}, card} |
| + return directionCase{wire.Task{ID: "tk1", Creator: "owner@example.com", Maker: &wire.Maker{ID: "spdesign", Profile: "design-v1"}, Stage: wire.StageInReview, Kind: wire.KindExplore, NeedsYou: wire.NeedsDirection, Direction: &wire.TaskDirection{BranchURL: "https://amadan.net/x?branch=y", Options: opts, NoteNeeded: len(opts) > 1, Rounds: rounds}}, card} |
| } |
| func renderDirectionCard(t *testing.T, c directionCase) string { |
| @@ -75,121 +80,224 @@ func renderDirectionDecision(t *testing.T, c directionCase) string { |
| return b.String() |
| } |
| -// optionForms are the rendered forms that name an option. |
| -func optionForms(html string) []string { |
| - var out []string |
| - for _, f := range strings.Split(html, "<form")[1:] { |
| - f, _, _ = strings.Cut(f, "</form>") |
| - if strings.Contains(f, `name="option_step"`) { |
| +// htmlForm is one rendered form: its action, what it submits as rendered |
| +// (hidden inputs), its text controls (name to required) and the choices |
| +// its submit buttons carry. |
| +type htmlForm struct { |
| + Action string |
| + Hidden url.Values |
| + Text map[string]bool |
| + Choices []string |
| +} |
| + |
| +func formsOf(t *testing.T, page string) []htmlForm { |
| + t.Helper() |
| + doc, err := html.Parse(strings.NewReader(page)) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + attr := func(n *html.Node, k string) (string, bool) { |
| + for _, a := range n.Attr { |
| + if a.Key == k { |
| + return a.Val, true |
| + } |
| + } |
| + return "", false |
| + } |
| + var forms []htmlForm |
| + var walk func(n *html.Node, f *htmlForm) |
| + walk = func(n *html.Node, f *htmlForm) { |
| + if n.Type == html.ElementNode { |
| + name, _ := attr(n, "name") |
| + value, _ := attr(n, "value") |
| + _, required := attr(n, "required") |
| + kind, _ := attr(n, "type") |
| + switch { |
| + case n.Data == "form": |
| + action, _ := attr(n, "action") |
| + forms = append(forms, htmlForm{Action: action, Hidden: url.Values{}, Text: map[string]bool{}}) |
| + f = &forms[len(forms)-1] // forms do not nest |
| + case f == nil: |
| + case n.Data == "input" && kind == "hidden": |
| + f.Hidden.Add(name, value) |
| + case n.Data == "input" && kind != "checkbox", n.Data == "textarea": |
| + f.Text[name] = required |
| + case n.Data == "button" && name == "choice": |
| + f.Choices = append(f.Choices, value) |
| + } |
| + } |
| + for c := n.FirstChild; c != nil; c = c.NextSibling { |
| + walk(c, f) |
| + } |
| + } |
| + walk(doc, nil) |
| + return forms |
| +} |
| + |
| +// submit is what the browser posts when the person types note (when the |
| +// form has a note control) and taps the button carrying choice ("" for a |
| +// form whose choice is hidden). |
| +func (f htmlForm) submit(t *testing.T, choice, note string) url.Values { |
| + t.Helper() |
| + v := url.Values{} |
| + for k, vs := range f.Hidden { |
| + v[k] = append([]string(nil), vs...) |
| + } |
| + if required, ok := f.Text["note"]; ok { |
| + if required && note == "" { |
| + t.Fatalf("%+v cannot be sent without a note", f) |
| + } |
| + v.Set("note", note) |
| + } else if note != "" { |
| + t.Fatalf("%+v has no note control", f) |
| + } |
| + if choice != "" { |
| + if !slices.Contains(f.Choices, choice) { |
| + t.Fatalf("%+v has no %s button", f, choice) |
| + } |
| + v.Set("choice", choice) |
| + } |
| + return v |
| +} |
| + |
| +// formsWith are the forms that carry key (a hidden field) or answer key |
| +// (a button or a hidden choice). |
| +func formsWith(forms []htmlForm, key string) []htmlForm { |
| + var out []htmlForm |
| + for _, f := range forms { |
| + if f.Hidden.Has(key) || slices.Contains(f.Choices, key) || f.Hidden.Get("choice") == key { |
| out = append(out, f) |
| } |
| } |
| return out |
| } |
| -func TestCardPerOptionBuild(t *testing.T) { |
| - html := renderDirectionCard(t, feedbackTask(feedbackRounds())) |
| - forms := optionForms(html) |
| - if len(forms) != 3 { |
| - t.Fatalf("%d option forms, want 3 (the newest round's): %s", len(forms), html) |
| +func wantPost(t *testing.T, got url.Values, want ...string) { |
| + t.Helper() |
| + w := url.Values{} |
| + for i := 0; i < len(want); i += 2 { |
| + w.Add(want[i], want[i+1]) |
| } |
| - for i, f := range forms { |
| - mustContain(t, f, ` method="post" action="/conversation/cards/c1/answer"`, `name="revision" value="2"`, |
| - `name="option_step" value="stnew"`, `name="option_index" value="`+string(rune('0'+i))+`"`, |
| - `name="choice" value="build"`, ">"+copyText("chat.card.build")+"<") |
| + if got.Encode() != w.Encode() { |
| + t.Fatalf("posts %s, want %s", got.Encode(), w.Encode()) |
| } |
| - if strings.Contains(html, "data-direction-build") || strings.Contains(html, copyText("chat.card.build_note")) { |
| - t.Fatalf("the Build note composer is still there: %s", html) |
| +} |
| + |
| +// TestCardPerOptionBuild: each option of the card's newest round is one |
| +// form; Build this one posts its step and index in one tap, a note only |
| +// when typed. The card has no Build of its own and no note composer, |
| +// shows the newest round only and says earlier ones exist, and names |
| +// Design, its maker. |
| +func TestCardPerOptionBuild(t *testing.T) { |
| + page := renderDirectionCard(t, feedbackTask(feedbackRounds())) |
| + forms := formsOf(t, page) |
| + options := formsWith(forms, "option_step") |
| + if len(options) != 3 { |
| + t.Fatalf("%d option forms, want 3 (the newest round's): %s", len(options), page) |
| + } |
| + for i, f := range options { |
| + if f.Action != "/conversation/cards/c1/answer" || f.Text["note"] { |
| + t.Fatalf("option form %+v", f) |
| + } |
| + wantPost(t, f.submit(t, "build", ""), "revision", "2", "option_step", "stnew", "option_index", strconv.Itoa(i), "note", "", "choice", "build") |
| } |
| - if n := strings.Count(html, `value="build"`); n != 3 { |
| - t.Fatalf("%d Build answers, want one per option and none for the card: %s", n, html) |
| + wantPost(t, options[1].submit(t, "build", "with the darker header"), "revision", "2", "option_step", "stnew", "option_index", "1", "note", "with the darker header", "choice", "build") |
| + if n := len(formsWith(forms, "build")); n != 3 || strings.Contains(page, "data-direction-build") { |
| + t.Fatalf("%d Build forms, want one per option and no composer: %s", n, page) |
| } |
| - // The card shows the newest round only, and says earlier ones exist. |
| - if strings.Contains(html, "Calm") || strings.Contains(html, "stold") { |
| - t.Fatalf("the card shows an earlier round: %s", html) |
| + if strings.Contains(page, "Calm") || strings.Contains(page, "stold") { |
| + t.Fatalf("the card shows an earlier round: %s", page) |
| } |
| - mustContain(t, html, `href="/tasks/tk1"`, copyText("work.captures.earlier")) |
| - one := feedbackRounds()[:1] |
| - if html := renderDirectionCard(t, feedbackTask(one)); strings.Contains(html, copyText("work.captures.earlier")) { |
| - t.Fatalf("one round says earlier ones exist: %s", html) |
| + mustContain(t, page, `href="/tasks/tk1"`, copyText("work.captures.earlier"), "<span equipo-roster-author><b>"+makerName("design-v1")+"</b>") |
| + if page := renderDirectionCard(t, feedbackTask(feedbackRounds()[:1])); strings.Contains(page, copyText("work.captures.earlier")) { |
| + t.Fatalf("one round says earlier ones exist: %s", page) |
| } |
| - // An answered card offers nothing. |
| answered := feedbackTask(feedbackRounds()) |
| answered.card.State, answered.card.Choice = wire.CardAnswered, wire.ChoiceBuild |
| - if html := renderDirectionCard(t, answered); len(optionForms(html)) != 0 { |
| - t.Fatalf("an answered card has option forms: %s", html) |
| + if forms := formsOf(t, renderDirectionCard(t, answered)); len(forms) != 0 { |
| + t.Fatalf("an answered card has forms: %+v", forms) |
| } |
| } |
| +// TestCardMoreButtons: More like this per option and More options once, |
| +// each with its optional note; the card's own answers read More options, |
| +// Try again, Drop it, Try again's summary a button among them. |
| func TestCardMoreButtons(t *testing.T) { |
| - html := renderDirectionCard(t, feedbackTask(feedbackRounds())) |
| - forms := optionForms(html) |
| - for _, f := range forms { |
| - mustContain(t, f, `name="choice" value="like"`, ">"+copyText("chat.card.like")+"<") |
| + page := renderDirectionCard(t, feedbackTask(feedbackRounds())) |
| + forms := formsOf(t, page) |
| + if likes := formsWith(forms, "like"); len(likes) != 3 { |
| + t.Fatalf("%d More like this, want one per option: %s", len(likes), page) |
| + } else { |
| + wantPost(t, likes[2].submit(t, "like", "warmer"), "revision", "2", "option_step", "stnew", "option_index", "2", "note", "warmer", "choice", "like") |
| } |
| - if n := strings.Count(html, `value="like"`); n != 3 { |
| - t.Fatalf("%d More like this, want one per option: %s", n, html) |
| + more := formsWith(forms, "more") |
| + if len(more) != 1 || more[0].Hidden.Has("option_step") || more[0].Text["note"] { |
| + t.Fatalf("More options forms %+v", more) |
| } |
| - if n := strings.Count(html, `value="more"`); n != 1 { |
| - t.Fatalf("%d More options, want one: %s", n, html) |
| + wantPost(t, more[0].submit(t, "more", "fewer colours"), "revision", "2", "note", "fewer colours", "choice", "more") |
| + wantPost(t, more[0].submit(t, "more", ""), "revision", "2", "note", "", "choice", "more") |
| + _, row, _ := strings.Cut(page, "<div equipo-direction-actions>") |
| + m, a, d := strings.Index(row, `value="more"`), strings.Index(row, `<summary rst-btn>`+copyText("chat.card.again")+`</summary>`), strings.Index(row, `value="drop"`) |
| + if m < 0 || a < m || d < a { |
| + t.Fatalf("card answers out of order (%d, %d, %d): %s", m, a, d, row) |
| } |
| - mustContain(t, html, ">"+copyText("chat.card.more_options")+"<", `name="choice" value="drop"`, "data-direction-thread") |
| - for _, f := range forms { |
| - if strings.Contains(f, `value="more"`) || strings.Contains(f, `value="drop"`) { |
| - t.Fatalf("a card answer inside an option's form: %s", f) |
| - } |
| - } |
| - // A card that does not take them shows neither. |
| plain := feedbackTask(feedbackRounds()) |
| plain.card.Options = []string{wire.ChoiceBuild, wire.ChoiceAgain, wire.ChoiceDrop} |
| - html = renderDirectionCard(t, plain) |
| - if strings.Contains(html, `value="like"`) || strings.Contains(html, `value="more"`) || len(optionForms(html)) != 3 { |
| - t.Fatalf("answers the card does not take: %s", html) |
| + forms = formsOf(t, renderDirectionCard(t, plain)) |
| + if len(formsWith(forms, "like")) != 0 || len(formsWith(forms, "more")) != 0 || len(formsWith(forms, "option_step")) != 3 { |
| + t.Fatalf("answers the card does not take: %+v", forms) |
| } |
| } |
| func TestDirectionShown(t *testing.T) { |
| escaped := `Warm paper tones, a <b>serif</b> & quiet margins` |
| - for name, html := range map[string]string{ |
| + for name, page := range map[string]string{ |
| "card": renderDirectionCard(t, feedbackTask(feedbackRounds())), |
| "task": renderDirectionDecision(t, feedbackTask(feedbackRounds())), |
| } { |
| - if strings.Contains(html, "<b>serif") { |
| - t.Fatalf("%s: direction not escaped: %s", name, html) |
| + if strings.Contains(page, "<b>serif") { |
| + t.Fatalf("%s: direction not escaped: %s", name, page) |
| } |
| - heading, direction, capture := strings.Index(html, "Option 1: Writing desk"), strings.Index(html, escaped), strings.Index(html, "tf_w1") |
| + heading, direction, capture := strings.Index(page, "Option 1: Writing desk"), strings.Index(page, escaped), strings.Index(page, "tf_w1") |
| if heading < 0 || direction < heading || capture < direction { |
| - t.Fatalf("%s: the direction is not under the name (%d, %d, %d): %s", name, heading, direction, capture, html) |
| + t.Fatalf("%s: the direction is not under the name (%d, %d, %d): %s", name, heading, direction, capture, page) |
| } |
| - mustContain(t, html, `<p equipo-direction>`+escaped+`</p>`, "<figcaption>Dashboard, phone, full page</figcaption>", `alt="Writing desk: Dashboard, desktop"`) |
| + mustContain(t, page, `<p equipo-direction>`+escaped+`</p>`, "<figcaption>Dashboard, phone, full page</figcaption>", `alt="Writing desk: Dashboard, desktop"`) |
| } |
| } |
| +// TestTaskPageRounds: the task page lists every round newest first, each |
| +// option a form with Build and More like this and its optional note; |
| +// More options is a form of its own with its note; the decision's own |
| +// form keeps Try again's note and Drop it, and no Build. |
| func TestTaskPageRounds(t *testing.T) { |
| - html := renderDirectionDecision(t, feedbackTask(feedbackRounds())) |
| - newest, earlier := strings.Index(html, "Option 1: Writing desk"), strings.Index(html, "Option 1: Calm") |
| - if newest < 0 || earlier < newest { |
| - t.Fatalf("rounds not newest first (%d, %d): %s", newest, earlier, html) |
| + page := renderDirectionDecision(t, feedbackTask(feedbackRounds())) |
| + if newest, earlier := strings.Index(page, "Option 1: Writing desk"), strings.Index(page, "Option 1: Calm"); newest < 0 || earlier < newest { |
| + t.Fatalf("rounds not newest first (%d, %d): %s", newest, earlier, page) |
| } |
| - forms := optionForms(html) |
| - if len(forms) != 6 { |
| - t.Fatalf("%d option forms, want 6: %s", len(forms), html) |
| + forms := formsOf(t, page) |
| + options := formsWith(forms, "option_step") |
| + if len(options) != 6 { |
| + t.Fatalf("%d option forms, want 6: %s", len(options), page) |
| } |
| - for i, f := range forms { |
| + for i, f := range options { |
| step, index := "stnew", i |
| if i >= 3 { |
| step, index = "stold", i-3 |
| } |
| - mustContain(t, f, `action="/conversation/cards/c1/answer"`, `name="revision" value="2"`, `name="from" value="task"`, `name="task" value="tk1"`, |
| - `name="option_step" value="`+step+`"`, `name="option_index" value="`+string(rune('0'+index))+`"`, `name="choice" value="build"`, `name="choice" value="like"`) |
| + wantPost(t, f.submit(t, "build", ""), "revision", "2", "from", "task", "task", "tk1", "option_step", step, "option_index", strconv.Itoa(index), "note", "", "choice", "build") |
| + } |
| + wantPost(t, options[4].submit(t, "like", "but calmer"), "revision", "2", "from", "task", "task", "tk1", "option_step", "stold", "option_index", "1", "note", "but calmer", "choice", "like") |
| + more := formsWith(forms, "more") |
| + if len(more) != 1 { |
| + t.Fatalf("More options forms %+v", more) |
| } |
| - // The decision's own answers: More options with the optional note, no |
| - // Build of its own, nothing that needs an option. |
| - if strings.Contains(html, `data-merge-choice="build"`) || strings.Contains(html, `data-merge-choice="like"`) || strings.Contains(html, `name="note" required`) { |
| - t.Fatalf("decision answers: %s", html) |
| + wantPost(t, more[0].submit(t, "more", "try a serif"), "revision", "2", "from", "task", "task", "tk1", "note", "try a serif", "choice", "more") |
| + decision := formsWith(forms, "again") |
| + if len(decision) != 1 || !slices.Equal(decision[0].Choices, []string{"again", "drop"}) || decision[0].Text["note"] { |
| + t.Fatalf("decision form %+v", decision) |
| } |
| - mustContain(t, html, `data-merge-choice="more"`, `data-merge-choice="again"`, `data-merge-choice="drop"`, `data-direction-note`) |
| - if strings.Contains(html, copyText("work.captures.earlier")) { |
| - t.Fatalf("the task page points at itself: %s", html) |
| + if len(formsWith(forms, "build")) != 6 || strings.Contains(page, copyText("work.captures.earlier")) { |
| + t.Fatalf("task page answers: %s", page) |
| } |
| } |
diff --git a/internal/equipo/static/equipo.css b/internal/equipo/static/equipo.css| index d1d46292..e0d4271b 100644 |
| --- a/internal/equipo/static/equipo.css |
| +++ b/internal/equipo/static/equipo.css |
| @@ -1255,11 +1255,23 @@ a[equipo-source]:hover, a[equipo-source]:focus-visible { color: var(--rst-text); |
| [equipo-capture-round] { display: grid; gap: var(--rst-sp-4); } |
| [equipo-capture-round] + [equipo-capture-round] { border-block-start: 1px solid var(--rst-line); padding-block-start: var(--rst-sp-3); } |
| [equipo-capture-option] [equipo-direction] { margin: 0 0 var(--rst-sp-2); max-inline-size: 65ch; font-size: var(--rst-fs-sm); color: var(--rst-text-muted); overflow-wrap: anywhere; white-space: pre-line; } |
| -[equipo-option-actions] { display: flex; flex-wrap: wrap; gap: var(--rst-sp-2); margin-block-start: var(--rst-sp-2); } |
| +[equipo-option-actions], [equipo-note-form] { display: flex; flex-wrap: wrap; align-items: center; gap: var(--rst-sp-2); margin-block-start: var(--rst-sp-2); } |
| +[equipo-option-actions] input[name="note"], [equipo-note-form] input[name="note"] { flex: 1 1 14rem; min-inline-size: 0; } |
| [equipo-captures] [data-earlier] { margin: 0; font-size: var(--rst-fs-sm); } |
| +/* The direction card's own answers in one row: More options with its |
| + note, Try again, Drop it. Try again (and an older card's Build with a |
| + note) is a details whose summary is the button; open, it becomes the |
| + card's bottom drawer, after the row's other answers. */ |
| +[equipo-direction-actions] { display: flex; flex-wrap: wrap; align-items: center; gap: var(--rst-sp-2); margin-block-start: var(--rst-sp-3); } |
| +[equipo-direction-actions] > [equipo-note-form] { flex: 1 1 20rem; margin: 0; } |
| +[equipo-direction-actions] > details > summary { list-style: none; } |
| +[equipo-direction-actions] > details > summary::-webkit-details-marker { display: none; } |
| +[equipo-direction-actions] > details > summary:focus-visible { outline: 2px solid var(--rst-focus-edge, var(--rst-accent)); outline-offset: 2px; } |
| +[equipo-direction-actions] > details[open] { order: 1; flex-basis: 100%; } |
| @container roster (max-width:500px) { |
| [equipo-option-actions] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); } |
| - [equipo-option-actions] [rst-btn] { min-block-size: 2.75rem; min-inline-size: 0; white-space: normal; text-align: center; justify-content: center; padding-inline: var(--rst-sp-2); } |
| + [equipo-option-actions] input[name="note"] { grid-column: 1 / -1; } |
| + :is([equipo-option-actions], [equipo-direction-actions]) [rst-btn] { min-block-size: 2.75rem; min-inline-size: 0; white-space: normal; text-align: center; justify-content: center; padding-inline: var(--rst-sp-2); } |
| } |
| [equipo-fetch-log] { margin: var(--rst-sp-2) 0 0; padding-inline-start: var(--rst-sp-5); display: grid; gap: var(--rst-sp-1); font-size: var(--rst-fs-xs); color: var(--rst-text-muted); font-variant-numeric: tabular-nums; } |
| [equipo-fetch-log] li { overflow-wrap: anywhere; } |
| @@ -2010,7 +2022,6 @@ label[equipo-sp-label] { cursor: pointer; } |
| [equipo-roster-card][data-done] > :not([equipo-card-done], [equipo-roster-task]) { display: none; } |
| [data-thread-open] { display: none; } |
| [data-roster-enhanced] [data-thread-open] { display: inline-flex; } |
| -[data-roster-enhanced] [data-direction-thread] > summary { display: none; } |
| [equipo-roster-report][data-slim] [equipo-roster-report-head] h3 { font-size: .9375rem; } |
| [equipo-roster-report][data-slim] [equipo-roster-facts] { display: flex; flex-wrap: wrap; gap: var(--rst-sp-2) var(--rst-sp-4); border: 0; padding: 0; } |
| [equipo-roster-report][data-slim] [equipo-roster-facts] > div { padding: 0; border: 0; } |
diff --git a/internal/equipo/templates/chat.html b/internal/equipo/templates/chat.html| index 40509daa..cb9e2660 100644 |
| --- a/internal/equipo/templates/chat.html |
| +++ b/internal/equipo/templates/chat.html |
| @@ -12,7 +12,7 @@ |
| <div equipo-thread-list role="log" aria-live="polite"><div equipo-thread-turn data-first><span equipo-thread-avatar>{{if eq .AuthorIcon "sparkles"}}{{template "roster-mark" .}}{{else}}{{icon .AuthorIcon}}{{end}}</span><div equipo-thread-bubble><div equipo-thread-who>{{.Author}}</div><div equipo-thread-text>{{.Line}}</div></div></div>{{template "roster-thread-turns" .}}</div> |
| {{if .Open}}{{if .Options}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}{{template "project-name-confirm" .}}{{range .Options}}<button rst-btn name="choice" value="{{.}}" type="submit">{{.}}</button>{{end}}</form>{{else}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-mini-composer><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}{{template "project-name-confirm" .}}<div equipo-mini-pill><textarea name="choice" required maxlength="2000" rows="1" aria-label="{{copy "chat.card.answer"}}" placeholder="{{copy "chat.card.answer"}}"></textarea><button type="submit" data-thread-send aria-label="{{copy "conversation.send_short"}}" data-busy-label="{{copy "roster.sending"}}">{{icon "arrow-up"}}</button></div></form>{{end}}{{else if not .Presentation.Waiting}}<form method="post" action="/conversation/cards/{{.ID}}/reply" data-card-form equipo-mini-composer><input type="hidden" name="request_id" value="{{.ReplyKey}}">{{template "card-job" .}}<div equipo-mini-pill><textarea name="body" required maxlength="2000" rows="1" aria-label="{{copy "roster.reply"}}" placeholder="{{copy "roster.reply"}}"></textarea><button type="submit" data-thread-send aria-label="{{copy "conversation.send_short"}}" data-busy-label="{{copy "roster.sending"}}">{{icon "arrow-up"}}</button></div></form>{{end}}</div> |
| {{else if eq .Kind "home"}}<p equipo-card-line>{{icon "folder"}}<span>{{.Line}}</span></p><form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}<button rst-btn="primary" name="choice" value="confirm" type="submit">{{copy "chat.card.confirm"}}</button></form> |
| -{{else if eq .Kind "direction"}}<p equipo-card-line>{{.Line}}</p>{{template "design-gallery" .Gallery}}{{if .Open}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}{{template "project-name-confirm" .}}{{range .Options}}{{if eq . "again"}}<button type="button" rst-btn data-thread-open>{{copy "chat.card.again"}}</button>{{else if or (eq . "like") (and (eq . "build") $.OptionBuild)}}{{else if eq . "more"}}<button rst-btn name="choice" value="more" type="submit" data-direction-choice="more" data-busy-label="{{copy "roster.sending"}}">{{copy "chat.card.more_options"}}</button>{{else}}<button rst-btn="{{if eq . "build"}}primary{{end}}" name="choice" value="{{.}}" type="submit" data-direction-choice="{{.}}"{{if eq . "build"}} data-busy-label="{{copy "roster.building"}}"{{end}}>{{copy (printf "chat.card.%s" .)}}</button>{{end}}{{end}}</form><details equipo-subchat data-direction-thread><summary equipo-thread-open>{{copy "chat.card.again"}}</summary><div equipo-thread-list role="log" aria-live="polite"><div equipo-thread-turn><span equipo-thread-avatar>{{icon .AuthorIcon}}</span><div equipo-thread-bubble><div equipo-thread-who>{{.Author}}</div><div equipo-thread-text>{{copy "roster.change"}}</div></div></div></div><form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-mini-composer><input type="hidden" name="revision" value="{{.Revision}}"><input type="hidden" name="choice" value="again">{{template "card-job" .}}<div equipo-mini-pill><textarea name="note" required maxlength="1000" rows="1" aria-label="{{copy "roster.reply"}}" placeholder="{{copy "roster.reply"}}"></textarea><button type="submit" data-thread-send data-direction-choice="again" aria-label="{{copy "conversation.send_short"}}" data-busy-label="{{copy "roster.sending"}}">{{icon "arrow-up"}}</button></div></form></details>{{else}}{{with .Note}}<p equipo-card-done role="status">{{.}}</p>{{end}}{{if .Presentation.Thread}}<div equipo-subchat data-roster-step="{{.Presentation.StepID}}"><div equipo-thread-list role="log" aria-live="polite">{{template "roster-thread-turns" .}}</div></div>{{end}}{{end}} |
| +{{else if eq .Kind "direction"}}<p equipo-card-line>{{.Line}}</p>{{template "design-gallery" .Gallery}}{{if .Open}}<div equipo-direction-actions>{{range .DirectionAnswers}}{{if eq . "build"}}{{if $.BuildNote}}<details equipo-subchat data-direction-build><summary rst-btn="primary">{{copy "chat.card.build"}}</summary><form method="post" action="/conversation/cards/{{$.ID}}/answer" data-card-form equipo-mini-composer><input type="hidden" name="revision" value="{{$.Revision}}">{{template "card-job" $}}<input type="hidden" name="choice" value="build"><div equipo-mini-pill><textarea name="note" required maxlength="1000" rows="1" aria-label="{{copy "chat.card.build_note"}}" placeholder="{{copy "chat.card.build_note"}}"></textarea><button type="submit" data-thread-send data-direction-choice="build" aria-label="{{copy "chat.card.build"}}" data-busy-label="{{copy "roster.building"}}">{{icon "arrow-up"}}</button></div></form></details>{{else}}<form method="post" action="/conversation/cards/{{$.ID}}/answer" data-card-form><input type="hidden" name="revision" value="{{$.Revision}}">{{template "card-job" $}}{{template "project-name-confirm" $}}<button rst-btn="primary" name="choice" value="build" type="submit" data-direction-choice="build" data-busy-label="{{copy "roster.building"}}">{{copy "chat.card.build"}}</button></form>{{end}}{{else if eq . "more"}}<form method="post" action="/conversation/cards/{{$.ID}}/answer" data-card-form equipo-note-form data-direction-more><input type="hidden" name="revision" value="{{$.Revision}}">{{template "card-job" $}}<input rst-input name="note" maxlength="1000" aria-label="{{copy "chat.card.option_note"}}" placeholder="{{copy "chat.card.option_note"}}"><button rst-btn name="choice" value="more" type="submit" data-direction-choice="more" data-busy-label="{{copy "roster.sending"}}">{{copy "chat.card.more_options"}}</button></form>{{else if eq . "again"}}<details equipo-subchat data-direction-thread><summary rst-btn>{{copy "chat.card.again"}}</summary><div equipo-thread-list role="log" aria-live="polite"><div equipo-thread-turn><span equipo-thread-avatar>{{icon $.AuthorIcon}}</span><div equipo-thread-bubble><div equipo-thread-who>{{$.Author}}</div><div equipo-thread-text>{{copy "roster.change"}}</div></div></div></div><form method="post" action="/conversation/cards/{{$.ID}}/answer" data-card-form equipo-mini-composer><input type="hidden" name="revision" value="{{$.Revision}}">{{template "card-job" $}}<input type="hidden" name="choice" value="again"><div equipo-mini-pill><textarea name="note" required maxlength="1000" rows="1" aria-label="{{copy "roster.reply"}}" placeholder="{{copy "roster.reply"}}"></textarea><button type="submit" data-thread-send data-direction-choice="again" aria-label="{{copy "conversation.send_short"}}" data-busy-label="{{copy "roster.sending"}}">{{icon "arrow-up"}}</button></div></form></details>{{else}}<form method="post" action="/conversation/cards/{{$.ID}}/answer" data-card-form><input type="hidden" name="revision" value="{{$.Revision}}">{{template "card-job" $}}<button rst-btn name="choice" value="{{.}}" type="submit" data-direction-choice="{{.}}">{{copy (printf "chat.card.%s" .)}}</button></form>{{end}}{{end}}</div>{{else}}{{with .Note}}<p equipo-card-done role="status">{{.}}</p>{{end}}{{if .Presentation.Thread}}<div equipo-subchat data-roster-step="{{.Presentation.StepID}}"><div equipo-thread-list role="log" aria-live="polite">{{template "roster-thread-turns" .}}</div></div>{{end}}{{end}} |
| {{else if eq .Kind "specialist"}}<p equipo-card-line>{{.Line}}</p>{{with .Specialist}}{{range .Capabilities}}<p equipo-card-note data-capability="{{.ID}}">{{.Words}}</p>{{end}}<p equipo-card-note data-specialist-brief>{{printf (copy "chat.card.specialist_brief") .Brief}}</p>{{end}}{{if .Open}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}{{template "project-name-confirm" .}}{{range .Options}}<button rst-btn="{{if eq . "add"}}primary{{end}}" name="choice" value="{{.}}" type="submit" data-specialist-choice="{{.}}">{{copy (printf "chat.card.%s" .)}}</button>{{end}}</form>{{else}}{{with .Note}}<p equipo-card-note>{{.}}</p>{{end}}{{end}} |
| {{else if eq .Kind "research_sources"}}<p equipo-card-line>{{.Line}}</p>{{with .Name}}<p equipo-card-note data-research-task>{{printf (copy "chat.card.research_for") .}}</p>{{end}}{{with .Research}}<p equipo-card-note data-research-question>{{printf (copy "chat.card.research_looks_for") .Question}}</p><ul equipo-card-list data-research-urls>{{range .URLs}}<li><code>{{.}}</code></li>{{end}}</ul>{{end}}{{if .Open}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}{{template "project-name-confirm" .}}{{range .Options}}<button rst-btn="{{if eq . "allow"}}primary{{end}}" name="choice" value="{{.}}" type="submit" data-research-choice="{{.}}">{{copy (printf "chat.card.%s" .)}}</button>{{end}}</form>{{else}}{{with .Note}}<p equipo-card-note>{{.}}</p>{{end}}{{end}} |
| {{else if eq .Kind "instance_inventory"}}<p equipo-card-line>{{.Line}}</p>{{with .Inventory}}<ul equipo-card-list data-instance-addresses>{{range .Addresses}}<li><code>{{.}}</code></li>{{end}}</ul>{{end}}{{if .Open}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}"><button rst-btn="primary" name="choice" value="confirm" type="submit" data-instance-confirm>{{copy "services.inventory.confirm"}}</button></form>{{end}}{{else if eq .Kind "research_inventory"}}<p equipo-card-line>{{.Line}}</p>{{with .Inventory}}<ul equipo-card-list data-research-addresses>{{range .Addresses}}<li><code>{{.}}</code></li>{{end}}</ul>{{end}}{{if .Open}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}<button rst-btn="primary" name="choice" value="confirm" type="submit" data-inventory-confirm>{{copy "chat.card.inventory_confirm"}}</button></form>{{else}}{{with .Note}}<p equipo-card-note>{{.}}</p>{{end}}{{end}} |
diff --git a/internal/equipo/templates/work_parts.html b/internal/equipo/templates/work_parts.html| index a8306cb0..79def70e 100644 |
| --- a/internal/equipo/templates/work_parts.html |
| +++ b/internal/equipo/templates/work_parts.html |
| @@ -37,7 +37,7 @@ |
| {{if $.Head}}{{template "mono" $t.Mono}}<div equipo-d-title><a href="/tasks/{{$t.ID}}">{{$t.Title}}</a><div equipo-quiet>{{template "placement-chip" $t}} · {{template "source" $t}}</div></div>{{end}} |
| <p equipo-d-why>{{.Why}}</p> |
| {{with .Ask}}<p equipo-d-ask{{if $t.Decision.SandboxHeld}} data-sandbox-held{{end}}>{{.}}</p>{{end}}{{if .Link}}<p equipo-quiet data-direction-line>{{with .LinkText}}{{.}} {{end}}<a equipo-link href="{{.Link}}" rel="noopener noreferrer" target="_blank" data-direction-link>{{.LinkLabel}}</a>{{with .AltLink}} <a equipo-link href="{{.}}" rel="noopener noreferrer" target="_blank" data-direction-branch>{{$t.Decision.AltLabel}}</a>{{end}}</p>{{end}}{{template "design-gallery" .Gallery}}{{with .Said}}<p equipo-quiet data-triage-said>{{.}}</p>{{end}}{{with .Failed}}<p equipo-quiet data-triage-failed>{{.}}</p>{{end}}{{with .Recommend}}<p equipo-quiet data-triage-recommend>{{.}}</p>{{end}} |
| -<div equipo-d-actions>{{if .CopyContinue}}<form method="post" action="/conversation/tasks/{{$t.ID}}/continue-without-copy"><input type="hidden" name="from" value="{{$.From}}"><button equipo-btn data-primary type="submit" data-copy-continue>{{copy "copy.continue"}}</button></form>{{end}}{{with .Card}}<form method="post" action="/conversation/cards/{{.ID}}/answer"><input type="hidden" name="revision" value="{{.Revision}}"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="task" value="{{$t.ID}}">{{if $.Task.Decision.Note}}{{if $.Task.Decision.BuildNote}}<textarea rst-input name="note" required maxlength="1000" rows="2" aria-label="{{copy "chat.card.direction_note_options"}}" placeholder="{{copy "chat.card.direction_note_options"}}" data-direction-note></textarea>{{else}}<textarea rst-input name="note" maxlength="1000" rows="2" aria-label="{{copy "chat.card.direction_note"}}" placeholder="{{copy "chat.card.direction_note"}}" data-direction-note></textarea>{{end}}{{end}}{{range $.Task.Decision.Choices}}<button equipo-btn{{if .Primary}} data-primary{{end}} type="submit" name="choice" value="{{.Value}}" data-merge-choice="{{.Value}}"{{if and $.Task.Decision.BuildNote (eq .Value "drop")}} formnovalidate{{end}}>{{.Label}}</button>{{end}}</form>{{end}}{{if .Fold}}<form method="post" action="/tasks/{{$t.ID}}/duplicate"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="of" value="{{$t.Dup.ID}}"><button equipo-btn data-primary type="submit" data-task-duplicate>{{copy "work.decide.fold"}}</button></form>{{end}}{{if .Recover}}<form method="post" action="/conversation/tasks/{{$t.ID}}/recover"><input type="hidden" name="from" value="{{$.From}}"><button equipo-btn data-primary type="submit" data-task-recover>{{copy "work.recover"}}</button></form>{{end}}{{with .Unsandboxed}}<details equipo-mach-confirm data-unsandboxed><summary equipo-btn>{{copy "work.decide.unsandboxed"}}</summary><div><p>{{.Warning}}</p><form method="post" action="/conversation/tasks/{{$t.ID}}/unsandboxed"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="step" value="{{.Step}}"><input type="hidden" name="attempt" value="{{.Attempt}}"><button equipo-btn data-danger type="submit" data-task-unsandboxed>{{copy "work.decide.unsandboxed_confirm"}}</button></form></div></details>{{end}}{{if .Retry}}<form method="post" action="/conversation/tasks/{{$t.ID}}/retry"><input type="hidden" name="from" value="{{$.From}}"><button {{if .Fold}}equipo-link{{else}}equipo-btn data-primary{{end}} type="submit" data-task-retry>{{copy "work.retry"}}</button></form>{{end}}{{if .Round}}<form method="post" action="/conversation/tasks/{{$t.ID}}/round"><input type="hidden" name="from" value="{{$.From}}"><button equipo-btn data-primary type="submit" data-task-round>{{copy "work.decide.round"}}</button></form>{{end}}{{if .Talk}}<a equipo-btn href="/conversation?about={{$t.ID}}" data-ask-coordinator>{{copy "work.decide.ask_coordinator"}}</a>{{end}}{{if .Cancel}}<form method="post" action="/conversation/tasks/{{$t.ID}}/cancel"><input type="hidden" name="from" value="{{$.From}}"><button equipo-link type="submit" data-task-cancel>{{copy "work.decide.cancel"}}</button></form>{{end}}{{with .Hint}}<span equipo-quiet>{{.}}</span>{{end}}<span equipo-d-quiet>{{if .AddClaude}}<a equipo-link href="{{.AddClaude}}" data-add-claude>{{.AddClaudeLabel}}</a>{{end}}{{if .Mac}}<a equipo-link href="/conversation/settings/machines/add" data-set-up-mac>{{copy "work.decide.mac_set_up"}}</a>{{end}}<a equipo-link href="/conversation?about={{$t.ID}}" data-ask-about>{{copy "work.ask_about"}}</a></span></div> |
| +<div equipo-d-actions>{{if .CopyContinue}}<form method="post" action="/conversation/tasks/{{$t.ID}}/continue-without-copy"><input type="hidden" name="from" value="{{$.From}}"><button equipo-btn data-primary type="submit" data-copy-continue>{{copy "copy.continue"}}</button></form>{{end}}{{if .More}}{{with .Card}}<form method="post" action="/conversation/cards/{{.ID}}/answer" equipo-note-form data-direction-more><input type="hidden" name="revision" value="{{.Revision}}"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="task" value="{{$t.ID}}"><input rst-input name="note" maxlength="1000" aria-label="{{copy "chat.card.option_note"}}" placeholder="{{copy "chat.card.option_note"}}"><button equipo-btn type="submit" name="choice" value="more" data-merge-choice="more">{{copy "chat.card.more_options"}}</button></form>{{end}}{{end}}{{with .Card}}<form method="post" action="/conversation/cards/{{.ID}}/answer"><input type="hidden" name="revision" value="{{.Revision}}"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="task" value="{{$t.ID}}">{{if $.Task.Decision.Note}}{{if $.Task.Decision.BuildNote}}<textarea rst-input name="note" required maxlength="1000" rows="2" aria-label="{{copy "chat.card.direction_note_options"}}" placeholder="{{copy "chat.card.direction_note_options"}}" data-direction-note></textarea>{{else}}<textarea rst-input name="note" maxlength="1000" rows="2" aria-label="{{copy "chat.card.direction_note"}}" placeholder="{{copy "chat.card.direction_note"}}" data-direction-note></textarea>{{end}}{{end}}{{range $.Task.Decision.Choices}}<button equipo-btn{{if .Primary}} data-primary{{end}} type="submit" name="choice" value="{{.Value}}" data-merge-choice="{{.Value}}"{{if and $.Task.Decision.BuildNote (eq .Value "drop")}} formnovalidate{{end}}>{{.Label}}</button>{{end}}</form>{{end}}{{if .Fold}}<form method="post" action="/tasks/{{$t.ID}}/duplicate"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="of" value="{{$t.Dup.ID}}"><button equipo-btn data-primary type="submit" data-task-duplicate>{{copy "work.decide.fold"}}</button></form>{{end}}{{if .Recover}}<form method="post" action="/conversation/tasks/{{$t.ID}}/recover"><input type="hidden" name="from" value="{{$.From}}"><button equipo-btn data-primary type="submit" data-task-recover>{{copy "work.recover"}}</button></form>{{end}}{{with .Unsandboxed}}<details equipo-mach-confirm data-unsandboxed><summary equipo-btn>{{copy "work.decide.unsandboxed"}}</summary><div><p>{{.Warning}}</p><form method="post" action="/conversation/tasks/{{$t.ID}}/unsandboxed"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="step" value="{{.Step}}"><input type="hidden" name="attempt" value="{{.Attempt}}"><button equipo-btn data-danger type="submit" data-task-unsandboxed>{{copy "work.decide.unsandboxed_confirm"}}</button></form></div></details>{{end}}{{if .Retry}}<form method="post" action="/conversation/tasks/{{$t.ID}}/retry"><input type="hidden" name="from" value="{{$.From}}"><button {{if .Fold}}equipo-link{{else}}equipo-btn data-primary{{end}} type="submit" data-task-retry>{{copy "work.retry"}}</button></form>{{end}}{{if .Round}}<form method="post" action="/conversation/tasks/{{$t.ID}}/round"><input type="hidden" name="from" value="{{$.From}}"><button equipo-btn data-primary type="submit" data-task-round>{{copy "work.decide.round"}}</button></form>{{end}}{{if .Talk}}<a equipo-btn href="/conversation?about={{$t.ID}}" data-ask-coordinator>{{copy "work.decide.ask_coordinator"}}</a>{{end}}{{if .Cancel}}<form method="post" action="/conversation/tasks/{{$t.ID}}/cancel"><input type="hidden" name="from" value="{{$.From}}"><button equipo-link type="submit" data-task-cancel>{{copy "work.decide.cancel"}}</button></form>{{end}}{{with .Hint}}<span equipo-quiet>{{.}}</span>{{end}}<span equipo-d-quiet>{{if .AddClaude}}<a equipo-link href="{{.AddClaude}}" data-add-claude>{{.AddClaudeLabel}}</a>{{end}}{{if .Mac}}<a equipo-link href="/conversation/settings/machines/add" data-set-up-mac>{{copy "work.decide.mac_set_up"}}</a>{{end}}<a equipo-link href="/conversation?about={{$t.ID}}" data-ask-about>{{copy "work.ask_about"}}</a></span></div> |
| </div>{{end}}{{end}} |
| {{define "star-toggle"}}{{$p := .P}}<form method="post" action="/projects/{{$p.ID}}/star" equipo-star-form><input type="hidden" name="starred" value="{{if $p.Star.On}}0{{else}}1{{end}}"><input type="hidden" name="from" value="{{.From}}"><button type="submit" equipo-star{{if $p.Star.On}} aria-pressed="true"{{if $p.Star.Auto}} data-auto{{end}}{{else}} aria-pressed="false"{{end}} aria-label="{{$p.Star.Label}}" title="{{$p.Star.Who}}" data-star-toggle>{{icon "star"}}</button></form>{{end}} |
| {{define "project-facts"}}{{with .StackLine}}<span>{{if $.PhoneStack}}{{icon "phone"}}{{else}}{{icon "code"}}{{end}}{{.}}</span>{{end}}{{with .Repos}}<span data-repos>{{icon "git"}}{{if eq (len .) 1}}{{copy "work.project.one_repo"}}{{else}}{{printf (copy "work.project.repos") (len .)}}{{end}}</span>{{end}}{{with .ChecksLine}}<span data-tone="{{if $.Checks.Here}}positive{{else}}warning{{end}}" data-checks-fact>{{if $.Checks.Here}}{{icon "check-circle"}}{{else}}{{icon "help-circle"}}{{end}}{{.}}</span>{{end}}{{end}} |
| @@ -57,4 +57,4 @@ |
| instance's task-file route only (the task page and the direction |
| card). On an open direction card each option is a form of its own: |
| Build this one and More like this name it by step and index. */}} |
| -{{define "design-gallery"}}{{with .}}{{$a := .Answer}}<div equipo-captures data-captures>{{range .Rounds}}<div equipo-capture-round data-round="{{.Step}}">{{range .Options}}<section equipo-capture-option data-option><h3>{{.Label}}</h3>{{with .Direction}}<p equipo-direction>{{.}}</p>{{end}}{{if .Captures}}<ul equipo-kept>{{range .Captures}}<li><a href="{{.Src}}" target="_blank" rel="noopener" data-capture="{{.ID}}"><figure><img src="{{.Src}}" alt="{{.Alt}}" width="{{.Width}}" height="{{.Height}}" loading="lazy" decoding="async"><figcaption>{{.Caption}}</figcaption></figure></a></li>{{end}}</ul>{{else}}<p equipo-quiet>{{copy "work.captures.none"}}</p>{{end}}{{if and $a .Step}}<form method="post" action="/conversation/cards/{{$a.CardID}}/answer"{{if not $a.Task}} data-card-form{{end}} equipo-option-actions><input type="hidden" name="revision" value="{{$a.Revision}}">{{with $a.From}}<input type="hidden" name="from" value="{{.}}">{{end}}{{with $a.Task}}<input type="hidden" name="task" value="{{.}}">{{end}}{{with $a.Job}}<input type="hidden" name="from" value="job"><input type="hidden" name="job" value="{{.}}">{{end}}<input type="hidden" name="option_step" value="{{.Step}}"><input type="hidden" name="option_index" value="{{.Index}}">{{if $a.Task}}<button equipo-btn data-primary type="submit" name="choice" value="build" data-option-choice="build">{{copy "chat.card.build"}}</button>{{if $a.Like}}<button equipo-btn type="submit" name="choice" value="like" data-option-choice="like">{{copy "chat.card.like"}}</button>{{end}}{{else}}<button rst-btn="primary" type="submit" name="choice" value="build" data-option-choice="build" data-busy-label="{{copy "roster.building"}}">{{copy "chat.card.build"}}</button>{{if $a.Like}}<button rst-btn type="submit" name="choice" value="like" data-option-choice="like" data-busy-label="{{copy "roster.sending"}}">{{copy "chat.card.like"}}</button>{{end}}{{end}}</form>{{end}}</section>{{end}}</div>{{end}}{{with .Earlier}}<p equipo-quiet data-earlier><a equipo-link href="{{.}}">{{copy "work.captures.earlier"}}</a></p>{{end}}</div>{{end}}{{end}} |
| +{{define "design-gallery"}}{{with .}}{{$a := .Answer}}<div equipo-captures data-captures>{{range .Rounds}}<div equipo-capture-round data-round="{{.Step}}">{{range .Options}}<section equipo-capture-option data-option><h3>{{.Label}}</h3>{{with .Direction}}<p equipo-direction>{{.}}</p>{{end}}{{if .Captures}}<ul equipo-kept>{{range .Captures}}<li><a href="{{.Src}}" target="_blank" rel="noopener" data-capture="{{.ID}}"><figure><img src="{{.Src}}" alt="{{.Alt}}" width="{{.Width}}" height="{{.Height}}" loading="lazy" decoding="async"><figcaption>{{.Caption}}</figcaption></figure></a></li>{{end}}</ul>{{else}}<p equipo-quiet>{{copy "work.captures.none"}}</p>{{end}}{{if and $a .Step}}<form method="post" action="/conversation/cards/{{$a.CardID}}/answer"{{if not $a.Task}} data-card-form{{end}} equipo-option-actions><input type="hidden" name="revision" value="{{$a.Revision}}">{{with $a.From}}<input type="hidden" name="from" value="{{.}}">{{end}}{{with $a.Task}}<input type="hidden" name="task" value="{{.}}">{{end}}{{with $a.Job}}<input type="hidden" name="from" value="job"><input type="hidden" name="job" value="{{.}}">{{end}}<input type="hidden" name="option_step" value="{{.Step}}"><input type="hidden" name="option_index" value="{{.Index}}"><input rst-input name="note" maxlength="1000" aria-label="{{copy "chat.card.option_note"}}" placeholder="{{copy "chat.card.option_note"}}">{{if $a.Task}}<button equipo-btn data-primary type="submit" name="choice" value="build" data-option-choice="build">{{copy "chat.card.build"}}</button>{{if $a.Like}}<button equipo-btn type="submit" name="choice" value="like" data-option-choice="like">{{copy "chat.card.like"}}</button>{{end}}{{else}}<button rst-btn="primary" type="submit" name="choice" value="build" data-option-choice="build" data-busy-label="{{copy "roster.building"}}">{{copy "chat.card.build"}}</button>{{if $a.Like}}<button rst-btn type="submit" name="choice" value="like" data-option-choice="like" data-busy-label="{{copy "roster.sending"}}">{{copy "chat.card.like"}}</button>{{end}}{{end}}</form>{{end}}</section>{{end}}</div>{{end}}{{with .Earlier}}<p equipo-quiet data-earlier><a equipo-link href="{{.}}">{{copy "work.captures.earlier"}}</a></p>{{end}}</div>{{end}}{{end}} |
diff --git a/internal/equipo/work_views.go b/internal/equipo/work_views.go| index df573c55..fc537965 100644 |
| --- a/internal/equipo/work_views.go |
| +++ b/internal/equipo/work_views.go |
| @@ -159,6 +159,9 @@ type decisionView struct { |
| // more than one, BuildNote: Build this needs the note too. |
| Gallery *designGallery |
| BuildNote bool |
| + // More: the card takes More options, a form of its own with an |
| + // optional note. |
| + More bool |
| // Recover settles a step stopped when its machine was removed. |
| Recover bool |
| // Mac: checks wait for a Mac; the card links setting one up. |
| @@ -825,7 +828,7 @@ func decisionOf(t wire.Task, v taskLine) *decisionView { |
| switch { |
| case o == wire.ChoiceLike, o == wire.ChoiceBuild && d.Gallery.perOption(): |
| case o == wire.ChoiceMore: |
| - d.Choices = append(d.Choices, decisionChoice{Value: o, Label: copyText("chat.card.more_options")}) |
| + d.More = true |
| default: |
| d.Choices = append(d.Choices, decisionChoice{Value: o, Label: copyText("chat.card." + o), Primary: o == wire.ChoiceBuild}) |
| } |