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