home · contact · privacy
Add foreign key restraints, expand and fix tests, add deletion and forking.
[misc] / todo_templates / todo.html
index 404ac1c496e32e3fdff533ccb634b2973029a1f6..5c6e40b44a96e0641ac229eb4c5be2f771d644c4 100644 (file)
 {% extends 'base.html' %}
 
+
+
 {% block css %}
-th.toplevel { padding-right: 1em; }
-input[type="submit"].delete { background-color: #ff7777; }
-div.delete { float: right; }
+tr.toplevel th { padding-right: 1em; }
 td.center { text-align: center; }
+tr.toplevel td, tr.toplevel th { padding-top: 1em; }
+tr.lowlevel td, tr.lowlevel th { padding-top: 0em; }
+tr.grey td { background-color: #cccccc; }
 {% endblock %}
 
+
+
+{% macro draw_todo(todo) %}<a href="?id={{todo.id_}}">{{todo.title}}</a>{% if todo.comment %}({{todo.comment|e}}){% endif %}{% endmacro %}
+
+
+
+{% macro task_with_deps(task, indent) %}
+{% for i in range(indent) %}&nbsp;&nbsp;{% endfor %}+ 
+({{task.title.then}})<br />
+{% for t in task.deps %}
+{{ task_with_deps(t, indent+1) }}
+{% endfor %}
+{% endmacro %}
+
+
+
+{% macro todo_with_deps(todo, indent) %}
+{% for i in range(indent) %}&nbsp;&nbsp;&nbsp;{% endfor %}{{ macros.doneness_string(todo) }} {{ draw_todo(todo) }}<br />
+{% for dep in todo.deps %}
+{% if dep.been_observed %}
+{% for i in range(indent+1) %}&nbsp;&nbsp;&nbsp;{% endfor %}{{ macros.doneness_string(dep) }} ({{ draw_todo(dep) }})<br />
+{% else %}
+{{ todo_with_deps(dep, indent+1) }}
+{% endif %}
+{% endfor %}
+{{ todo.observe() }}
+{% endmacro %}
+
+
+
+{% macro draw_deps(deps) %}
+{% for t in deps %}
+<tr class="lowlevel">
+<td><input name="adopt_dep" type="checkbox" value="{{t.id_}}" checked/></td>
+<td>{{ macros.doneness_string(t) }}</td>
+<td>
+{% if t.deps and not t.been_observed %}
+<details>
+<summary>{{ draw_todo(t) }}</summary>
+{% for dep in t.deps %}
+{{ todo_with_deps(dep, 0) }}
+{% endfor %}
+</details>
+{% else %}
+{{ draw_todo(t) }}
+{% endif %}
+</td>
+{{ t.observe() }}
+</tr>
+{% endfor %}
+{% endmacro %}
+
+
+
 {% block content %}
 <h3>edit todo</h3>
 
-<form id="form_to_watch" action="todo" method="POST">
-<input type="hidden" name="todo_id" value="{{todo.id_}}" />
-<input type="hidden" name="return_to" value="{{return_to}}" />
+<form action="todo" method="POST">
+<input type="hidden" name="id" value="{{todo.id_}}" />
+<input type="hidden" name="importance" step=0.1 size=8 value="{{ todo.importance }}" />
 <table>
 
-<tr>
-<th class="toplevel">task</th>
-<td><a href="task?id={{ todo.task.id_ }}">{{ todo.task.title.then|e }}</a></td>
-</tr>
-
-<tr>
-<th class="toplevel">default effort</th>
-<td>{{ todo.default_effort }}</td>
+<tr class="toplevel">
+<th>task</th>
+<td colspan=2>
+<a href="task?id={{ todo.task.id_ }}">{{ todo.task.title.then|e }}</a>
+{% if todo.task.comment %}
+<pre>{{ todo.task.comment|e }}</pre>
+{% else %}
+<br />&nbsp;
+{% endif %}
+</td>
 </tr>
 
-<tr>
-<th class="toplevel">efforts</th>
+<tr class="toplevel">
+<th>work</th>
+<td>
+<input type="checkbox" name="done" {% if todo.done %}checked{% endif %} {% if todo.deps_done == false %}disabled{% endif %}/>
+done<br />
+(all days: {{todo.all_days_effort}})<br />
+(dependencies: {{todo.all_days_effort}})
+</td>
 <td>
 <table>
-<tr><th>date</th><th>effort</th><th>delete</th></tr>
+<tr class="lowlevel">
+<th>date</th>
+<th>effort</th>
+<th>delete</th>
+</tr>
 {% for date, effort in todo.efforts.items() %}
-<tr>
+<tr class="lowlevel">
 <td>
-<input name="effort_date" size=10 value="{{date}}" {% if todo.children and effort %}disabled{% endif %}>
+<input name="effort_date" type="hidden" value="{{date}}">{{date}}
 </td>
 <td>
-<input type="number" name="effort" step=0.1 size=8 value="{{effort}}" placeholder="{{todo.default_effort}}" {% if todo.children and effort %}disabled{% endif %} />
+<input type="number" name="effort" step=0.1 size=8 value="{{effort}}" placeholder="{{todo.default_effort}}" {% if todo.deps and effort %}disabled{% endif %} />
 </td>
 <td>
-{% if not (todo.children and effort) %}<input type="checkbox" name="delete_effort" value="{{date}}" />{% endif %}
+{% if not (todo.deps and effort) %}<input type="checkbox" name="delete_effort" value="{{date}}" />{% endif %}
 </td>
 </tr>
 {% endfor %}
-<tr>
+<tr class="lowlevel">
 <td>
 <input name="effort_date" size=10 value="">
 </td>
 <td>
-<input type="number" name="effort" step=0.1 size=8 value="" {% if todo.children %} disabled {% else %} placeholder="{{todo.default_effort}}" {% endif %} />
+<input type="number" name="effort" step=0.1 size=8 value="" {% if todo.deps %} disabled {% else %} placeholder="{{todo.default_effort}}" {% endif %} />
 </td>
 </tr>
 </table>
 </td>
 </tr>
 
-<tr>
-<th class="toplevel">total effort</th>
-<td>{{todo.all_days_effort}}</td>
+<tr class="toplevel">
+<th>comment</th>
+<td class="input" colspan=2>
+<input name="comment" size=100 value="{{todo.comment|e}}" />
+</td>
 </tr>
 
-<tr>
-<th class="toplevel">importance</th>
-<td class="input">
-<input type="number" name="importance" step=0.1 size=8 value="{{ todo.importance }}" />
+<tr class="toplevel">
+<th>tags</th>
+<td colspan=2>
+new: {{ macros.tagselection(submit_name='tag', selected_tags=todo.day_tags, all_tags=tags) }}
+{% for tag in todo.task.tags.now | sort %}<select disabled><option>{{ tag }}</option></select>{% endfor %}
+<br />
 </td>
 </tr>
 
+<tr class="toplevel">
+<th>dependers</th>
+<td colspan=2>
+{% if todo.dependers %}
+<table>
+{% for path in todo.shortened_depender_paths %}
 <tr>
-<th class="toplevel">comment</th>
-<td class="input">
-<textarea name="comment" rows=3 cols=100>{{todo.comment|e}}</textarea>
+<td>
+<input name="depender" type="checkbox" value="{{path[-1].id_}}" checked/>
 </td>
+<td>
+{% if not path[0] %}[…]<br />{% endif %}
+{% for step in path %}
+{% if step %}
+{% if step.dependers %}➛ {% endif %}<a href="todo?id={{step.id_}}">{{step.title}}</a><br />
+{% endif %}
+{% endfor %}</td>
 </tr>
-
-<tr>
-<th>done</th>
-<td class="input">
-{% if todo.children %}✓{% else %}<input type="checkbox" name="done" {% if todo.done %}checked{% endif %}/>{% endif %}
+{% endfor %}
+</table>
+{% endif %}
+add: <input name="depender" list="todos" autocomplete="off" />
 </td>
 </tr>
 
-<tr>
-<th class="toplevel">day tags</th>
-<td>
-{% for tag in tags | sort %}
-{% if tag in todo.task.tags.now %}
-&nbsp;✓
+<tr class="toplevel">
+<th>sub-todos</th>
+<td colspan=2>
+<table>
+<tr class="lowlevel"><td colspan=4>expected:</td></tr>
+{% for dep_slot in dep_slots %}
+{% if dep_slot.todos %}
+{{ draw_deps(dep_slot.todos) }}
 {% else %}
-<input type="checkbox" name="day_tag_{{tag|e}}"{% if tag in todo.day_tags %} checked{% endif %}/>
-{% endif %} {{ tag }}
-<br />
+<tr class="lowlevel">
+<td></td>
+<td>[ ]</td>
+<td>
+{% if dep_slot.task.deps %} <details>
+<summary>({{dep_slot.task.title.then}})</summary>
+{% for task in dep_slot.task.deps %}
+{{ task_with_deps(task, 1) }}
 {% endfor %}
-add: <input name="joined_day_tags" value="" size=100 >
+</details>
+{% else %}
+({{dep_slot.task.title.then}})
+{% endif %}
 </td>
 </tr>
-
-<tr>
-<th class="toplevel">parents</th>
-<td>
-<ul>
-{% for parent in todo.parents %}
-<li><a href="todo?id={{parent.id_}}">{{parent.title}}</a>
+{% endif %}
 {% endfor %}
-</ul>
+{% if additional_deps %}
+<tr class="lowlevel"><td colspan=4>bonus:</td></tr>
+{{ draw_deps(additional_deps) }}
+{% endif %}
+</table>
 </td>
 </tr>
 
-<tr>
-<th class="toplevel">children</th>
-<td>
-<table class="alternating">
-<tr>
-<th>adopt</th><th>effort</th><th>title</th><th>comments</th>
+<tr class="toplevel">
+<th>suggestions</th>
+<td colspan=2>
+{% if todo.task.deps %}
+<table>
+{% for dep in todo.task.deps %}
+<tr class="lowlevel">
+<td><input name="birth_dep" type="checkbox" value="{{dep.id_}}"></td>
+<td>make new</td>
+<td><a href="task?id={{dep.id_}}">{{dep.title.then}}</a></td>
 </tr>
-{% for todo in child_todos %}
-<tr>
-<td class="center"><input name="adopt_child" type="checkbox" value="{{todo.id_}}" checked/></td>
-<td class="number">{{ '{:2.1f}'.format(todo.all_days_effort) }} {% if todo.done %}✓{% else %}&nbsp;{% endif %}</td>
-<td><a href="todo?id={{todo.id_}}">{{todo.day.date}} {{todo.title}}</a></td>
+{% for suggested_todo in suggested_todos[dep.id_] %}
+<tr class="lowlevel">
+<td><input name="adopt_dep" type="checkbox" value="{{suggested_todo.id_}}" /></td>
+<td>adopt</td>
+<td><a href="todo?id={{suggested_todo.id_}}">{{suggested_todo.day.date}}:{{suggested_todo.title}}{% if suggested_todo.deps %}:+{% endif %}</a></td>
+<td>{{suggested_todo.comment}}</td>
 </tr>
 {% endfor %}
-<tr>
-<th colspan=4>--------</th>
+{% endfor %}
+</table>
+{% endif %}
+</td>
 </tr>
-{% for todo in filtered_todos %}
-<tr>
-<td class="center"><input name="adopt_child" type="checkbox" value="{{todo.id_}}" /></td>
-<td class="number">{{ '{:2.1f}'.format(todo.all_days_effort) }} {% if todo.done %}✓{% else %}&nbsp;{% endif %}</td>
-<td><a href="todo?id={{todo.id_}}">{{todo.day.date}} {{todo.title}}</a></td>
+
+<tr class="toplevel">
+<th>free add</th>
+<td colspan=2>
+make from task ({{ macros.parenthood_selector(parenthood) }}):<br />
+<input name="birth_dep" list="tasks" size=100 autocomplete="off"><br />
+adopt:<br />
+<input name="adopt_dep" list="todos" size=100 autocomplete="off">
+<datalist id="todos">
+{% for t in filtered_todos %}
+<option value="{{t.id_}}">
+{{ macros.doneness_string(t, datalist_hack=true) }}
+{{t.day.date}} {{t.title}} {{t.comment}}
+{% if t.dependers %}
+(dependers:
+{% for path in t.depender_paths %}
+{{ path[0].title }}{% if path|count > 1 %}➛{% endif %}{% if path|count > 3 %}…➛{% endif %}{% if path|count > 1 %}{{ path[-1].title }}{% endif %}
+{% endfor %})
+{% endif %}
+</option>
+{% endfor %}
+</datalist>
+</td>
+</tr>
+{{ macros.datalist_tasks(filtered_tasks) }}
+
+<tr class="toplevel">
+<th>as chain</th>
+<td colspan=2>
+<table>
+{% for dep in todo.deps_chain %}
+<tr class="lowlevel">
+<td class="number">{{dep.deps_depth}}</td>
+<td>{% if dep.deps_done %}{{ macros.doneness_string(dep) }}{% endif %}</td>
+<td>{{ draw_todo(dep) }}</td>
 </tr>
 {% endfor %}
 </table>
@@ -136,22 +265,9 @@ add: <input name="joined_day_tags" value="" size=100 >
 </tr>
 
 </table>
-<input class="update" name="update" type="submit" value="update" />
+<input id="update_button" class="update" name="update" type="submit" value="update" />
 <div class="delete">
 <input class="delete" type="submit" name="delete" value="delete" />
 </div>
-
-<hr />
-{% include 'tagfilters.html' %}
-<br />
-from: <input name="start" {% if start_date %}value="{{ start_date }}"{% endif %} placeholder="yesterday" />
-to: <input name="end" {% if end_date %}value="{{ end_date }}"{% endif %} placeholder="2030-12-31" />
-search: <input name="search" value="{{search|e}}" />
-<input type="submit" name="filter" value="filter" />
-
 </form>
-{% include 'watch_form.html' %}
-<script>
-mere_filter_inputs = mere_filter_inputs.concat(['search', 'start', 'end']);
-</script> 
 {% endblock %}