home · contact · privacy
In Day view, differentiate done and undone Todos, and collect doneness checkboxes.
[plomtask] / templates / day.html
index e3fe5ef29c5865551d42d751a5d45ea380921065..efa1c9bb1e78fc5ea455c5a678b4727fb22efdd3 100644 (file)
@@ -1,18 +1,50 @@
 {% extends 'base.html' %}
 
-{% macro node_with_children(node, indent) %}
-<li>{% for i in range(indent) %}+{% endfor %}
+
+{% macro show_node(node, indent) %}
 {% 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 %}
+{% for i in range(indent) %}&nbsp; {% endfor %} +
 {% if node.seen %}({% else %}{% endif %}<a href="todo?id={{node.item.id_}}">{{node.item.process.title.newest|e}}</a>{% if node.seen %}){% else %}{% endif %}
 {% 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 %}
+{% for i in range(indent) %}&nbsp;{% endfor %} +
+{% if node.seen %}({% else %}{% endif %}<a href="condition?id={{node.item.id_}}">{{node.item.title.newest|e}}</a>{% if node.seen %}){% else %}{% endif %}
+{% endif %}
+{% endmacro %}
+
+
+{% macro undone_with_children(node, indent) %}
+{% if not node.hide %}
+<tr>
+<td>
+{% if node.is_todo %}
+<input name="done" value="{{node.item.id_}}" type="checkbox" {% if node.seen or not node.item.is_doable %}disabled{% endif %} {% if node.item.is_done %} checked {% endif %} />
+{% endif %}
+</td>
+<td>
+{{ show_node(node, indent) }}
+</td>
+</tr>
+{% endif %}
+{% for child in node.children %}
+{{ undone_with_children(child, indent+1) }}
+{% endfor %}
+{% endmacro %}
+
+
+{% macro done_with_children(node, indent) %}
+{% if not node.hide %}
+<tr>
+<td>
+{{ show_node(node, indent) }}
+</td>
+</tr>
 {% endif %}
 {% for child in node.children %}
-{{ node_with_children(child, indent+1) }}
+{{ done_with_children(child, indent+1) }}
 {% endfor %}
 {% endmacro %}
 
+
 {% block content %}
 <h3>{{day.date}} / {{day.weekday}}</h3>
 <p>
@@ -27,25 +59,30 @@ add todo: <input name="new_todo" list="processes" autocomplete="off" />
 <option value="{{process.id_}}">{{process.title.newest|e}}</option>
 {% endfor %}
 </datalist>
-</form>
 <h4>conditions</h4>
+<ul>
 {% 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>
+({% for enabler in node.enablers %}
+&lt; {{enabler.process.title.newest|e}};
 {% endfor %}
 {% for disabler in node.disablers %}
-<li>! {{disabler.process.title.newest|e}}</li>
+! {{disabler.process.title.newest|e}};
+{% endfor %})
 {% endfor %}
 </ul>
-</li>
-{% endfor %}
-<h4>todos</h4>
-<ul>
+<h4>to do</h4>
+<table>
 {% for node in todo_trees %}
-{{ node_with_children(node, 0) }}
+{{ undone_with_children(node, indent=0) }}
 {% endfor %}
-</ul>
+</table>
+<h4>done</h4>
+<table>
+{% for node in done_trees %}
+{{ done_with_children(node, indent=0) }}
+{% endfor %}
+</table>
+</form>
 {% endblock %}