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_0, td.cond_line_1, td.cond_line_2 {
11   padding: 0;
12   border-top: 1px solid white;
13 }
14 td.cond_line_0 {
15   background-color: #bfbfbf;
16 }
17 td.cond_line_1 {
18   background-color: #dfdfdf;
19 }
20 td.cond_line_2 {
21   background-color: #fffff;
22 }
23 td.cond_line_corner {
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 <td class="cond_line_{{loop.index0 % 3}}">
62 {% if condition in node.todo.conditions and not condition.is_active %}
63 O&nbsp;
64 {% elif condition in node.todo.blockers and condition.is_active %}
65 !&nbsp;
66 {% endif %}
67 </td>
68 {% endfor %}
69
70 {% if node.seen %}
71 <td class="todo_line left_border"></td>
72 <td class="todo_line">{% if node.todo.effort %}{{ node.todo.effort }}{% endif %}</td>
73 {% else %}
74 <td class="todo_line left_border"><input name="done" type="checkbox" value="{{node.todo.id_}}" {% if not node.todo.is_doable %}disabled{% endif %}/></td>
75 <td class="todo_line"><input name="effort" type="number" step=0.1 placeholder={{node.todo.effort_then}} value={{node.todo.effort}} /></td>
76 {% endif %}
77 <td class="todo_line right_border">
78 {% for i in range(indent) %}&nbsp; &nbsp; {% endfor %} +
79 {% if node.seen %}({% endif %}<a href="todo?id={{node.todo.id_}}">{{node.todo.title_then|e}}</a>{% if node.seen %}){% endif %}
80 </td>
81
82 {% for condition in conditions_present|reverse %}
83 <td class="cond_line_{{(conditions_present|length - loop.index) % 3}}">{% if condition in node.todo.enables %}&nbsp;+{% elif condition in node.todo.disables %}&nbsp;!{% endif %}</td>
84 {% endfor %}
85
86 <td colspan=2>
87 {% if node.seen %}
88 {{node.todo.comment|e}}
89 {% else %}
90 <input name="comment" type="text" value="{{node.todo.comment|e}}" />
91 {% endif %}
92 </td>
93
94 </tr>
95 {% endif %}
96
97 {% if not node.seen %}
98 {% for child in node.children %}
99 {{ show_node_undone(child, indent+1) }}
100 {% endfor %}
101 {% endif %}
102
103 {% endmacro %}
104
105
106
107 {% macro show_node_done(node, indent, path) %}
108 {% if node.todo.has_doneness_in_path %}
109 <tr{% if not node.todo.is_done %} class="hidden_undone"{% endif %}>
110 <td class="number">{{ '{:4.1f}'.format(node.todo.performed_effort) }}</td>
111 <td class="number">{{ '{:4.1f}'.format(node.todo.tree_effort) }}</td>
112 <td>
113 {% for i in range(indent) %}&nbsp; &nbsp; {% endfor %} +
114 {% 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>
115 </tr>
116 {% if not node.seen %}
117 {% for child in node.children %}
118 {{ show_node_done(child, indent+1) }}
119 {% endfor %}
120 {% endif %}
121 {% endif %}
122 {% endmacro %}
123
124
125
126 {% block content %}
127 <h3>{{day.date}} / {{day.weekday}} ({{day.total_effort|round(1)}})</h3>
128 <p>
129 <a href="day?date={{day.prev_date}}">prev</a> | <a href="day?date={{day.next_date}}">next</a>
130 </p>
131 <form action="day?date={{day.date}}" method="POST">
132
133 <p>
134 comment:
135 <input name="day_comment" type="text" value="{{day.comment|e}}" />
136 <input type="submit" value="OK" /></td>
137 </p>
138
139 <h4>to do</h4>
140
141 <p>
142 add: <input type="text" name="new_todo" list="processes">
143 </p>
144 <p>
145 make new todos
146 <select name="make_type">
147 <option value="full">with</option>
148 <option value="empty"{% if make_type == "empty" %}selected {% endif %}>without</option>
149 </select>
150 descendants (i.e. adopt where possible, otherwise create anew)
151 </p>
152
153 <table>
154
155 <tr>
156 <th colspan={{ conditions_present|length + 3 + conditions_present|length }}>conditions</th>
157 <th>add enabler</th>
158 <th>add disabler</th>
159 </tr>
160
161 {% for condition in conditions_present %}
162 {% set outer_loop = loop %}
163 <tr>
164
165 {% for _ in conditions_present %}
166 {% if outer_loop.index > loop.index %}
167 <td class="cond_line_{{loop.index0 % 3}}">
168 {% elif outer_loop.index < loop.index %}
169 <td class="cond_line_{{outer_loop.index0 % 3}}">
170 {% else %}
171 <td class="cond_line_{{outer_loop.index0 % 3}} cond_line_corner">×
172 {% endif %}
173 </td>
174 {% endfor %}
175
176 <td class="cond_line_{{loop.index0 % 3}}"><input type="checkbox" disabled{% if condition.is_active %} checked{% endif %}></td>
177 <td colspan=2 class="cond_line_{{loop.index0 % 3}}"><a href="condition?id={{condition.id_}}">{{condition.title.at(day.date)|e}}</a></td>
178
179 {% for _ in conditions_present %}
180 {% if outer_loop.index0 + loop.index < conditions_present|length %}
181 <td class="cond_line_{{outer_loop.index0 % 3}}">
182 {% elif outer_loop.index0 + loop.index > conditions_present|length %}
183 <td class="cond_line_{{(conditions_present|length - loop.index) % 3}}">
184 {% else %}
185 <td class="cond_line_{{outer_loop.index0 % 3}} cond_line_corner">&nbsp;×
186 {% endif %}
187 {% endfor %}
188
189 {% set list_name = "todos_for_%s"|format(condition.id_) %}
190 <td><input class="ablers" type="text" name="new_todo" list="{{list_name}}" autocomplete="off" /></td>
191 {{ macros.datalist_of_titles(list_name, enablers_for[condition.id_]) }}
192 </td>
193 {% set list_name = "todos_against_%s"|format(condition.id_) %}
194 <td><input class="ablers" type="text" name="new_todo" list="{{list_name}}" autocomplete="off" /></td>
195 {{ macros.datalist_of_titles(list_name, disablers_for[condition.id_]) }}
196 </td>
197 </tr>
198 {% endfor %}
199
200 <tr>
201 {% for condition in conditions_present %}
202 <td class="cond_line_{{loop.index0 % 3}}"></td>
203 {% endfor %}
204 <th colspan=3>doables</th>
205 {% for condition in conditions_present %}
206 <td class="cond_line_{{(conditions_present|length - loop.index) % 3}}"></td>
207 {% endfor %}
208 <th colspan=2>comments</th>
209 </tr>
210 {% for node in top_nodes %}
211 {{ show_node_undone(node, 0) }}
212 {% endfor %}
213
214 </table>
215
216 <h4>done</h4>
217
218 <table class="alternating">
219 <tr>
220 <th colspan=2>effort</th><th rowspan=2>action · comment</th>
221 </tr>
222 <tr>
223 <th>self</th><th>tree</th>
224 </tr>
225 {% for node in top_nodes %}
226 {{ show_node_done(node, 0, []) }}
227 {% endfor %}
228 </table>
229
230 </form>
231
232 {{ macros.datalist_of_titles("processes", processes) }}
233 {% endblock %}