| 1 | {{/* share — GET /d/{sqid}/share, a deck's read-only links. |
| 2 | |
| 3 | The screen is three things in the order they matter: the link that |
| 4 | was just made (once, and never again), what a link costs to hand |
| 5 | out, and the links that already exist with the one button that |
| 6 | turns each of them off. |
| 7 | |
| 8 | The new link is a callout plus a read-only field rather than a line |
| 9 | of prose, because the whole job of this screen at that moment is |
| 10 | "select this and copy it", and a field is the thing a browser lets |
| 11 | you select cleanly with no script at all. */}} |
| 12 | {{define "content"}} |
| 13 | {{template "back-nav" dict "Href" .BackHref "Label" .BackLabel}} |
| 14 | {{template "page-header" dict "Title" .Title}} |
| 15 | |
| 16 | {{if .NewURL}} |
| 17 | <div rst-box> |
| 18 | {{template "callout" dict "Tone" "warning" "Title" .NewTitle "Body" .NewHint}} |
| 19 | {{/* Hand-written rather than {{template "field-text"}} for one |
| 20 | attribute: readonly, which that partial's contract does not |
| 21 | carry. The markup is field-text's own, attribute for attribute, |
| 22 | so the control still looks and reads like every other field on |
| 23 | every other screen — and the day readonly joins the partial, |
| 24 | this becomes a one-line call again. */}} |
| 25 | <div rst-field> |
| 26 | <label rst-field-label for="share-url">{{.NewLabel}}</label> |
| 27 | <input rst-input id="share-url" name="share-url" type="text" value="{{.NewURL}}" |
| 28 | readonly aria-describedby="share-url-hint"> |
| 29 | <small rst-field-hint id="share-url-hint">{{.CopyHint}}</small> |
| 30 | </div> |
| 31 | </div> |
| 32 | {{end}} |
| 33 | |
| 34 | <div rst-box> |
| 35 | <p>{{.Lead}}</p> |
| 36 | </div> |
| 37 | |
| 38 | {{template "callout" dict "Tone" "warning" "Title" .WarningTitle "Body" .Warning}} |
| 39 | |
| 40 | {{if .Links}} |
| 41 | <div rst-list> |
| 42 | {{range .Links}} |
| 43 | <div rst-row> |
| 44 | <span rst-row-main> |
| 45 | {{.Created}} |
| 46 | <small rst-row-sub>{{.Views}}</small> |
| 47 | </span> |
| 48 | {{template "status-pill" dict "Tone" .StatusTone "Label" .StatusLabel}} |
| 49 | {{if not .Revoked}} |
| 50 | {{/* aria-label, because "Revoke" repeated down a list does not say |
| 51 | which link it revokes, and a link's only name is when it was |
| 52 | made — agents.html's row, with this list's own handle. */}} |
| 53 | <form method="post" action="{{.RevokeAction}}"> |
| 54 | <button rst-btn="ghost" class="rst-danger" type="submit" |
| 55 | aria-label="{{.RevokeAria}}">{{.RevokeLabel}}</button> |
| 56 | </form> |
| 57 | {{end}} |
| 58 | </div> |
| 59 | {{end}} |
| 60 | </div> |
| 61 | {{else}} |
| 62 | <div rst-box> |
| 63 | {{template "empty-state" dict "Title" .EmptyTitle "Body" .EmptyBody}} |
| 64 | </div> |
| 65 | {{end}} |
| 66 | |
| 67 | <form method="post" action="{{.Action}}" rst-form> |
| 68 | <button rst-btn="primary lg" type="submit">{{.CreateLabel}}</button> |
| 69 | </form> |
| 70 | {{end}} |
| 71 | |