home · contact · privacy
Simplify and improve previous bugfix.
[plomtask] / templates / todo.html
index 44cdfa7eec24de0db04dd1eaa3984fa3abea41d4..fd16680badfb894775a7e568f4fc31f1a21dfd82 100644 (file)
-{% extends 'base.html' %}
+{% extends '_base.html' %}
+{% import '_macros.html' as macros %}
 
 
 
 {% 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 size=5 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("condition", 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("blocker", 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>
-</tr>
-{% endfor %}
-</table>
-add: <input name="disables" list="condition_candidates" autocomplete="off" />
-</td>
+<td>{{ macros.simple_checkbox_table("disables", todo.disables, "condition", "condition_candidates") }}</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>
-<td>
-<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>
+<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>
 </tr>
-{% endfor %}
 </table>
-adopt: <input name="adopt" list="todo_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>
+{{ macros.edit_buttons() }}
 </form>
-
-<datalist id="condition_candidates">
-{% for condition_candidate in condition_candidates %}
-<option value="{{condition_candidate.id_}}">{{condition_candidate.title.newest|e}}</option>
-{% endfor %}
-</datalist>
+{{ 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.process.title.newest|e}} ({{candidate.id_}})</option>
+<option value="{{candidate.id_}}">{{candidate.title.newest|e}} {{candidate.comment|e}}</option>
 {% endfor %}
 </datalist>
 {% endblock %}