home · contact · privacy
Add Todo/Process.blockers for Conditions that block rather than enable.
[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 th {
12   border: 1px solid black;
13 }
14 td.min_width {
15   min-width: 1em;
16 }
17 td.cond_line_0 {
18   background-color: #ffbbbb;
19 }
20 td.cond_line_1 {
21   background-color: #bbffbb;
22 }
23 td.cond_line_2 {
24   background-color: #bbbbff;
25 }
26 td.todo_line {
27   border-bottom: 1px solid #bbbbbb;
28 }
29 {% endblock %}
30
31
32
33 {% macro show_node_undone(node, indent) %}
34 {% if not node.todo.is_done %}
35 <tr>
36 {% if not node.seen %}
37 <input type="hidden" name="todo_id" value="{{node.todo.id_}}" />
38 {% endif %}
39
40 {% for condition in conditions_present %}
41 <td class="cond_line_{{loop.index0 % 3}} {% if not condition.is_active %}min_width{% endif %}">{% if condition in node.todo.conditions and not condition.is_active %}O{% elif condition in node.todo.blockers and condition.is_active %}!{% endif %}</td>
42 {% endfor %}
43
44 <td class="todo_line">-&gt;</td>
45 {% if node.seen %}
46 <td class="todo_line"></td>
47 <td class="todo_line">{% if node.todo.effort %}{{ node.todo.effort }}{% endif %}</td>
48 {% else %}
49 <td class="todo_line"><input name="done" type="checkbox" value="{{node.todo.id_}}" {% if not node.todo.is_doable %}disabled{% endif %}/></td>
50 <td class="todo_line"><input name="effort" type="number" step=0.1 size=5 placeholder={{node.todo.process.effort.newest }} value={{node.todo.effort}} /></td>
51 {% endif %}
52 <td class="todo_line">
53 {% for i in range(indent) %}&nbsp; {% endfor %} +
54 {% if node.seen %}({% endif %}<a href="todo?id={{node.todo.id_}}">{{node.todo.process.title.newest|e}}</a>{% if node.seen %}){% endif %}
55 </td>
56 <td class="todo_line">-&gt;</td>
57
58 {% for condition in conditions_present|reverse %}
59 <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 %}+{% elif condition in node.todo.disables %}!{% endif %}</td>
60 {% endfor %}
61
62 <td>
63 {% if node.seen %}
64 {{node.todo.comment|e}}
65 {% else %}
66 <input name="comment" value="{{node.todo.comment|e}}" />
67 {% endif %}
68 </td>
69
70 </tr>
71 {% endif %}
72
73 {% if not node.seen %}
74 {% for child in node.children %}
75 {{ show_node_undone(child, indent+1) }}
76 {% endfor %}
77 {% endif %}
78
79 {% endmacro %}
80
81
82
83 {% macro show_node_done(node, indent, path) %}
84 {% if node.todo.is_done %}
85
86 <tr>
87 {% if path|length > 0 and not path[-1].todo.is_done %}
88 <td>
89 ({% for path_node in path %}<a href="todo?id={{path_node.todo.id_}}">{{path_node.todo.process.title.newest|e}}</a>  &lt;- {% endfor %})
90 </td>
91 </tr>
92
93 <tr>
94 <td>
95 &nbsp; +
96 {% else %}
97 <td>
98 {% for i in range(indent) %}&nbsp; {% endfor %} +
99 {% endif %}
100 {% if node.seen %}({% endif %}<a href="todo?id={{node.todo.id_}}">{{node.todo.process.title.newest|e}}</a> {% if node.todo.comment|length > 0 %}[{{node.todo.comment|e}}]{% endif %}{% if node.seen %}){% endif %}
101 </td>
102 </tr>
103
104 {% endif %}
105 {% if not node.seen %}
106 {% for child in node.children %}
107 {{ show_node_done(child, indent+1, path + [node]) }}
108 {% endfor %}
109 {% endif %}
110
111 {% endmacro %}
112
113
114
115 {% block content %}
116 <h3>{{day.date}} / {{day.weekday}}</h3>
117 <p>
118 <a href="day?date={{day.prev_date}}">prev</a> | <a href="day?date={{day.next_date}}">next</a>
119 </p>
120 <form action="day?date={{day.date}}" method="POST">
121 comment: <input name="day_comment" value="{{day.comment|e}}" />
122 <input type="submit" value="OK" /><br />
123 add todo: <input name="new_todo" list="processes" autocomplete="off" />
124
125 <h4>todo</h4>
126
127 <table>
128
129 <tr>
130 <th colspan={{ conditions_present|length}}>c</th>
131 <th colspan=5>states</th>
132 <th colspan={{ conditions_present|length}}>t</th>
133 <th>add enabler</th>
134 <th>add disabler</th>
135 </tr>
136
137 {% for condition in conditions_present %}
138 {% set outer_loop = loop %}
139 <tr>
140
141 {% for _ in conditions_present %}
142 {% if outer_loop.index > loop.index %}
143 <td class="cond_line_{{loop.index0 % 3}}">
144 {% else %}
145 <td class="cond_line_{{outer_loop.index0 % 3}}">
146 {% endif %}
147 {% if outer_loop.index == loop.index  %}
148 {% endif %}
149 </td>
150 {% endfor %}
151
152 <td class="cond_line_{{loop.index0 % 3}}">[{% if condition.is_active %}X{% else %}&nbsp;{% endif %}]</td>
153 <td colspan=4 class="cond_line_{{loop.index0 % 3}}"><a href="condition?id={{condition.id_}}">{{condition.title.newest|e}}</a></td>
154
155 {% for _ in conditions_present %}
156 {% if outer_loop.index0 + loop.index0 < conditions_present|length %}
157 <td class="cond_line_{{outer_loop.index0 % 3}}">
158 {% else %}
159 <td class="cond_line_{{(conditions_present|length - loop.index) % 3}}">
160 {% endif %}
161 {% endfor %}
162 {% set list_name = "todos_for_%s"|format(condition.id_) %}
163 <td><input name="new_todo" list="{{list_name}}" autocomplete="off" /></td>
164 {{ macros.datalist_of_titles(list_name, enablers_for[condition.id_]) }}
165 </td>
166 {% set list_name = "todos_against_%s"|format(condition.id_) %}
167 <td><input name="new_todo" list="{{list_name}}" autocomplete="off" /></td>
168 {{ macros.datalist_of_titles(list_name, disablers_for[condition.id_]) }}
169 </td>
170 </tr>
171 {% endfor %}
172
173 <tr>
174 {% for condition in conditions_present %}
175 <td class="cond_line_{{loop.index0 % 3}}"></td>
176 {% endfor %}
177 <th colspan=5>doables</th>
178 {% for condition in conditions_present %}
179 <td class="cond_line_{{(conditions_present|length - loop.index) % 3}}"></td>
180 {% endfor %}
181 <th>comments</th>
182 </tr>
183 {% for node in top_nodes %}
184 {{ show_node_undone(node, 0) }}
185 {% endfor %}
186
187 </table>
188
189 <h4>done</h4>
190
191 <table>
192 {% for node in top_nodes %}
193 {{ show_node_done(node, 0, []) }}
194 {% endfor %}
195 </table>
196
197 </form>
198
199 {{ macros.datalist_of_titles("processes", processes) }}
200 {% endblock %}