home · contact · privacy
Add foreign key restraints, expand and fix tests, add deletion and forking.
[misc] / todo_templates / task.html
index ef2402daec9847013e77e71adec306b5f00d5bc8..8aef69670346204a087885ebe2ae3b3def1bd1f9 100644 (file)
 {% extends 'base.html' %}
+
+
+
 {% block css %}
-th, td { vertical-align: top; text-align: left}
-td.input { width: 100%; }
-td.checkbox { width: 0.1em; height: 0.1em; padding: 0em; text-align: center; }
-input[type="number"] { text-align: right; }
-input[type="text"] { width: 100% }
-textarea { width: 100% };
+tr.toplevel th { padding-right: 1em; }
+tr.toplevel td, tr.toplevel th { padding-top: 1em; }
+tr.lowlevel td, tr.lowlevel th { padding-top: 0em; }
 {% endblock %}
+
+
+
+{% macro draw_task(task) %}
+<a href="task?id={{task.id_}}">{{task.title.now}}</a>
+{% endmacro %}
+
+
+
+{% macro task_with_deps(task, indent) %}
+{% for i in range(indent) %}&nbsp;&nbsp;{% if loop.last %}+{% endif %}{% endfor %}
+{{ draw_task(task) }}<br />
+{% for task in task.deps %}
+{{ task_with_deps(task, indent+1) }}
+{% endfor %}
+{% endmacro %}
+
+
+
 {% block content %}
-<form id="form_to_watch" action="{{action|e}}" method="POST">
 <h3>edit task</h3>
+
+<form action="task" method="POST">
 <input type="hidden" name="id" value="{{ task.id_ }}" />
 <table>
-<tr><th>title</th><td class="input"><input name="title" type="text" value="{{ task.title|e }}" /><details><summary>history</summary><ul>{% for k,v in task.title_history.items() | sort(attribute='0', reverse=True) %}<li>{{ k }}: {{ v|e }}{% endfor %}</ul></details></td></tr>
-<tr><th>default effort</th><td class="input"><input type="number" name="default_effort" value="{{ task.default_effort }}" step=0.1 size=8 required /><details><summary>history</summary><ul>{% for k,v in task.default_effort_history.items() | sort(attribute='0', reverse=True) %}<li>{{ k }}: {{ v|e }}{% endfor %}</ul></details></td></tr>
-<tr><th>tags</th>
+
+<tr class="toplevel">
+<th>add as todo</th>
+<td><input name="add_as_todo" type="checkbox" /> to <input name="new_todo_date" value="{{ selected_date }}" />
+</tr>
+
+{% if task.forks_id %}
+<tr class="toplevel">
+<th>forks</th>
+<td><a href="task?id={{task.forks_id}}">{{ task.forked_task.title.now|e }}</td>
+</td>
+</tr>
+{% endif %}
+
+<tr class="toplevel">
+<th>title</th>
+<td class="input">
+<input name="title" type="text" value="{{ task.title.now|e }}" size=100 />
+<details>
+<summary>history</summary>
+<ul>
+{% for k,v in task.title.history.items() | sort(attribute='0', reverse=True) %}
+<li>{{ k }}: {{ v|e }}
+{% endfor %}
+</ul>
+</details>
+</td>
+</tr>
+
+<tr class="toplevel">
+<th>comment</th>
+<td class="input">
+<textarea name="comment" cols=100 rows=5>{{task.comment|e}}</textarea>
+</td>
+</tr>
+
+<tr class="toplevel">
+<th>default effort</th>
+<td class="input">
+<input type="number" name="default_effort" value="{{ task.default_effort.now }}" step=0.1 size=8 required />
+<details>
+<summary>history</summary>
+<ul>
+{% for k,v in task.default_effort.history.items() | sort(attribute='0', reverse=True) %}
+<li>{{ k }}: {{ v|e }}
+{% endfor %}
+</ul>
+</details>
+</td>
+</tr>
+
+<tr class="toplevel">
+<th>tags</th>
+<td>
+add: {{ macros.tagselection(submit_name='tag', selected_tags=task.tags.now, all_tags=tags) }}
+<details>
+<summary>history</summary>
+<ul>
+{% for k,v in task.tags.history.items() | sort(attribute='0', reverse=True) %}
+<li>{{ k }}: {{ v|e }}
+{% endfor %}
+</ul>
+</details>
+</td>
+</tr>
+
+<tr class="toplevel">
+<th>fence adoptions</th>
+<td><input name="fences_adoptions" type="checkbox" {% if task.fences_adoptions.now %}checked{% endif %}/></td>
+</tr>
+
+<tr class="toplevel">
+<th>dependers</th>
 <td>
-{% for tag in db.t_tags | sort %}
-<input type="checkbox" name="tag_{{tag|e}}"{% if tag in task.tags %} checked{% endif %}/> {{ tag }}<br />
+{% if task.dependers %}
+<table>
+{% for depender in task.dependers %}
+<tr class="lowlevel">
+<td>
+<input name="depender" type="checkbox" value="{{depender.id_}}" checked/>
+</td>
+<td>
+{{ draw_task(depender)}}
+</td>
+</tr>
 {% endfor %}
-add: <input name="joined_tags" type="text" value="" ><br />
-<details><summary>history</summary><ul>{% for k,v in task.tags_history.items() | sort(attribute='0', reverse=True) %}<li>{{ k }}: {{ v|e }}{% endfor %}</ul></details>
-</td></tr>
-<tr><th>links</th>
+</table>
+{% endif %}
+add: <input name="depender" list="tasks" autocomplete="off" />
+</td>
+</tr>
+
+<tr class="toplevel">
+<th>children</th>
+<td>
+{% if task.deps %}
+<table>
+{% for dep in task.deps %}
+<tr class="lowlevel">
+<td>
+<input name="dep" type="checkbox" value="{{dep.id_}}" checked/>
+</td>
 <td>
-{% for other_task_id, other_task in db.tasks.items() | sort(attribute='1.title') %}
-{% if task.id_ != other_task_id and other_task.visible and other_task_id in task.links %}
-<input name="link_{{other_task_id}}" type="checkbox" checked /> <a href="{{db.prefix}}/task?id={{ other_task_id }}">{{ other_task.title|e }}</a><br />
+{% if dep.deps %}
+<details>
+<summary>
 {% endif %}
+{{ draw_task(dep)}}
+{% if dep.deps %}
+</summary>
+{% for s in dep.deps %}
+{{ task_with_deps(s, 1) }}
 {% endfor %}
-{% for other_task_id, other_task in db.tasks.items() | sort(attribute='1.title') %}
-{% if task.id_ != other_task_id and other_task.visible and not other_task_id in task.links %}
-<input name="link_{{other_task_id}}" type="checkbox"/> <a href="{{db.prefix}}/task?id={{ other_task_id }}">{{ other_task.title|e }}</a><br />
+</details>
 {% endif %}
+</td>
+</tr>
 {% endfor %}
+</table>
+{% endif %}
+add: <input name="dep" list="tasks" autocomplete="off" />
 </td>
 </tr>
+{{ macros.datalist_tasks(filtered_tasks) }}
+
+{% if task.deps %}
+<tr class="toplevel">
+<th>as chain</th>
+<td>
+<table>
+{% for dep in task.deps_chain %}
+<tr class="lowlevel">
+<td class="number">{{dep.deps_depth}}</td>
+<td><a href="task?id={{ dep.id_ }}">{{dep.title.now}}</a></td>
+</tr>
+{% endfor %}
 </table>
-<input type="submit" value="update" />
-</form>
-<form action="{{action|e}}" method="POST">
-<input type="hidden" name="id" value="{{ task.id_ }}" />
-{% include 'tagfilters.html' %}
+</td>
+</tr>
+{% endif %}
+
+</table>
+<input id="update_button" class="update" type="submit" name="update" value="update" />
+<div class="delete">
+<input class="update" type="submit" name="fork" value="fork" />
+<input class="delete" type="submit" name="delete" value="delete" />
+</div>
 </form>
-{% include 'watch_form.html' %}
 {% endblock %}