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