| 1 | {{define "content"}} |
| 2 | <header rst-page-header> |
| 3 | <div rst-page-header-titles> |
| 4 | <h1>Share</h1> |
| 5 | <p rst-page-header-sub>Who can open this sheet, and what they can do with it.</p> |
| 6 | </div> |
| 7 | <a rst-btn="ghost" href="/sheets/{{.Data.Sheet.ID}}">Back to sheet</a> |
| 8 | </header> |
| 9 | |
| 10 | {{/* A fixed sentence chosen by code, in its tone (shared chrome spec §4); |
| 11 | role="alert" only for a submit that did not work. */}} |
| 12 | {{with .Data.Notice}}{{template "callout" (dict "Body" . "Tone" $.Data.NoticeTone "Alert" (eq $.Data.NoticeTone "negative"))}}{{end}} |
| 13 | |
| 14 | <form rst-form method="post" action="/sheets/{{.Data.Sheet.ID}}/share"> |
| 15 | <div rst-field-row> |
| 16 | <div rst-field> |
| 17 | <label rst-field-label for="address">Share with</label> |
| 18 | <input rst-input id="address" name="address" type="email" autocomplete="off" |
| 19 | placeholder="name@example.com" required> |
| 20 | </div> |
| 21 | <div rst-field> |
| 22 | <label rst-field-label for="role">Can</label> |
| 23 | <select rst-input id="role" name="role"> |
| 24 | {{range .Data.Roles}}<option value="{{.}}">{{.}}</option>{{end}} |
| 25 | </select> |
| 26 | </div> |
| 27 | <button rst-btn="primary" type="submit">Share</button> |
| 28 | </div> |
| 29 | </form> |
| 30 | |
| 31 | {{/* Spec §9.5, ruled: a guest grant puts a row in that person's |
| 32 | directory carrying the granting team's name. The behaviour is kept |
| 33 | and the obligation is to disclose it in words, here, rather than |
| 34 | leave it an emergent property nobody decided. */}} |
| 35 | {{template "callout" (dict "Body" "Sharing with somebody outside your team lets them see your team’s name, because this sheet then appears in their list alongside their own. They see nothing else about the team, and only the sheets you share." "Tone" "info")}} |
| 36 | |
| 37 | {{with .Data.NewLink}} |
| 38 | {{/* A warning, the tone rastrillo defines: rst-callout="warn" matched |
| 39 | no rule, so this rendered as an ordinary grey note. */}} |
| 40 | <div rst-callout rst-tone="warning"> |
| 41 | <span rst-callout-ic aria-hidden="true">{{icon "alert-triangle"}}</span> |
| 42 | <div rst-callout-body> |
| 43 | <p><strong>Your link.</strong> Copy it now: only its fingerprint is |
| 44 | stored, so this page cannot show it to you again.</p> |
| 45 | <p><code>{{.}}</code></p> |
| 46 | </div> |
| 47 | </div> |
| 48 | {{end}} |
| 49 | |
| 50 | <h2>Link sharing</h2> |
| 51 | {{/* rst-field-help, not rst-help: rst-help is a 28x28 icon badge and |
| 52 | swallows prose. See signin.html and the guard test in |
| 53 | internal/guardstest/markup_test.go. */}} |
| 54 | <p rst-field-help>Off unless you make one. Anybody holding the link can |
| 55 | read this sheet without an account — so it is exactly as private as the |
| 56 | people you send it to. A link can never edit.</p> |
| 57 | |
| 58 | <form rst-form method="post" action="/sheets/{{.Data.Sheet.ID}}/share/link"> |
| 59 | <div rst-field-row> |
| 60 | <div rst-field> |
| 61 | <label rst-field-label for="link-role">A link that can</label> |
| 62 | <select rst-input id="link-role" name="role"> |
| 63 | {{range .Data.LinkRoles}}<option value="{{.}}">{{.}}</option>{{end}} |
| 64 | </select> |
| 65 | </div> |
| 66 | <button rst-btn="primary" type="submit">Create a link</button> |
| 67 | </div> |
| 68 | </form> |
| 69 | |
| 70 | {{if .Data.Links}} |
| 71 | <ul rst-list data-share-list> |
| 72 | {{$sheet := .Data.Sheet}} |
| 73 | {{range .Data.Links}} |
| 74 | <li rst-lrow> |
| 75 | <div rst-row-main> |
| 76 | <span>A {{.Role}} link</span> |
| 77 | <span rst-row-sub>Made {{.Created.Format "2 Jan 2006, 15:04"}}</span> |
| 78 | </div> |
| 79 | <form method="post" action="/sheets/{{$sheet.ID}}/share/link/revoke"> |
| 80 | <input type="hidden" name="link" value="{{.ID}}"> |
| 81 | <button rst-btn="ghost" class="rst-danger" type="submit">Turn off</button> |
| 82 | </form> |
| 83 | </li> |
| 84 | {{end}} |
| 85 | </ul> |
| 86 | {{end}} |
| 87 | |
| 88 | <h2>Who has access</h2> |
| 89 | {{if .Data.People}} |
| 90 | <ul rst-list data-share-list> |
| 91 | {{$sheet := .Data.Sheet}} |
| 92 | {{range .Data.People}} |
| 93 | <li rst-lrow> |
| 94 | <div rst-row-main> |
| 95 | <span>{{.Member.Address}}</span> |
| 96 | <span rst-row-sub>{{.Role}}{{if eq .Member.TeamRole "guest"}} · guest{{end}}</span> |
| 97 | </div> |
| 98 | <form method="post" action="/sheets/{{$sheet.ID}}/share/revoke"> |
| 99 | <input type="hidden" name="member" value="{{.Member.ID}}"> |
| 100 | <button rst-btn="ghost" class="rst-danger" type="submit">Remove</button> |
| 101 | </form> |
| 102 | </li> |
| 103 | {{end}} |
| 104 | </ul> |
| 105 | {{else}} |
| 106 | <div rst-empty> |
| 107 | <p rst-empty-title>Nobody yet</p> |
| 108 | <p rst-empty-body>Only you can open this sheet.</p> |
| 109 | </div> |
| 110 | {{end}} |
| 111 | {{end}} |
| 112 | |