| 1 | {{define "title"}}Add a field · Fichas{{end}} |
| 2 | {{define "content"}} |
| 3 | <header fichas-appbar> |
| 4 | <h1 fichas-appbar-title>Add a field <span>to {{.Type.Plural}}</span></h1> |
| 5 | </header> |
| 6 | <form method="post" action="/t/{{.TypeKey}}/fields" fichas-form rst-stack> |
| 7 | {{template "field" (dict "ID" "label" "Name" "label" "Label" "Field name" "Value" (index .Form "label") "Placeholder" "e.g. Contract value" "Required" true "Autofocus" true "Error" (errFor .Errors "label"))}} |
| 8 | {{template "choice-field" (dict "Legend" "What kind of value" "Name" "kind" "Options" (list |
| 9 | (dict "Value" "text" "Title" "Text" "Desc" "A name, a reference, a short note." "Checked" (eq (index .Form "kind") "text")) |
| 10 | (dict "Value" "longtext" "Title" "Long text" "Desc" "Paragraphs: notes, a description." "Checked" (eq (index .Form "kind") "longtext")) |
| 11 | (dict "Value" "number" "Title" "Number" "Desc" "An amount or a count; sorts as a number." "Checked" (eq (index .Form "kind") "number")) |
| 12 | (dict "Value" "date" "Title" "Date" "Desc" "A day: a deadline, a renewal, a next step." "Checked" (eq (index .Form "kind") "date")) |
| 13 | (dict "Value" "enum" "Title" "Choice" "Desc" "One of a list you set — like Stage." "Checked" (eq (index .Form "kind") "enum")) |
| 14 | (dict "Value" "email" "Title" "Email" "Desc" "An email address, opened in your mail app." "Checked" (eq (index .Form "kind") "email")) |
| 15 | (dict "Value" "phone" "Title" "Phone" "Desc" "A phone number, tappable to call." "Checked" (eq (index .Form "kind") "phone")) |
| 16 | (dict "Value" "url" "Title" "Web address" "Desc" "A website or a link, with or without https://." "Checked" (eq (index .Form "kind") "url"))))}} |
| 17 | {{with errFor .Errors "kind"}}<p rst-field-error role="alert">{{.}}</p>{{end}} |
| 18 | {{/* Only for a Choice: hidden by CSS (:has) while another kind is |
| 19 | picked, so it needs no script; a browser without :has shows it. */}} |
| 20 | <div fichas-choice-options> |
| 21 | {{template "field-textarea" (dict "Name" "options" "Label" "The choices" "Value" (index .Form "options") "Rows" 5 "Hint" "One per line, in the order they go — like Lead, Contacted, Won." "Error" (errFor .Errors "options"))}} |
| 22 | </div> |
| 23 | <details fichas-advanced{{if errFor .Errors "tier"}} open{{end}}> |
| 24 | <summary>Advanced</summary> |
| 25 | {{template "choice-field" (dict "Legend" "Checking for duplicates" "Name" "tier" "Options" (list |
| 26 | (dict "Value" "auto" "Title" "As the kind suggests" "Desc" "Emails, phone numbers and web addresses can be checked for duplicates; everything else stays private. Right for almost everything." "Checked" (eq (index .Form "tier") "auto")) |
| 27 | (dict "Value" "sealed" "Title" "Keep it private" "Desc" "Encrypted, readable only when a card is open. Still searched, sorted and grouped inside Fichas." "Checked" (eq (index .Form "tier") "sealed")) |
| 28 | (dict "Value" "print" "Title" "Findable by exact match" "Desc" "Fichas can spot two cards with the same value without opening them. Never for a Choice or long text." "Checked" (eq (index .Form "tier") "print"))))}} |
| 29 | {{with errFor .Errors "tier"}}<p rst-field-error role="alert">{{.}}</p>{{end}} |
| 30 | </details> |
| 31 | <p fichas-meta>A field's kind can't be changed once it's added; its name, and a Choice's options, always can.</p> |
| 32 | {{template "form-foot" (dict "Submit" "Add field" "CancelHref" (printf "/t/%s/fields" .TypeKey) "CancelLabel" "Cancel")}} |
| 33 | </form> |
| 34 | {{end}} |
| 35 | |