oficina / sheets Public

Clone
git clone https://amadan.net/oficina/sheets

Plain git — no account needed to clone.

Download

Download this file

1{{define "content"}}
2<header rst-page-header>
3<div rst-page-header-titles>
4<h1>Comments</h1>
5<p rst-page-header-sub>Notes about particular cells. Open threads first.</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{{if .Data.MayComment}}
15<form rst-form method="post" action="/sheets/{{.Data.Sheet.ID}}/comments">
16<div rst-field-row>
17<div rst-field>
18<label rst-field-label for="r">Row</label>
19<input rst-input="short" id="r" name="r" type="number" min="0" value="0" required>
20</div>
21<div rst-field>
22<label rst-field-label for="c">Column</label>
23<input rst-input="short" id="c" name="c" type="number" min="0" value="0" required>
24</div>
25</div>
26<div rst-field>
27<label rst-field-label for="body">Comment</label>
28<textarea rst-textarea id="body" name="body" rows="3" required></textarea>
29</div>
30<div rst-form-actions>
31<button rst-btn="primary" type="submit">Add comment</button>
32</div>
33</form>
34<p rst-field-help>Row and column are counted from zero, the way the grid
35addresses them: row 0, column 0 is A1.</p>
36{{end}}
37
38{{if .Data.Threads}}
39{{$sheet := .Data.Sheet}}
40{{$mayComment := .Data.MayComment}}
41{{range .Data.Threads}}
42<div rst-box>
43<div rst-box-head>
44<strong>{{.Ref}}</strong>
45{{if .Resolved}}<span rst-badge="neutral">resolved</span>{{end}}
46</div>
47{{/* Always open. Not rst-tblock: that is a toggle-block whose body
48 stays display:none until a switch in its head is checked, and a
49 comment has no switch, so its text never showed. */}}
50{{range .Entries}}
51<div data-comment>
52<p><strong>{{.Author}}</strong>
53<span rst-row-sub>{{.When.Format "2 Jan 2006, 15:04"}}</span></p>
54<p>{{.Body}}</p>
55</div>
56{{end}}
57{{if and $mayComment (not .Resolved)}}
58<div rst-box-foot>
59{{/* Resolving settles the whole cell's thread, because a thread is
60 the unit people think in and resolving one message of a
61 conversation says nothing useful. */}}
62<form method="post" action="/sheets/{{$sheet.ID}}/comments/resolve">
63<input type="hidden" name="r" value="{{.RowPos}}">
64<input type="hidden" name="c" value="{{.ColPos}}">
65<button rst-btn="ghost" type="submit">Resolve this thread</button>
66</form>
67</div>
68{{end}}
69</div>
70{{end}}
71{{else}}
72<div rst-empty>
73<p rst-empty-title>No comments yet</p>
74<p rst-empty-body>A comment is a note about one cell. It stays attached to
75that cell even when rows are inserted above it.</p>
76</div>
77{{end}}
78{{end}}
79