home · contact · privacy
Slightly improve and re-organize Condition tests.
[plomtask] / templates / day.html
1 {% extends '_base.html' %}
2 {% import '_macros.html' as macros %}
3
4
5
6 {% block css %}
7 th {
8   border: 1px solid black;
9 }
10 td.cond_line {
11   padding: 0;
12   border-top: 1px solid white;
13 }
14 td.cond_0 {
15   background-color: #bfbfbf;
16 }
17 td.cond_1 {
18   background-color: #dfdfdf;
19 }
20 td.cond_2 {
21   background-color: fffff;
22 }
23 td.cond_shrink {
24   max-width: 0px;
25   white-space: nowrap;
26   overflow: hidden;
27   text-overflow: clip;
28 }
29 td.todo_line {
30   border-bottom: 1px solid #bfbfbf;
31   height: 1.7em;
32 }
33 tr.inactive > td.todo_line {
34   background-color: #bfbfbf;
35   border-bottom: 1px solid white;
36 }
37 tr.hidden_undone > td, tr.hidden_undone a {
38   color: #9f9f9f;
39 }
40 td.left_border {
41   border-left: 1px solid black;
42 }
43 td.right_border {
44   border-right: 1px solid black;
45 }
46 input.ablers {
47   width: 50em;
48 }
49 {% endblock %}
50
51
52
53 {% macro show_node_undone(node, indent) %}
54 {% if not node.todo.is_done %}
55 <tr {% if node.seen or not node.todo.is_doable %}class="inactive"{% endif %}>
56 {% if not node.seen %}
57 <input type="hidden" name="todo_id" value="{{node.todo.id_}}" />
58 {% endif %}
59
60 {% for condition in conditions_present %}
61 {% if condition in node.todo.conditions and not condition.is_active %}
62 <td class="cond_line cond_{{loop.index0 % 3}}">
63 +&gt;
64 {% elif condition in node.todo.blockers and condition.is_active %}
65 <td class="cond_line cond_{{loop.index0 % 3}}">
66 -&gt;
67 {% else %}
68 <td class="cond_line cond_{{loop.index0 % 3}} cond_shrink">
69 |
70 {% endif %}
71 </td>
72 {% endfor %}
73
74 {% if node.seen %}
75 <td class="todo_line left_border"></td>
76 <td class="todo_line">{% if node.todo.effort %}{{ node.todo.effort }}{% endif %}</td>
77 {% else %}
78 <td class="todo_line left_border"><input name="done" type="checkbox" value="{{node.todo.id_}}" {% if not node.todo.is_doable %}disabled{% endif %}/></td>
79 <td class="todo_line"><input name="effort" type="number" step=0.1 placeholder={{node.todo.effort_then}} value={{node.todo.effort}} /></td>
80 {% endif %}
81 <td class="todo_line right_border">
82 {% for i in range(indent) %}&nbsp; &nbsp; {% endfor %} +
83 {% if node.seen %}({% endif %}<a href="todo?id={{node.todo.id_}}">{{node.todo.title_then|e}}</a>{% if node.seen %}){% endif %}
84 </td>
85
86 {% for condition in conditions_present|reverse %}
87 {% if condition in node.todo.enables %}
88 <td class="cond_line cond_{{(conditions_present|length - loop.index) % 3}}">
89 +&gt;
90 {% elif condition in node.todo.disables %}
91 <td class="cond_line cond_{{(conditions_present|length - loop.index) % 3}}">
92 -&gt;
93 {% else %}
94 <td class="cond_line cond_{{(conditions_present|length - loop.index) % 3}} cond_shrink">
95 &nbsp;|
96 {% endif %}
97 </td>
98 {% endfor %}
99
100 <td colspan=2>
101 {% if node.seen %}
102 {{node.todo.comment|e}}
103 {% else %}
104 <input name="comment" type="text" value="{{node.todo.comment|e}}" />
105 {% endif %}
106 </td>
107
108 </tr>
109 {% endif %}
110
111 {% if not node.seen %}
112 {% for child in node.children %}
113 {{ show_node_undone(child, indent+1) }}
114 {% endfor %}
115 {% endif %}
116
117 {% endmacro %}
118
119
120
121 {% macro show_node_done(node, indent, path) %}
122 {% if node.todo.has_doneness_in_path %}
123 <tr{% if not node.todo.is_done %} class="hidden_undone"{% endif %}>
124 <td class="number">{{ '{:4.1f}'.format(node.todo.performed_effort) }}</td>
125 <td class="number">{{ '{:4.1f}'.format(node.todo.tree_effort) }}</td>
126 <td>
127 {% for i in range(indent) %}&nbsp; &nbsp; {% endfor %} +
128 {% if not node.todo.is_done %}({% endif %}{% if node.seen %}[{% endif %}<a href="todo?id={{node.todo.id_}}">{{node.todo.title_then|e}}</a>{% if node.seen %}]{% endif %}{% if not node.todo.is_done %}){% endif %}{% if node.todo.comment %} · {{node.todo.comment|e}}{% endif %}</td>
129 </tr>
130 {% if not node.seen %}
131 {% for child in node.children %}
132 {{ show_node_done(child, indent+1) }}
133 {% endfor %}
134 {% endif %}
135 {% endif %}
136 {% endmacro %}
137
138
139
140 {% block content %}
141 <h3>{{day.date}} / {{day.weekday}} ({{day.total_effort|round(1)}})</h3>
142 <p>
143 <a href="day?date={{day.prev_date}}">prev</a> | <a href="day?date={{day.next_date}}">next</a>
144 </p>
145 <form action="day?date={{day.date}}" method="POST">
146
147 <p>
148 comment:
149 <input name="day_comment" type="text" value="{{day.comment|e}}" />
150 <input type="submit" value="OK" /></td>
151 </p>
152
153 <h4>to do</h4>
154
155 <p>
156 add: <input type="text" name="new_todo" list="processes">
157 </p>
158 <p>
159 make new todos
160 <select name="make_type">
161 <option value="full">with</option>
162 <option value="empty"{% if make_type == "empty" %}selected {% endif %}>without</option>
163 </select>
164 descendants (i.e. adopt where possible, otherwise create anew)
165 </p>
166
167 <table>
168
169 <tr>
170 <th colspan={{ conditions_present|length + 3 + conditions_present|length }}>conditions</th>
171 <th>add enabler</th>
172 <th>add disabler</th>
173 </tr>
174
175 {% for condition in conditions_present %}
176 {% set outer_loop = loop %}
177 <tr>
178
179 {% for _ in conditions_present %}
180 {% if outer_loop.index > loop.index %}
181 <td class="cond_line cond_{{loop.index0 % 3}} cond_shrink">|
182 {% elif outer_loop.index < loop.index %}
183 <td class="cond_line cond_{{outer_loop.index0 % 3}}">
184 {% else %}
185 <td class="cond_line cond_{{outer_loop.index0 % 3}} cond_shrink">/
186 {% endif %}
187 </td>
188 {% endfor %}
189
190 <td class="cond_line cond_{{loop.index0 % 3}}"><input type="checkbox" disabled{% if condition.is_active %} checked{% endif %}></td>
191 <td colspan=2 class="cond_line cond_{{loop.index0 % 3}}"><a href="condition?id={{condition.id_}}">{{condition.title.at(day.date)|e}}</a></td>
192
193 {% for _ in conditions_present %}
194 {% if outer_loop.index0 + loop.index < conditions_present|length %}
195 <td class="cond_line cond_{{outer_loop.index0 % 3}}">
196 {% elif outer_loop.index0 + loop.index > conditions_present|length %}
197 <td class="cond_line cond_{{(conditions_present|length - loop.index) % 3}} cond_shrink">&nbsp;|
198 {% else %}
199 <td class="cond_line cond_{{outer_loop.index0 % 3}} cond_shrink">&nbsp;\
200 {% endif %}
201 {% endfor %}
202
203 {% set list_name = "todos_for_%s"|format(condition.id_) %}
204 <td><input class="ablers" type="text" name="new_todo" list="{{list_name}}" autocomplete="off" /></td>
205 {{ macros.datalist_of_titles(list_name, enablers_for[condition.id_]) }}
206 </td>
207 {% set list_name = "todos_against_%s"|format(condition.id_) %}
208 <td><input class="ablers" type="text" name="new_todo" list="{{list_name}}" autocomplete="off" /></td>
209 {{ macros.datalist_of_titles(list_name, disablers_for[condition.id_]) }}
210 </td>
211 </tr>
212 {% endfor %}
213
214 <tr>
215 {% for condition in conditions_present %}
216 <td class="cond_line cond_{{loop.index0 % 3}} cond_shrink">|</td>
217 {% endfor %}
218 <th colspan=3>doables</th>
219 {% for condition in conditions_present %}
220 <td class="cond_line cond_{{(conditions_present|length - loop.index) % 3}} cond_shrink">&nbsp;|</td>
221 {% endfor %}
222 <th colspan=2>comments</th>
223 </tr>
224 {% for node in top_nodes %}
225 {{ show_node_undone(node, 0) }}
226 {% endfor %}
227
228 </table>
229
230 <h4>done</h4>
231
232 <table class="alternating">
233 <tr>
234 <th colspan=2>effort</th><th rowspan=2>action · comment</th>
235 </tr>
236 <tr>
237 <th>self</th><th>tree</th>
238 </tr>
239 {% for node in top_nodes %}
240 {{ show_node_done(node, 0, []) }}
241 {% endfor %}
242 </table>
243
244 </form>
245
246 {{ macros.datalist_of_titles("processes", processes) }}
247 {% endblock %}