home · contact · privacy
Add Todo.title shortcut to Todo.process.title for more template refactoring.
[plomtask] / templates / day.html
index 167b70394963e552ec270a05384ccf47e32259af..ce16f28179588d367680dd80c2123459f4942251 100644 (file)
@@ -1,4 +1,5 @@
-{% extends 'base.html' %}
+{% extends '_base.html' %}
+{% import '_macros.html' as macros %}
 
 
 
@@ -32,13 +33,14 @@ td.todo_line {
 {% 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">-&gt;</td>
-<td class="todo_line"><input name="done" 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">
 {% for i in range(indent) %}&nbsp; {% endfor %} +
 {% if node.seen %}({% endif %}<a href="todo?id={{node.todo.id_}}">{{node.todo.process.title.newest|e}}</a>{% if node.seen %}){% endif %}
@@ -49,7 +51,7 @@ td.todo_line {
 <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 %}
@@ -70,7 +72,7 @@ td.todo_line {
 <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> &lt;- {% endfor %})
+({% for path_node in path %}<a href="todo?id={{path_node.todo.id_}}">{{path_node.todo.process.title.newest|e}}</a>  &lt;- {% endfor %})
 </td>
 </tr>
 
@@ -81,7 +83,7 @@ td.todo_line {
 <td>
 {% for i in range(indent) %}&nbsp; {% 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>
 
@@ -102,14 +104,9 @@ td.todo_line {
 <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>
 
@@ -147,13 +144,9 @@ add todo: <input name="new_todo" list="processes" autocomplete="off" />
 <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_direct_titles(list_name, enablers_for[condition.id_]) }}
 </td>
 </tr>
 {% endfor %}
@@ -183,5 +176,6 @@ add todo: <input name="new_todo" list="processes" autocomplete="off" />
 </table>
 
 </form>
-{% endblock %}
 
+{{ macros.datalist_of_titles("processes", processes) }}
+{% endblock %}