home · contact · privacy
Improve todo accounting.
[misc] / todo_templates / todo.html
1 {% extends 'base.html' %}
2
3
4
5 {% block css %}
6 tr.toplevel th { padding-right: 1em; }
7 td.center { text-align: center; }
8 tr.toplevel td, tr.toplevel th { padding-top: 1em; }
9 tr.lowlevel td, tr.lowlevel th { padding-top: 0em; }
10 tr.grey td { background-color: #cccccc; }
11 {% endblock %}
12
13
14
15 {% macro draw_todo(todo) %}<a href="?id={{todo.id_}}">{{todo.title}}</a>{% if todo.comment %}({{todo.comment|e}}){% endif %}{% endmacro %}
16
17
18
19 {% macro task_with_deps(task, indent) %}
20 {% for i in range(indent) %}&nbsp;&nbsp;{% endfor %}+ 
21 ({{task.title.then}})<br />
22 {% for t in task.deps %}
23 {{ task_with_deps(t, indent+1) }}
24 {% endfor %}
25 {% endmacro %}
26
27
28
29 {% macro todo_with_deps(todo, indent) %}
30 {% for i in range(indent) %}&nbsp;&nbsp;&nbsp;{% endfor %}{{ macros.doneness_string(todo) }} {{ draw_todo(todo) }}<br />
31 {% for dep in todo.deps %}
32 {% if dep.been_observed %}
33 {% for i in range(indent+1) %}&nbsp;&nbsp;&nbsp;{% endfor %}{{ macros.doneness_string(dep) }} ({{ draw_todo(dep) }})<br />
34 {% else %}
35 {{ todo_with_deps(dep, indent+1) }}
36 {% endif %}
37 {% endfor %}
38 {{ todo.observe() }}
39 {% endmacro %}
40
41
42
43 {% macro draw_deps(deps) %}
44 {% for t in deps %}
45 <tr class="lowlevel">
46 <td><input name="adopt_dep" type="checkbox" value="{{t.id_}}" checked/></td>
47 <td>{{ macros.doneness_string(t) }}</td>
48 <td>
49 {% if t.deps and not t.been_observed %}
50 <details>
51 <summary>{{ draw_todo(t) }}</summary>
52 {% for dep in t.deps %}
53 {{ todo_with_deps(dep, 0) }}
54 {% endfor %}
55 </details>
56 {% else %}
57 {{ draw_todo(t) }}
58 {% endif %}
59 </td>
60 {{ t.observe() }}
61 </tr>
62 {% endfor %}
63 {% endmacro %}
64
65
66
67 {% block content %}
68 <h3>edit todo</h3>
69
70 <form action="todo" method="POST">
71 <input type="hidden" name="todo_id" value="{{todo.id_}}" />
72 <input type="hidden" name="importance" step=0.1 size=8 value="{{ todo.importance }}" />
73 <table>
74
75 <tr class="toplevel">
76 <th>task</th>
77 <td colspan=2>
78 <a href="task?id={{ todo.task.id_ }}">{{ todo.task.title.then|e }}</a>
79 {% if todo.task.comment %}
80 <pre>{{ todo.task.comment|e }}</pre>
81 {% else %}
82 <br />&nbsp;
83 {% endif %}
84 </td>
85 </tr>
86
87 <tr class="toplevel">
88 <th>work</th>
89 <td>
90 <input type="checkbox" name="done" {% if todo.done %}checked{% endif %} {% if todo.deps_done == false %}disabled{% endif %}/>
91 done<br />
92 (all days: {{todo.all_days_effort}})<br />
93 (dependencies: {{todo.all_days_effort}})
94 </td>
95 <td>
96 <table>
97 <tr class="lowlevel">
98 <th>date</th>
99 <th>effort</th>
100 <th>delete</th>
101 </tr>
102 {% for date, effort in todo.efforts.items() %}
103 <tr class="lowlevel">
104 <td>
105 <input name="effort_date" type="hidden" value="{{date}}">{{date}}
106 </td>
107 <td>
108 <input type="number" name="effort" step=0.1 size=8 value="{{effort}}" placeholder="{{todo.default_effort}}" {% if todo.deps and effort %}disabled{% endif %} />
109 </td>
110 <td>
111 {% if not (todo.deps and effort) %}<input type="checkbox" name="delete_effort" value="{{date}}" />{% endif %}
112 </td>
113 </tr>
114 {% endfor %}
115 <tr class="lowlevel">
116 <td>
117 <input name="effort_date" size=10 value="">
118 </td>
119 <td>
120 <input type="number" name="effort" step=0.1 size=8 value="" {% if todo.deps %} disabled {% else %} placeholder="{{todo.default_effort}}" {% endif %} />
121 </td>
122 </tr>
123 </table>
124 </td>
125 </tr>
126
127 <tr class="toplevel">
128 <th>comment</th>
129 <td class="input" colspan=2>
130 <input name="comment" size=100 value="{{todo.comment|e}}" />
131 </td>
132 </tr>
133
134 <tr class="toplevel">
135 <th>tags</th>
136 <td colspan=2>
137 new: {{ macros.tagselection(submit_name='tag', selected_tags=todo.day_tags, all_tags=tags) }}
138 {% for tag in todo.task.tags.now | sort %}<select disabled><option>{{ tag }}</option></select>{% endfor %}
139 <br />
140 </td>
141 </tr>
142
143 {% if todo.dependers %}
144 <tr class="toplevel">
145 <th>dependers</th>
146 <td colspan=2>
147 <table>
148 {% for path in todo.shortened_depender_paths %}
149 <tr>
150 <td>
151 {% if not path[0] %}[…]<br />{% endif %}
152 {% for step in path %}
153 {% if step %}
154 {% if step.dependers %}➛ {% endif %}<a href="todo?id={{step.id_}}">{{step.title}}</a><br />
155 {% endif %}
156 {% endfor %}</td>
157 </tr>
158 {% endfor %}
159 </table>
160 </td>
161 </tr>
162 {% endif %}
163
164 <tr class="toplevel">
165 <th>sub-todos</th>
166 <td colspan=2>
167 <table>
168 <tr class="lowlevel"><td colspan=4>expected:</td></tr>
169 {% for dep_slot in dep_slots %}
170 {% if dep_slot.todos %}
171 {{ draw_deps(dep_slot.todos) }}
172 {% else %}
173 <tr class="lowlevel">
174 <td></td>
175 <td>[ ]</td>
176 <td>
177 {% if dep_slot.task.deps %} <details>
178 <summary>({{dep_slot.task.title.then}})</summary>
179 {% for task in dep_slot.task.deps %}
180 {{ task_with_deps(task, 1) }}
181 {% endfor %}
182 </details>
183 {% else %}
184 ({{dep_slot.task.title.then}})
185 {% endif %}
186 </td>
187 </tr>
188 {% endif %}
189 {% endfor %}
190 {% if additional_deps %}
191 <tr class="lowlevel"><td colspan=4>bonus:</td></tr>
192 {{ draw_deps(additional_deps) }}
193 {% endif %}
194 </table>
195 </td>
196 </tr>
197
198 <tr class="toplevel">
199 <th>suggestions</th>
200 <td colspan=2>
201 {% if todo.task.deps %}
202 <table>
203 {% for dep in todo.task.deps %}
204 <tr class="lowlevel">
205 <td><input name="birth_dep" type="checkbox" value="{{dep.id_}}"></td>
206 <td>make new</td>
207 <td><a href="task?id={{dep.id_}}">{{dep.title.then}}</a></td>
208 </tr>
209 {% for suggested_todo in suggested_todos[dep.id_] %}
210 <tr class="lowlevel">
211 <td><input name="adopt_dep" type="checkbox" value="{{suggested_todo.id_}}" /></td>
212 <td>adopt</td>
213 <td><a href="todo?id={{suggested_todo.id_}}">{{suggested_todo.day.date}}:{{suggested_todo.title}}{% if suggested_todo.deps %}:+{% endif %}</a></td>
214 <td>{{suggested_todo.comment}}</td>
215 </tr>
216 {% endfor %}
217 {% endfor %}
218 </table>
219 {% endif %}
220 </td>
221 </tr>
222
223 <tr class="toplevel">
224 <th>free add</th>
225 <td colspan=2>
226 make from task ({{ macros.parenthood_selector(parenthood) }}):<br />
227 <input name="birth_dep" list="tasks" size=100 autocomplete="off"><br />
228 adopt:<br />
229 <input name="adopt_dep" list="todos" size=100 autocomplete="off">
230 <datalist id="todos">
231 {% for t in filtered_todos %}
232 <option value="{{t.id_}}">
233 {{ macros.doneness_string(t, datalist_hack=true) }}
234 {{t.day.date}} {{t.title}} {{t.comment}}
235 {% if t.dependers %}
236 (dependers:
237 {% for path in t.depender_paths %}
238 {{ path[0].title }}{% if path|count > 1 %}➛{% endif %}{% if path|count > 3 %}…➛{% endif %}{% if path|count > 1 %}{{ path[-1].title }}{% endif %}
239 {% endfor %})
240 {% endif %}
241 </option>
242 {% endfor %}
243 </datalist>
244 </td>
245 </tr>
246 {{ macros.datalist_tasks(filtered_tasks) }}
247
248 <tr class="toplevel">
249 <th>as chain</th>
250 <td colspan=2>
251 <table>
252 {% for dep in todo.deps_chain %}
253 <tr class="lowlevel">
254 <td class="number">{{dep.deps_depth}}</td>
255 <td>{% if dep.deps_done %}{{ macros.doneness_string(dep) }}{% endif %}</td>
256 <td>{{ draw_todo(dep) }}</td>
257 </tr>
258 {% endfor %}
259 </table>
260 </td>
261 </tr>
262
263 </table>
264 <input id="update_button" class="update" name="update" type="submit" value="update" />
265 <div class="delete">
266 <input class="delete" type="submit" name="delete" value="delete" />
267 </div>
268 </form>
269 {% endblock %}