home · contact · privacy
In Day view, differentiate done and undone Todos, and collect doneness checkboxes.
[plomtask] / templates / day.html
1 {% extends 'base.html' %}
2
3
4 {% macro show_node(node, indent) %}
5 {% if node.is_todo %}
6 {% for i in range(indent) %}  {% endfor %} +
7 {% if node.seen %}({% else %}{% endif %}<a href="todo?id={{node.item.id_}}">{{node.item.process.title.newest|e}}</a>{% if node.seen %}){% else %}{% endif %}
8 {% else %}
9 {% for i in range(indent) %}&nbsp;{% endfor %} +
10 {% if node.seen %}({% else %}{% endif %}<a href="condition?id={{node.item.id_}}">{{node.item.title.newest|e}}</a>{% if node.seen %}){% else %}{% endif %}
11 {% endif %}
12 {% endmacro %}
13
14
15 {% macro undone_with_children(node, indent) %}
16 {% if not node.hide %}
17 <tr>
18 <td>
19 {% if node.is_todo %}
20 <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 %} />
21 {% endif %}
22 </td>
23 <td>
24 {{ show_node(node, indent) }}
25 </td>
26 </tr>
27 {% endif %}
28 {% for child in node.children %}
29 {{ undone_with_children(child, indent+1) }}
30 {% endfor %}
31 {% endmacro %}
32
33
34 {% macro done_with_children(node, indent) %}
35 {% if not node.hide %}
36 <tr>
37 <td>
38 {{ show_node(node, indent) }}
39 </td>
40 </tr>
41 {% endif %}
42 {% for child in node.children %}
43 {{ done_with_children(child, indent+1) }}
44 {% endfor %}
45 {% endmacro %}
46
47
48 {% block content %}
49 <h3>{{day.date}} / {{day.weekday}}</h3>
50 <p>
51 <a href="day?date={{day.prev_date}}">prev</a> | <a href="day?date={{day.next_date}}">next</a>
52 </p>
53 <form action="day?date={{day.date}}" method="POST">
54 comment: <input name="comment" value="{{day.comment|e}}" />
55 <input type="submit" value="OK" /><br />
56 add todo: <input name="new_todo" list="processes" autocomplete="off" />
57 <datalist id="processes">
58 {% for process in processes %}
59 <option value="{{process.id_}}">{{process.title.newest|e}}</option>
60 {% endfor %}
61 </datalist>
62 <h4>conditions</h4>
63 <ul>
64 {% for node in condition_listings %}
65 <li>[{% if node.condition.is_active %}x{% else %} {% endif %}] <a href="condition?id={{node.condition.id_}}">{{node.condition.title.newest|e}}</a>
66 ({% for enabler in node.enablers %}
67 &lt; {{enabler.process.title.newest|e}};
68 {% endfor %}
69 {% for disabler in node.disablers %}
70 ! {{disabler.process.title.newest|e}};
71 {% endfor %})
72 {% endfor %}
73 </ul>
74 <h4>to do</h4>
75 <table>
76 {% for node in todo_trees %}
77 {{ undone_with_children(node, indent=0) }}
78 {% endfor %}
79 </table>
80 <h4>done</h4>
81 <table>
82 {% for node in done_trees %}
83 {{ done_with_children(node, indent=0) }}
84 {% endfor %}
85 </table>
86 </form>
87 {% endblock %}
88