home · contact · privacy
Improve accounting scripts.
[misc] / todo_templates / todo.html
index 88fa72b2e0ec6fc9afb0abd7b8f89b2ab7b45e70..5aaf8a0bd71165ef5b36aeeb50cbe728f44d2f0b 100644 (file)
@@ -1,12 +1,69 @@
 {% extends 'base.html' %}
 
+
+
 {% block css %}
 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>
 
@@ -77,9 +134,8 @@ done<br />
 <tr class="toplevel">
 <th>tags</th>
 <td colspan=2>
-new: <input name="tag" value="" size=15 >
+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 %}
-{{ macros.tagselection(submit_name='tag', selected_tags=todo.day_tags, all_tags=tags) }}
 <br />
 </td>
 </tr>
@@ -88,46 +144,119 @@ new: <input name="tag" value="" size=15 >
 <tr class="toplevel">
 <th>dependers</th>
 <td colspan=2>
-<ul>
-{% for depender in todo.dependers %}
-<li><a href="todo?id={{depender.id_}}">{{depender.title}}</a>
+<table>
+{% for path in todo.shortened_depender_paths %}
+<tr>
+<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>
 {% endfor %}
-</ul>
+</table>
 </td>
 </tr>
 {% endif %}
 
 <tr class="toplevel">
-<th>dependencies</th>
+<th>sub-todos</th>
 <td colspan=2>
-{% if todo.deps %}
 <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 %}
 <tr class="lowlevel">
-<th>adopted</th><th>effort</th><th>title</th><th>comments</th>
+<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 %}
+</details>
+{% else %}
+({{dep_slot.task.title.then}})
+{% endif %}
+</td>
 </tr>
-{% for todo in dep_todos %}
+{% endif %}
+{% endfor %}
+{% if additional_deps %}
+<tr class="lowlevel"><td colspan=4>bonus:</td></tr>
+{{ draw_deps(additional_deps) }}
+{% endif %}
+</table>
+</td>
+</tr>
+
+<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 suggested_todo in suggested_todos[dep.id_] %}
 <tr class="lowlevel">
-<td class="center"><input name="adopt_dep" 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>
-<td>{{todo.comment}}</td>
+<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 %}
+{% endfor %}
 </table>
 {% endif %}
-<br />
+</td>
+</tr>
+
+<tr class="toplevel">
+<th>free add</th>
+<td colspan=2>
 make from task:<br />
-<input name="birth_dep" list="tasks" size=100><br />
-adopt (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" />):<br />
-<input name="adopt_dep" list="todos" size=100>
+<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 todo in filtered_todos %}<option value="{{todo.id_}}">{{ '{:2.1f}'.format(todo.all_days_effort) }} {% if todo.done %}✓{% else %}&nbsp;&nbsp;{% endif %} {{todo.day.date}} {{todo.title}} {{todo.comment}}</option>
+{% 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>
-<datalist id="tasks">
-{% for task in filtered_tasks %}<option value="{{task.id_}}">{{task.title.now}}</option>
+</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 %}
-</datalist>
+</table>
 </td>
 </tr>