| 1 | {{/* The import page (import.go). One ordinary multipart form, which works |
| 2 | with no script at all; the Google Drive chooser (estilo's |
| 3 | googleimport), when this instance configures it, exports the chosen |
| 4 | file in the browser and submits it through this same form's file |
| 5 | input, so both ways in reach one route, one origin check and one |
| 6 | server path. The chooser's script is linked only here and only then. */}} |
| 7 | {{define "pagehead"}}{{if .GoogleScript}}<script type="module" src="{{.GoogleScript}}"></script>{{end}}{{end}} |
| 8 | {{define "content"}}<style> |
| 9 | /* The page is Fiesta's stack (rst-stack), which spaces its blocks. */ |
| 10 | [docs-import] { |
| 11 | max-inline-size: 44rem; |
| 12 | } |
| 13 | /* The callout is the wrapper's only child: the stack spaces the |
| 14 | wrapper, so the callout's own margin would add to it. */ |
| 15 | [docs-import-error] > [rst-callout] { |
| 16 | margin-block: 0; |
| 17 | } |
| 18 | [docs-import-field] { |
| 19 | display: flex; |
| 20 | flex-direction: column; |
| 21 | gap: var(--rst-sp-2); |
| 22 | } |
| 23 | [docs-import-field] input[type="file"] { |
| 24 | max-inline-size: 100%; |
| 25 | min-block-size: 24px; |
| 26 | font-size: max(1rem, 1em); |
| 27 | } |
| 28 | </style> |
| 29 | <article rst-stack docs-import> |
| 30 | <header rst-page-header> |
| 31 | <div rst-page-header-titles> |
| 32 | <h1>{{.Title}}</h1> |
| 33 | <p rst-muted>{{.Intro}}</p> |
| 34 | </div> |
| 35 | </header> |
| 36 | {{if .Error}}<div docs-import-error role="alert">{{template "callout" (dict "Body" .Error "Tone" "negative")}}</div>{{end}} |
| 37 | <p docs-import-fidelity>{{.Fidelity}}</p> |
| 38 | <form rst-form id="docs-import-form" method="post" action="/import" enctype="multipart/form-data"> |
| 39 | <input type="hidden" name="creation_token" value="{{.Token}}"> |
| 40 | <div docs-import-field> |
| 41 | <label for="docs-import-file">{{.FileLabel}}</label> |
| 42 | <input id="docs-import-file" type="file" name="file" required |
| 43 | accept=".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document"> |
| 44 | </div> |
| 45 | <div rst-form-foot><button rst-btn="primary" type="submit">{{.Submit}}</button></div> |
| 46 | </form> |
| 47 | {{if .Google.Enabled}}{{/* estilo's Google Drive chooser brings markup |
| 48 | and no stylesheet, so its paragraphs kept the browser's 1em |
| 49 | margins around the Choose button the script reveals: spaced here |
| 50 | as a column on the scale, the buttons at their own width, until |
| 51 | estilo spaces it itself. Drawn only with the chooser, so a page |
| 52 | without it names nothing of Google (TestImportPagePolicy). */}}<style> |
| 53 | [estilo-google-import] { |
| 54 | display: flex; |
| 55 | flex-direction: column; |
| 56 | align-items: flex-start; |
| 57 | gap: var(--rst-sp-3); |
| 58 | } |
| 59 | [estilo-google-import] p { |
| 60 | margin: 0; |
| 61 | } |
| 62 | </style> |
| 63 | <div rst-section>{{template "estilo-google-import" .Google}}</div>{{end}} |
| 64 | </article> |
| 65 | {{end}} |
| 66 | |