-{% extends 'base.html' %}
+{% extends '_base.html' %}
+{% import '_macros.html' as macros %}
{% macro show_node_undone(node, indent) %}
{% if not node.todo.is_done %}
<tr>
+<input type="hidden" name="todo_id" value="{{node.todo.id_}}" />
{% for condition in conditions_present %}
<td class="cond_line_{{loop.index0 % 3}} {% if not condition.is_active %}min_width{% endif %}">{% if condition in node.todo.conditions %}{% if not condition.is_active %}O{% endif %}{% endif %}</td>
{% endfor %}
<td class="todo_line">-></td>
-<td class="todo_line"><input type="checkbox" {% if node.todo.is_done %}checked disabled{% endif %} {% if not node.todo.is_doable %}disabled{% endif %}/></td>
+<td class="todo_line"><input name="done" type="checkbox" value="{{node.todo.id_}}" {% if node.todo.is_done %}checked disabled{% endif %} {% if not node.todo.is_doable %}disabled{% endif %}/></td>
+<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>
<td class="todo_line">
{% for i in range(indent) %} {% endfor %} +
{% if node.seen %}({% endif %}<a href="todo?id={{node.todo.id_}}">{{node.todo.process.title.newest|e}}</a>{% if node.seen %}){% endif %}
<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>
{% endfor %}
-<td><input name="comment" /></td>
+<td><input name="comment" value="{{node.todo.comment|e}}" /></td>
</tr>
{% endif %}
<tr>
{% if path|length > 0 and not path[-1].todo.is_done %}
<td>
-({% for path_node in path %}<a href="todo?id={{path_node.todo.id_}}">{{path_node.todo.process.title.newest|e}}</a> <- {% endfor %})
+({% for path_node in path %}<a href="todo?id={{path_node.todo.id_}}">{{path_node.todo.process.title.newest|e}}</a> <- {% endfor %})
</td>
</tr>
<td>
{% for i in range(indent) %} {% endfor %} +
{% endif %}
-{% if node.seen %}({% endif %}<a href="todo?id={{node.todo.id_}}">{{node.todo.process.title.newest|e}}</a>{% if node.seen %}){% endif %}
+{% 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 %}
</td>
</tr>
<a href="day?date={{day.prev_date}}">prev</a> | <a href="day?date={{day.next_date}}">next</a>
</p>
<form action="day?date={{day.date}}" method="POST">
-comment: <input name="comment" value="{{day.comment|e}}" />
+comment: <input name="day_comment" value="{{day.comment|e}}" />
<input type="submit" value="OK" /><br />
add todo: <input name="new_todo" list="processes" autocomplete="off" />
-<datalist id="processes">
-{% for process in processes %}
-<option value="{{process.id_}}">{{process.title.newest|e}}</option>
-{% endfor %}
-</datalist>
<h4>todo</h4>
<td class="cond_line_{{(conditions_present|length - loop.index) % 3}}">
{% endif %}
{% endfor %}
-
-<td><input list="todos_for_{{condition.id_}}" /></td>
-<datalist name="new_todo" id="todos_for_{{condition.id_}}" />
-{% for process in enablers_for[condition.id_] %}
-<option value="{{process.id_}}">{{process.title.newest|e}}</option>
-{% endfor %}
-</datalist />
+{% set list_name = "todos_for_%s"|format(condition.id_) %}
+<td><input name="new_todo" list="{{list_name}}" autocomplete="off" /></td>
+{{ macros.datalist_of_titles(list_name, enablers_for[condition.id_]) }}
</td>
</tr>
{% endfor %}
</table>
</form>
-{% endblock %}
+{{ macros.datalist_of_titles("processes", processes) }}
+{% endblock %}