oficina / mapa Public

New page is one title field, its buttons under it

The Markdown textarea under the title was borderless and half the
window tall, so Create and Cancel sat about 500px under the field and
off the window. The text is written on the page once it exists.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev af14dc0bc7c3fe28feda13d8e0c5bd38e5399b16 parent 1e92f29
2 files changed, +20 −6
  • internal/mapa/templates/page_new.html +6 −2
  • internal/mapatest/browser_test.go +14 −4
diff --git a/internal/mapa/templates/page_new.html b/internal/mapa/templates/page_new.html
index b6289f7..fddc402 100644
--- a/internal/mapa/templates/page_new.html
+++ b/internal/mapa/templates/page_new.html
@@ -1,10 +1,14 @@
{{define "content"}}
{{template "back-nav" dict "Href" "/pages" "Label" "Pages"}}
{{template "page-header" dict "Title" "New page" "Sub" "A team page: everyone in the team can open it, and its title is the team's."}}
-<form rst-form method="post" action="{{.Data.Action}}" mapa-edit-form>
+{{/* One title field, as the sidebar's popover (level-up §4.7): the page
+ opens once it is made, and its text is written there. A body that
+ came with a refused POST rides along unseen, so nothing typed is
+ lost. */}}
+<form rst-form method="post" action="{{.Data.Action}}">
{{template "field-text" dict "Name" "title" "Label" "Title" "Value" .Data.Title "Error" .Data.Error "Required" true "Autofocus" true}}
{{with .Data.Taken}}<p mapa-meta><a href="{{.}}">Open the page with that title</a></p>{{end}}
-{{template "mapa-editor" dict "Body" .Data.Body}}
+{{with .Data.Body}}<input type="hidden" name="body" value="{{.}}">{{end}}
{{template "form-foot" dict "Submit" .Data.Label "CancelHref" "/pages" "CancelLabel" "Cancel"}}
</form>
{{end}}
diff --git a/internal/mapatest/browser_test.go b/internal/mapatest/browser_test.go
index c4691e4..678cae4 100644
--- a/internal/mapatest/browser_test.go
+++ b/internal/mapatest/browser_test.go
@@ -146,10 +146,7 @@ func walk(t *testing.T, rig *harness.Rig, store *mapa.Store, live bool) {
searchByPage(t, rig)
}
rig.Screen(`main input[name="title"]`, "create, offered")
- drive(t, rig,
- chromedp.SendKeys("textarea[mapa-editor]", "Acme is a customer."),
- press(save),
- )
+ createAcme(t, rig)
rig.Screen("header[mapa-page-head]", "the new page")
if !strings.Contains(text(t, rig, "#backlinks ~ *, [mapa-linked]"),
"November") {
@@ -162,6 +159,19 @@ func walk(t *testing.T, rig *harness.Rig, store *mapa.Store, live bool) {
historyAndRestore(t, rig)
}
+// createAcme creates the offered page, then writes its text. New page
+// is one title field (build note 77), so the text is written on the
+// page, here through Edit as Markdown, the floor.
+func createAcme(t *testing.T, rig *harness.Rig) {
+ t.Helper()
+ drive(t, rig, press(save), chromedp.WaitVisible("h1[mapa-title]"))
+ path := strings.TrimPrefix(read(t, rig, chromedp.Location()),
+ rig.Origin)
+ drive(t, rig, chromedp.Navigate(rig.Origin+path+"/edit"),
+ chromedp.SendKeys("textarea[mapa-editor]", "Acme is a customer."),
+ press(save))
+}
+
// writeToday writes today's note: in the page editor with scripts, and
// with them off through Edit as Markdown, the floor (level-up §6.10).
func writeToday(t *testing.T, rig *harness.Rig, live bool) {