Files
jcoffey-dev 5d628689c1
ci / editor-ui (pull_request) Successful in 30s
ci / go (pull_request) Successful in 1m56s
Three packs: contact forms, tables and a changelog
contact-forms brings a quote request, a booking request and a mailing list
sign-up, and a Contact form section that shows any form beside an email,
phone, address and a note. tables shows a table from a spreadsheet saved as
CSV (or YAML or JSON) in data/, with a caption, row headings, numbers on the
right, and sideways scrolling on phones. changelog gives a page per release,
every release on one page, a feed, a What's new section and a latest-release
partial; notes grouped under Keep a Changelog headings show as labels.

To make them possible:
- data/*.csv files load as rows of cells, for the data function and the
  editor's data picker.
- Packs can bring forms (forms/<name>.yaml). A form is copied once and is the
  site's own from then on: upgrades and removal leave it, and a site's own
  form of that name is kept. A pack's form must send to a placeholder address
  (example.org and the other RFC 2606 names) and can't set Turnstile, so a
  pack can't route a site's submissions or add another site's script.
- A new check warning, form-placeholder, for forms that still send to or show
  a placeholder address (the starter's contact form does until it's set).
- A form's success path can no longer start with // or /\, which browsers
  treat as another site.
2026-10-14 12:58:23 -07:00

32 lines
1.7 KiB
HTML

{{/* section
label: Contact form
about: A form from forms/ beside your email, phone, address and a note, such as when you answer.
fields:
- { name: heading, type: text, default: Get in touch }
- { name: intro, type: markdown }
- { name: form, type: text, default: contact, required: true, help: "The form's name: a file in forms/, such as contact, quote, booking or signup." }
- { name: email, type: text, label: Email }
- { name: phone, type: text, label: Phone }
- { name: address, type: textarea, label: Address }
- { name: note, type: markdown, label: Beside the form, help: "Opening hours, how soon you answer, or anything else." }
*/}}
{{ $d := .Data }}{{ $side := or $d.email $d.phone $d.address $d.note }}
<link rel="stylesheet" href="{{ asset "packs/contact-forms/contact-forms.css" }}">
<section class="block contact-form">
<div class="wrap">
{{ with $d.heading }}<h2>{{ . }}</h2>{{ end }}
{{ with $d.intro }}<div class="intro">{{ markdownify . }}</div>{{ end }}
<div class="cf-grid{{ if not $side }} cf-solo{{ end }}">
<div class="cf-form">{{ form (default "contact" $d.form) }}</div>
{{ if $side }}
<aside class="cf-details">
{{ with $d.email }}<div class="cf-line"><span class="cf-label">Email</span>{{ emailOff }}<a href="mailto:{{ . }}">{{ . }}</a>{{ emailOffEnd }}</div>{{ end }}
{{ with $d.phone }}<div class="cf-line"><span class="cf-label">Phone</span><a href="tel:{{ replace " " "" . }}">{{ . }}</a></div>{{ end }}
{{ with $d.address }}<div class="cf-line"><span class="cf-label">Address</span><address>{{ . }}</address></div>{{ end }}
{{ with $d.note }}<div class="cf-note">{{ markdownify . }}</div>{{ end }}
</aside>
{{ end }}
</div>
</div>
</section>