home · contact · privacy
Slightly improve and re-organize Condition tests.
[plomtask] / templates / todo.html
index 44cdfa7eec24de0db04dd1eaa3984fa3abea41d4..fea931ab83ddf57536ab375ce3773a3f656204ce 100644 (file)
-{% extends 'base.html' %}
+{% extends '_base.html' %}
+{% import '_macros.html' as macros %}
+
+
+
+{% 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_empty_{{item.process.id_}}">make empty</option>
+<option value="make_full_{{item.process.id_}}">make full</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.process.title.newest|e}}</h3>
+<h3>Todo: {{todo.title_then|e}}</h3>
 <form action="todo?id={{todo.id_}}" method="POST">
-<table>
 
+<table class="edit_table">
 <tr>
 <th>day</th>
 <td><a href="day?date={{todo.date}}">{{todo.date}}</a></td>
 </tr>
-
 <tr>
 <th>process</th>
 <td><a href="process?id={{todo.process.id_}}">{{todo.process.title.newest|e}}</a></td>
 </tr>
-
 <tr>
 <th>done</th>
-<td><input type="checkbox" name="done" {% if todo.is_done %}checked {% endif %} {% if not todo.is_doable %}disabled {% endif %}/><br /></td>
+<td><input type="checkbox" name="done" {% if todo.is_done %}checked {% endif %} {% if not todo.is_doable %}disabled {% endif %}/>
+{% if not todo.is_doable and todo.is_done %}<input type="hidden" name="done" value="1" />{% endif %}
+</td>
+</tr>
+<tr>
+<th>effort</th>
+<td><input type="number" name="effort" step=0.1 placeholder={{todo.effort_then}} value={{todo.effort}} /></td>
 </tr>
-
 <tr>
 <th>comment</th>
-<td><input name="comment" value="{{todo.comment|e}}"/></td>
+<td><input name="comment" type="text" value="{{todo.comment|e}}"/></td>
 </tr>
-
 <tr>
-<th>conditions</th>
-<td>
-<table>
-{% for condition in todo.conditions %}
+<th>calendarize</th>
+<td><input type="checkbox" name="calendarize" {% if todo.calendarize %}checked {% endif %}</td>
+</tr>
 <tr>
-<td>
-<input type="checkbox" name="condition" value="{{condition.id_}}" checked />
-</td>
-<td>
-<a href="condition?id={{condition.id_}}">{{condition.title.newest|e}}</a>
-</td>
+<th>conditions</th>
+<td>{{ macros.simple_checkbox_table("conditions", todo.conditions, "condition", "condition_candidates") }}</td>
 </tr>
-{% endfor %}
-</table>
-add: <input name="condition" list="condition_candidates" autocomplete="off" />
-</td>
+<tr>
+<th>blockers</th>
+<td>{{ macros.simple_checkbox_table("blockers", todo.blockers, "condition", "condition_candidates") }}</td>
 </tr>
-
 <tr>
 <th>enables</th>
-<td>
-<table>
-{% for condition in todo.enables %}
-<tr>
-<td>
-<input type="checkbox" name="enables" value="{{condition.id_}}" checked />
-</td>
-<td>
-<a href="condition?id={{condition.id_}}">{{condition.title.newest|e}}</a>
-</td>
+<td>{{ macros.simple_checkbox_table("enables", todo.enables, "condition", "condition_candidates") }}</td>
 </tr>
-{% endfor %}
-</table>
-add: <input name="enables" list="condition_candidates" autocomplete="off" />
-</td>
-</tr>
-
 <tr>
 <th>disables</th>
-<td>
-<table>
-{% for condition in todo.disables%}
-<tr>
-<td>
-<input type="checkbox" name="disables" value="{{condition.id_}}" checked />
-</td>
-<td>
-<a href="condition?id={{condition.id_}}">{{condition.title.newest|e}}</a>
-</td>
+<td>{{ macros.simple_checkbox_table("disables", todo.disables, "condition", "condition_candidates") }}</td>
 </tr>
-{% endfor %}
-</table>
-add: <input name="disables" list="condition_candidates" autocomplete="off" />
-</td>
-</tr>
-
 <tr>
 <th>parents</th>
 <td>
 {% for parent in todo.parents %}
-<a href="todo?id={{parent.id_}}">{{parent.process.title.newest|e}}</a><br />
+<a href="todo?id={{parent.id_}}">{{parent.title_then|e}}</a><br />
 {% endfor %}
 </td>
 </tr>
-
 <tr>
-<th>children</th>
+<th>descendants</th>
 <td>
+{% if steps_todo_to_process|length > 0 %}
 <table>
-{% for child in todo.children %}
-<tr>
-<td><input type="checkbox" name="adopt" value="{{child.id_}}" checked /></td>
-<td><a href="todo?id={{child.id_}}">{{child.process.title.newest|e}}</a></td>
-</tr>
+{% for step in steps_todo_to_process %}
+{{ draw_tree_row(step, todo) }}
 {% endfor %}
 </table>
-adopt: <input name="adopt" list="todo_candidates" autocomplete="off" />
+{% endif %}
+adopt: <input type="text" name="adopt" list="todo_candidates" autocomplete="off" /><br />
+make empty: <input type="text" name="make_empty" list="process_candidates" autocomplete="off" /><br />
+make full: <input type="text" name="make_full" list="process_candidates" autocomplete="off" />
 </td>
 </tr>
-
 </table>
-<input class="btn-harmless" type="submit" name="update" value="update" />
-<div class="btn-to-right">
-<input class="btn-dangerous" type="submit" name="delete" value="delete" />
-</div>
-</form>
 
-<datalist id="condition_candidates">
-{% for condition_candidate in condition_candidates %}
-<option value="{{condition_candidate.id_}}">{{condition_candidate.title.newest|e}}</option>
-{% endfor %}
-</datalist>
-<datalist id="todo_candidates">
-{% for candidate in todo_candidates %}
-<option value="{{candidate.id_}}">{{candidate.process.title.newest|e}} ({{candidate.id_}})</option>
-{% endfor %}
-</datalist>
+{{ macros.edit_buttons() }}
+</form>
+{{ macros.datalist_of_titles("condition_candidates", condition_candidates) }}
+{{ macros.datalist_of_titles("process_candidates", process_candidates) }}
+{{ macros.datalist_of_titles("todo_candidates", todo_candidates, historical=true, with_comments=true) }}
 {% endblock %}