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