home · contact · privacy
Improve multiple template layouts and refactor CSS.
[plomtask] / templates / day.html
1 {% extends '_base.html' %}
2 {% import '_macros.html' as macros %}
3
4
5
6 {% block css %}
7 table {
8   border-collapse: collapse;
9 }
10 th {
11   border: 1px solid black;
12 }
13 td.cond_line_0, td.cond_line_1, td.cond_line_2 {
14   padding: 0;
15   border-top: 1px solid white;
16 }
17 td.cond_line_0 {
18   background-color: #bfbfbf;
19 }
20 td.cond_line_1 {
21   background-color: #dfdfdf;
22 }
23 td.cond_line_2 {
24   background-color: #fffff;
25 }
26 td.cond_line_corner {
27   max-width: 0px;
28   white-space: nowrap;
29   overflow: hidden;
30   text-overflow: clip;
31 }
32 td.todo_line {
33   border-bottom: 1px solid #bfbfbf;
34   height: 1.7em;
35 }
36 tr.inactive > td.todo_line {
37   background-color: #bfbfbf;
38 }
39 tr.hidden_undone > td, tr.hidden_undone a {
40   color: #9f9f9f;
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.has_doneness_in_path %}
114 <tr{% if not node.todo.is_done %} class="hidden_undone"{% endif %}>
115 <td>
116 {% for i in range(indent) %}&nbsp; &nbsp; {% endfor %} +
117 {% 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 %}
118 </td>
119 <td>{{node.todo.comment|e}}</td>
120 </tr>
121
122 {% if not node.seen %}
123 {% for child in node.children %}
124 {{ show_node_done(child, indent+1) }}
125 {% endfor %}
126 {% endif %}
127 {% endif %}
128 {% endmacro %}
129
130
131
132 {% block content %}
133 <h3>{{day.date}} / {{day.weekday}}</h3>
134 <p>
135 <a href="day?date={{day.prev_date}}">prev</a> | <a href="day?date={{day.next_date}}">next</a>
136 </p>
137 <form action="day?date={{day.date}}" method="POST">
138
139 <p>
140 comment:
141 <input name="day_comment" value="{{day.comment|e}}" />
142 <input type="submit" value="OK" /></td>
143 </p>
144
145 <h4>to do</h4>
146
147 <table>
148
149 <tr>
150 <th colspan={{ conditions_present|length + 3 + conditions_present|length }}>conditions</th>
151 <th>add enabler</th>
152 <th>add disabler</th>
153 </tr>
154
155 {% for condition in conditions_present %}
156 {% set outer_loop = loop %}
157 <tr>
158
159 {% for _ in conditions_present %}
160 {% if outer_loop.index > loop.index %}
161 <td class="cond_line_{{loop.index0 % 3}}">
162 {% elif outer_loop.index < loop.index %}
163 <td class="cond_line_{{outer_loop.index0 % 3}}">
164 {% else %}
165 <td class="cond_line_{{outer_loop.index0 % 3}} cond_line_corner">×
166 {% endif %}
167 </td>
168 {% endfor %}
169
170 <td class="cond_line_{{loop.index0 % 3}}"><input type="checkbox" disabled{% if condition.is_active %} checked{% endif %}></td>
171 <td colspan=2 class="cond_line_{{loop.index0 % 3}}"><a href="condition?id={{condition.id_}}">{{condition.title.at(day.date)|e}}</a></td>
172
173 {% for _ in conditions_present %}
174 {% if outer_loop.index0 + loop.index < conditions_present|length %}
175 <td class="cond_line_{{outer_loop.index0 % 3}}">
176 {% elif outer_loop.index0 + loop.index > conditions_present|length %}
177 <td class="cond_line_{{(conditions_present|length - loop.index) % 3}}">
178 {% else %}
179 <td class="cond_line_{{outer_loop.index0 % 3}} cond_line_corner">&nbsp;×
180 {% endif %}
181 {% endfor %}
182
183 {% set list_name = "todos_for_%s"|format(condition.id_) %}
184 <td><input name="new_todo" list="{{list_name}}" autocomplete="off" /></td>
185 {{ macros.datalist_of_titles(list_name, enablers_for[condition.id_]) }}
186 </td>
187 {% set list_name = "todos_against_%s"|format(condition.id_) %}
188 <td><input name="new_todo" list="{{list_name}}" autocomplete="off" /></td>
189 {{ macros.datalist_of_titles(list_name, disablers_for[condition.id_]) }}
190 </td>
191 </tr>
192 {% endfor %}
193
194 <tr>
195 {% for condition in conditions_present %}
196 <td class="cond_line_{{loop.index0 % 3}}"></td>
197 {% endfor %}
198 <th colspan=3>doables</th>
199 {% for condition in conditions_present %}
200 <td class="cond_line_{{(conditions_present|length - loop.index) % 3}}"></td>
201 {% endfor %}
202 <td colspan=2></td>
203 </tr>
204 <tr>
205 {% for condition in conditions_present %}
206 <td class="cond_line_{{loop.index0 % 3}}"></td>
207 {% endfor %}
208 <td class="left_border"></td>
209 <td>add:</td>
210 <td class="right_border" ><input type="text" name="new_todo" list="processes"></td>
211 {% for condition in conditions_present %}
212 <td class="cond_line_{{(conditions_present|length - loop.index) % 3}}"></td>
213 {% endfor %}
214 <th colspan=2>comments</th>
215 </tr>
216 {% for node in top_nodes %}
217 {{ show_node_undone(node, 0) }}
218 {% endfor %}
219
220 </table>
221
222 <h4>done</h4>
223
224 <table>
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 %}