home · contact · privacy
Overhaul Todo view to underline difference to ProcessSteps.
[plomtask] / templates / todo.html
index f62b0d1e1d3bba3e982533e3466a1eb5a16acb4e..5ffa354e172a83aec7bd016cff07a4917c954200 100644 (file)
@@ -3,6 +3,44 @@
 
 
 
+{% block css %}
+select{ font-size: 0.5em; margin: 0; padding: 0; }
+{% endblock %}
+
+
+
+{% macro draw_tree_row(item, parent_todo, indent=0) %}
+<tr>
+<td>
+{% if item.todo %}
+{% if not item.process %}+{% else %}&nbsp;{% endif %}<input type="checkbox" name="adopt" value="{{item.todo.id_}}" checked {% if indent > 0 %}disabled{% endif %}/>
+{% endif %}
+</td>
+<td>
+{% for i in range(indent-1) %}&nbsp;&nbsp;{%endfor %}{% if indent > 0 %}·{% endif %}
+{% if item.todo %}
+<a href="todo?id={{item.todo.id_}}">{{item.todo.title_then|e}}</a>
+{% else %}
+{{item.process.title.newest|e}}
+{% if indent == 0 %}
+· fill: <select name="fill_for_{{item.id_}}">
+<option value="ignore">--</option>
+<option value="make_{{item.process.id_}}">make</option>
+{% for adoptable in adoption_candidates_for[item.process.id_] %}
+<option value="{{adoptable.id_}}">adopt #{{adoptable.id_}}{% if adoptable.comment %} / {{adoptable.comment}}{% endif %}</option>
+{% endfor %}
+</select>
+{% endif %}
+{% endif %}
+</td>
+</tr>
+{% for child in item.children %}
+{{ draw_tree_row(child, item, indent+1) }}
+{% endfor %}
+{% endmacro %}
+
+
+
 {% block content %}
 <h3>Todo: {{todo.title_then|e}}</h3>
 <form action="todo?id={{todo.id_}}" method="POST">
 </td>
 </tr>
 <tr>
-<th>children</th>
-<td>{{ macros.simple_checkbox_table("adopt", todo.children, "todo", "todo_candidates", "adopt", true) }}<br />
-make: <input type="text" name="make" list="process_candidates" autocomplete="off" /></td>
+<th>descendants</th>
+<td>
+{% if steps_todo_to_process|length > 0 %}
+<table>
+{% for step in steps_todo_to_process %}
+{{ draw_tree_row(step, todo) }}
+{% endfor %}
+</table>
+{% endif %}
+adopt: <input type="text" name="adopt" list="todo_candidates" autocomplete="off" /><br />
+make: <input type="text" name="make" list="process_candidates" autocomplete="off" />
+</td>
 </tr>
 </table>
 
@@ -69,9 +116,5 @@ make: <input type="text" name="make" list="process_candidates" autocomplete="off
 </form>
 {{ macros.datalist_of_titles("condition_candidates", condition_candidates) }}
 {{ macros.datalist_of_titles("process_candidates", process_candidates) }}
-<datalist id="todo_candidates">
-{% for candidate in todo_candidates %}
-<option value="{{candidate.id_}}">{{candidate.title.newest|e}} {{candidate.comment|e}}</option>
-{% endfor %}
-</datalist>
+{{ macros.datalist_of_titles("todo_candidates", todo_candidates, historical=true, with_comments=true) }}
 {% endblock %}