home · contact · privacy
Add Todo/Process.blockers for Conditions that block rather than enable.
[plomtask] / templates / day.html
index e3fe5ef29c5865551d42d751a5d45ea380921065..6954fd3a85974e44b1db0801968c9313d60fdaea 100644 (file)
-{% extends 'base.html' %}
+{% extends '_base.html' %}
+{% import '_macros.html' as macros %}
 
-{% macro node_with_children(node, indent) %}
-<li>{% for i in range(indent) %}+{% endfor %}
-{% if node.is_todo %}
-{% if not node.item.is_doable %}<del>{% endif %}[{% if node.item.is_done %}x{% else %} {% endif %}]{% if not node.item.is_doable %}</del>{% endif %}
-{% if node.seen %}({% else %}{% endif %}<a href="todo?id={{node.item.id_}}">{{node.item.process.title.newest|e}}</a>{% if node.seen %}){% else %}{% endif %}
+
+
+{% block css %}
+td, th, tr, table {
+  padding: 0;
+  margin: 0;
+}
+th {
+  border: 1px solid black;
+}
+td.min_width {
+  min-width: 1em;
+}
+td.cond_line_0 {
+  background-color: #ffbbbb;
+}
+td.cond_line_1 {
+  background-color: #bbffbb;
+}
+td.cond_line_2 {
+  background-color: #bbbbff;
+}
+td.todo_line {
+  border-bottom: 1px solid #bbbbbb;
+}
+{% endblock %}
+
+
+
+{% macro show_node_undone(node, indent) %}
+{% if not node.todo.is_done %}
+<tr>
+{% if not node.seen %}
+<input type="hidden" name="todo_id" value="{{node.todo.id_}}" />
+{% endif %}
+
+{% for condition in conditions_present %}
+<td class="cond_line_{{loop.index0 % 3}} {% if not condition.is_active %}min_width{% endif %}">{% if condition in node.todo.conditions and not condition.is_active %}O{% elif condition in node.todo.blockers and condition.is_active %}!{% endif %}</td>
+{% endfor %}
+
+<td class="todo_line">-&gt;</td>
+{% if node.seen %}
+<td class="todo_line"></td>
+<td class="todo_line">{% if node.todo.effort %}{{ node.todo.effort }}{% endif %}</td>
+{% else %}
+<td class="todo_line"><input name="done" type="checkbox" value="{{node.todo.id_}}" {% if not node.todo.is_doable %}disabled{% endif %}/></td>
+<td class="todo_line"><input name="effort" type="number" step=0.1 size=5 placeholder={{node.todo.process.effort.newest }} value={{node.todo.effort}} /></td>
+{% endif %}
+<td class="todo_line">
+{% for i in range(indent) %}&nbsp; {% endfor %} +
+{% if node.seen %}({% endif %}<a href="todo?id={{node.todo.id_}}">{{node.todo.process.title.newest|e}}</a>{% if node.seen %}){% endif %}
+</td>
+<td class="todo_line">-&gt;</td>
+
+{% for condition in conditions_present|reverse %}
+<td class="cond_line_{{(conditions_present|length - loop.index) % 3}} {% if condition in node.todo.enables or condition in node.todo.disables %}min_width{% endif %}">{% if condition in node.todo.enables %}+{% elif condition in node.todo.disables %}!{% endif %}</td>
+{% endfor %}
+
+<td>
+{% if node.seen %}
+{{node.todo.comment|e}}
 {% else %}
-&lt; {% if node.seen %}({% else %}{% endif %}<a href="condition?id={{node.item.id_}}">{{node.item.title.newest|e}}</a>{% if node.seen %}){% else %}{% endif %}
+<input name="comment" value="{{node.todo.comment|e}}" />
 {% endif %}
+</td>
+
+</tr>
+{% endif %}
+
+{% if not node.seen %}
 {% for child in node.children %}
-{{ node_with_children(child, indent+1) }}
+{{ show_node_undone(child, indent+1) }}
 {% endfor %}
+{% endif %}
+
 {% endmacro %}
 
+
+
+{% macro show_node_done(node, indent, path) %}
+{% if node.todo.is_done %}
+
+<tr>
+{% if path|length > 0 and not path[-1].todo.is_done %}
+<td>
+({% for path_node in path %}<a href="todo?id={{path_node.todo.id_}}">{{path_node.todo.process.title.newest|e}}</a>  &lt;- {% endfor %})
+</td>
+</tr>
+
+<tr>
+<td>
+&nbsp; +
+{% else %}
+<td>
+{% for i in range(indent) %}&nbsp; {% endfor %} +
+{% endif %}
+{% if node.seen %}({% endif %}<a href="todo?id={{node.todo.id_}}">{{node.todo.process.title.newest|e}}</a> {% if node.todo.comment|length > 0 %}[{{node.todo.comment|e}}]{% endif %}{% if node.seen %}){% endif %}
+</td>
+</tr>
+
+{% endif %}
+{% if not node.seen %}
+{% for child in node.children %}
+{{ show_node_done(child, indent+1, path + [node]) }}
+{% endfor %}
+{% endif %}
+
+{% endmacro %}
+
+
+
 {% block content %}
 <h3>{{day.date}} / {{day.weekday}}</h3>
 <p>
 <a href="day?date={{day.prev_date}}">prev</a> | <a href="day?date={{day.next_date}}">next</a>
 </p>
 <form action="day?date={{day.date}}" method="POST">
-comment: <input name="comment" value="{{day.comment|e}}" />
+comment: <input name="day_comment" value="{{day.comment|e}}" />
 <input type="submit" value="OK" /><br />
 add todo: <input name="new_todo" list="processes" autocomplete="off" />
-<datalist id="processes">
-{% for process in processes %}
-<option value="{{process.id_}}">{{process.title.newest|e}}</option>
+
+<h4>todo</h4>
+
+<table>
+
+<tr>
+<th colspan={{ conditions_present|length}}>c</th>
+<th colspan=5>states</th>
+<th colspan={{ conditions_present|length}}>t</th>
+<th>add enabler</th>
+<th>add disabler</th>
+</tr>
+
+{% for condition in conditions_present %}
+{% set outer_loop = loop %}
+<tr>
+
+{% for _ in conditions_present %}
+{% if outer_loop.index > loop.index %}
+<td class="cond_line_{{loop.index0 % 3}}">
+{% else %}
+<td class="cond_line_{{outer_loop.index0 % 3}}">
+{% endif %}
+{% if outer_loop.index == loop.index  %}
+{% endif %}
+</td>
 {% endfor %}
-</datalist>
-</form>
-<h4>conditions</h4>
-{% for node in condition_listings %}
-<li>[{% if node.condition.is_active %}x{% else %} {% endif %}] <a href="condition?id={{node.condition.id_}}">{{node.condition.title.newest|e}}</a>
-<ul>
-{% for enabler in node.enablers %}
-<li>&lt; {{enabler.process.title.newest|e}}</li>
+
+<td class="cond_line_{{loop.index0 % 3}}">[{% if condition.is_active %}X{% else %}&nbsp;{% endif %}]</td>
+<td colspan=4 class="cond_line_{{loop.index0 % 3}}"><a href="condition?id={{condition.id_}}">{{condition.title.newest|e}}</a></td>
+
+{% for _ in conditions_present %}
+{% if outer_loop.index0 + loop.index0 < conditions_present|length %}
+<td class="cond_line_{{outer_loop.index0 % 3}}">
+{% else %}
+<td class="cond_line_{{(conditions_present|length - loop.index) % 3}}">
+{% endif %}
 {% endfor %}
-{% for disabler in node.disablers %}
-<li>! {{disabler.process.title.newest|e}}</li>
+{% set list_name = "todos_for_%s"|format(condition.id_) %}
+<td><input name="new_todo" list="{{list_name}}" autocomplete="off" /></td>
+{{ macros.datalist_of_titles(list_name, enablers_for[condition.id_]) }}
+</td>
+{% set list_name = "todos_against_%s"|format(condition.id_) %}
+<td><input name="new_todo" list="{{list_name}}" autocomplete="off" /></td>
+{{ macros.datalist_of_titles(list_name, disablers_for[condition.id_]) }}
+</td>
+</tr>
 {% endfor %}
-</ul>
-</li>
+
+<tr>
+{% for condition in conditions_present %}
+<td class="cond_line_{{loop.index0 % 3}}"></td>
 {% endfor %}
-<h4>todos</h4>
-<ul>
-{% for node in todo_trees %}
-{{ node_with_children(node, 0) }}
+<th colspan=5>doables</th>
+{% for condition in conditions_present %}
+<td class="cond_line_{{(conditions_present|length - loop.index) % 3}}"></td>
+{% endfor %}
+<th>comments</th>
+</tr>
+{% for node in top_nodes %}
+{{ show_node_undone(node, 0) }}
 {% endfor %}
-</ul>
-{% endblock %}
 
+</table>
+
+<h4>done</h4>
+
+<table>
+{% for node in top_nodes %}
+{{ show_node_done(node, 0, []) }}
+{% endfor %}
+</table>
+
+</form>
+
+{{ macros.datalist_of_titles("processes", processes) }}
+{% endblock %}