home · contact · privacy
Refactor templates.
[plomtask] / templates / todo.html
index 44cdfa7eec24de0db04dd1eaa3984fa3abea41d4..d3957af79545e5492fc8217d6977cfb91046b886 100644 (file)
@@ -1,4 +1,5 @@
-{% extends 'base.html' %}
+{% extends '_base.html' %}
+{% import '_macros.html' as macros %}
 
 
 
 
 <tr>
 <th>conditions</th>
-<td>
-<table>
-{% for condition in todo.conditions %}
-<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>
-</tr>
-{% endfor %}
-</table>
-add: <input name="condition" list="condition_candidates" autocomplete="off" />
-</td>
+<td>{{ macros.simple_checkbox_table("condition", todo.conditions, "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>
-</tr>
-{% endfor %}
-</table>
-add: <input name="enables" list="condition_candidates" autocomplete="off" />
-</td>
+<td>{{ macros.simple_checkbox_table("enables", todo.enables, "condition", "condition_candidates") }}</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>
@@ -109,20 +68,9 @@ adopt: <input name="adopt" list="todo_candidates" autocomplete="off" />
 </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>
-<datalist id="todo_candidates">
-{% for candidate in todo_candidates %}
-<option value="{{candidate.id_}}">{{candidate.process.title.newest|e}} ({{candidate.id_}})</option>
-{% endfor %}
-</datalist>
+{{ macros.datalist_of_direct_titles("condition_candidates", condition_candidates) }}
+{{ macros.datalist_of_indirect_titles("todo_candidates", todo_candidates) }}
 {% endblock %}