| 1 | {{/* quick add — one sentence becomes an event. |
| 2 | |
| 3 | The disclosure is a <details>, so it opens with NO SCRIPT. That is |
| 4 | the whole reason it is not a button and a class: the popover is an |
| 5 | affordance, and AGENTS.md says no affordance may require script. |
| 6 | |
| 7 | The form is an ordinary POST to /events/quick. With script, the |
| 8 | pane below has already shown what the server will do, so submitting |
| 9 | confirms it; without script the event page is the confirmation, one |
| 10 | click from Edit. Nothing here needs JavaScript to work — the live |
| 11 | pane is the only thing script adds. |
| 12 | |
| 13 | name="rst-shell-menu" is deliberately NOT set: this is not one of |
| 14 | the shell's exclusive disclosures, and joining that group would let |
| 15 | opening the account menu close a half-typed sentence. */}} |
| 16 | {{define "quickadd"}} |
| 17 | <details cal-quick> |
| 18 | <summary cal-quick-summary> |
| 19 | {{icon "plus"}} |
| 20 | <span>Quick add</span> |
| 21 | </summary> |
| 22 | |
| 23 | <form cal-quick-form method="post" action="/events/quick"> |
| 24 | <label class="rst-sr-only" for="cal-quick-text"> |
| 25 | Describe the event in your own words |
| 26 | </label> |
| 27 | <textarea id="cal-quick-text" name="text" rows="2" |
| 28 | cal-quick-text |
| 29 | placeholder="Meeting with Dermot Lacey at 3pm in McCloskeys" |
| 30 | autocomplete="off"></textarea> |
| 31 | |
| 32 | {{/* The pane. Rendered here for the scriptless first paint (empty, |
| 33 | explaining itself) and REPLACED wholesale by the same template |
| 34 | rendered server-side as a fragment when script is on — one |
| 35 | template, so the two paths cannot drift into disagreeing. */}} |
| 36 | <div id="cal-quick-pane" cal-quick-pane aria-live="polite"> |
| 37 | {{template "quickpane" .QuickPane}} |
| 38 | </div> |
| 39 | |
| 40 | <div cal-quick-actions> |
| 41 | <button rst-btn="primary" type="submit">Add</button> |
| 42 | {{/* hidden until quickadd.js reveals it: with no script, Enter |
| 43 | inserts a newline like any other textarea, and a page that |
| 44 | advertised a shortcut it does not have would be lying. */}} |
| 45 | <span cal-quick-key hidden>or press Enter</span> |
| 46 | <span cal-quick-hint>Times, dates, durations, places and email addresses are read from the sentence.</span> |
| 47 | </div> |
| 48 | </form> |
| 49 | </details> |
| 50 | {{end}} |
| 51 | |