home · contact · privacy
Enhance layouts.
[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: #efefef;
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 {
49   height: 100%;
50 }
51 {% endblock %}
52
53
54
55 {% macro show_node_undone(node, indent) %}
56 {% if not node.todo.is_done %}
57 <tr {% if node.seen or not node.todo.is_doable %}class="inactive"{% endif %}>
58 {% if not node.seen %}
59 <input type="hidden" name="todo_id" value="{{node.todo.id_}}" />
60 {% endif %}
61
62 {% for condition in conditions_present %}
63 <td class="cond_line_{{loop.index0 % 3}}">
64 {% if condition in node.todo.conditions and not condition.is_active %}
65 O&nbsp;
66 {% elif condition in node.todo.blockers and condition.is_active %}
67 !&nbsp;
68 {% endif %}
69 </td>
70 {% endfor %}
71
72 {% if node.seen %}
73 <td class="todo_line left_border"></td>
74 <td class="todo_line">{% if node.todo.effort %}{{ node.todo.effort }}{% endif %}</td>
75 {% else %}
76 <td class="todo_line left_border"><input name="done" type="checkbox" value="{{node.todo.id_}}" {% if not node.todo.is_doable %}disabled{% endif %}/></td>
77 <td class="todo_line"><input name="effort" type="number" step=0.1 size=5 placeholder={{node.todo.effort_then}} value={{node.todo.effort}} /></td>
78 {% endif %}
79 <td class="todo_line right_border">
80 {% for i in range(indent) %}&nbsp; &nbsp; {% endfor %} +
81 {% if node.seen %}({% endif %}<a href="todo?id={{node.todo.id_}}">{{node.todo.title_then|e}}</a>{% if node.seen %}){% endif %}
82 </td>
83
84 {% for condition in conditions_present|reverse %}
85 <td class="cond_line_{{(conditions_present|length - loop.index) % 3}} {% if condition in node.todo.enables or condition in node.todo.disables %}min_width{% endif %}">{% if condition in node.todo.enables %}&nbsp;+{% elif condition in node.todo.disables %}&nbsp;!{% endif %}</td>
86 {% endfor %}
87
88 <td colspan=2>
89 {% if node.seen %}
90 {{node.todo.comment|e}}
91 {% else %}
92 <input name="comment" value="{{node.todo.comment|e}}" style="width: 100%" />
93 {% endif %}
94 </td>
95
96 </tr>
97 {% endif %}
98
99 {% if not node.seen %}
100 {% for child in node.children %}
101 {{ show_node_undone(child, indent+1) }}
102 {% endfor %}
103 {% endif %}
104
105 {% endmacro %}
106
107
108
109 {% macro show_node_done(node, indent, path) %}
110 {% if node.todo.is_done %}
111
112 <tr>
113 {% if path|length > 0 and not path[-1].todo.is_done %}
114 <td>
115 ({% for path_node in path %}<a href="todo?id={{path_node.todo.id_}}">{{path_node.todo.title_then|e}}</a>  &lt;- {% endfor %})
116 </td>
117 </tr>
118
119 <tr>
120 <td>
121 &nbsp; +
122 {% else %}
123 <td>
124 {% for i in range(indent) %}&nbsp; {% endfor %} +
125 {% endif %}
126 {% 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 %}
127 </td>
128 </tr>
129
130 {% endif %}
131 {% if not node.seen %}
132 {% for child in node.children %}
133 {{ show_node_done(child, indent+1, path + [node]) }}
134 {% endfor %}
135 {% endif %}
136
137 {% endmacro %}
138
139
140
141 {% block content %}
142 <h3>{{day.date}} / {{day.weekday}}</h3>
143 <p>
144 <a href="day?date={{day.prev_date}}">prev</a> | <a href="day?date={{day.next_date}}">next</a>
145 </p>
146 <form action="day?date={{day.date}}" method="POST">
147 comment: <input name="day_comment" value="{{day.comment|e}}" />
148 <input type="submit" value="OK" /><br />
149 add todo: <input name="new_todo" list="processes" autocomplete="off" />
150
151 <h4>to do</h4>
152
153 <table>
154
155 <tr>
156 <th colspan={{ conditions_present|length + 3 + conditions_present|length }}>states</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">X
172 {% endif %}
173 </td>
174 {% endfor %}
175
176 <td class="cond_line_{{loop.index0 % 3}}">[{% if condition.is_active %}X{% else %}&nbsp;{% 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;X
186 {% endif %}
187 {% endfor %}
188
189 {% set list_name = "todos_for_%s"|format(condition.id_) %}
190 <td><input 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 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 class="left_border right_border vertical_borders" 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>
219 {% for node in top_nodes %}
220 {{ show_node_done(node, 0, []) }}
221 {% endfor %}
222 </table>
223
224 </form>
225
226 {{ macros.datalist_of_titles("processes", processes) }}
227 {% endblock %}