home · contact · privacy
Slightly improve and re-organize Condition tests.
[plomtask] / templates / day.html
index 0165c9ede5593a8cfde064c72d6bb45fc779a8ba..59cf55b46029da9850a4e95eb0279fb3fce7e756 100644 (file)
@@ -4,40 +4,38 @@
 
 
 {% block css %}
-td, th, tr, table {
-  padding: 0;
-  margin: 0;
-}
-table {
-  border-collapse: collapse;
-}
 th {
   border: 1px solid black;
 }
-td.cond_line_0 {
+td.cond_line {
+  padding: 0;
   border-top: 1px solid white;
-  background-color: #dddddd;
 }
-td.cond_line_1 {
-  border-top: 1px solid white;
-  background-color: #efefef;
+td.cond_0 {
+  background-color: #bfbfbf;
 }
-td.cond_line_2 {
-  border-top: 1px solid white;
-  background-color: #fffff;
+td.cond_1 {
+  background-color: #dfdfdf;
 }
-td.cond_line_corner {
+td.cond_2 {
+  background-color: fffff;
+}
+td.cond_shrink {
   max-width: 0px;
   white-space: nowrap;
   overflow: hidden;
   text-overflow: clip;
 }
 td.todo_line {
-  border-bottom: 1px solid #dddddd;
+  border-bottom: 1px solid #bfbfbf;
   height: 1.7em;
 }
-tr.inactive td.todo_line {
-  background-color: #efefef;
+tr.inactive > td.todo_line {
+  background-color: #bfbfbf;
+  border-bottom: 1px solid white;
+}
+tr.hidden_undone > td, tr.hidden_undone a {
+  color: #9f9f9f;
 }
 td.left_border {
   border-left: 1px solid black;
@@ -45,8 +43,8 @@ td.left_border {
 td.right_border {
   border-right: 1px solid black;
 }
-input {
-  height: 100%;
+input.ablers {
+  width: 50em;
 }
 {% endblock %}
 
@@ -60,11 +58,15 @@ input {
 {% endif %}
 
 {% for condition in conditions_present %}
-<td class="cond_line_{{loop.index0 % 3}}">
 {% if condition in node.todo.conditions and not condition.is_active %}
-O&nbsp;
+<td class="cond_line cond_{{loop.index0 % 3}}">
++&gt;
 {% elif condition in node.todo.blockers and condition.is_active %}
-!&nbsp;
+<td class="cond_line cond_{{loop.index0 % 3}}">
+-&gt;
+{% else %}
+<td class="cond_line cond_{{loop.index0 % 3}} cond_shrink">
+|
 {% endif %}
 </td>
 {% endfor %}
@@ -74,7 +76,7 @@ O&nbsp;
 <td class="todo_line">{% if node.todo.effort %}{{ node.todo.effort }}{% endif %}</td>
 {% else %}
 <td class="todo_line left_border"><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.effort_then}} value={{node.todo.effort}} /></td>
+<td class="todo_line"><input name="effort" type="number" step=0.1 placeholder={{node.todo.effort_then}} value={{node.todo.effort}} /></td>
 {% endif %}
 <td class="todo_line right_border">
 {% for i in range(indent) %}&nbsp; &nbsp; {% endfor %} +
@@ -82,14 +84,24 @@ O&nbsp;
 </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 %}&nbsp;+{% elif condition in node.todo.disables %}&nbsp;!{% endif %}</td>
+{% if condition in node.todo.enables %}
+<td class="cond_line cond_{{(conditions_present|length - loop.index) % 3}}">
++&gt;
+{% elif condition in node.todo.disables %}
+<td class="cond_line cond_{{(conditions_present|length - loop.index) % 3}}">
+-&gt;
+{% else %}
+<td class="cond_line cond_{{(conditions_present|length - loop.index) % 3}} cond_shrink">
+&nbsp;|
+{% endif %}
+</td>
 {% endfor %}
 
 <td colspan=2>
 {% if node.seen %}
 {{node.todo.comment|e}}
 {% else %}
-<input name="comment" value="{{node.todo.comment|e}}" style="width: 100%" />
+<input name="comment" type="text" value="{{node.todo.comment|e}}" />
 {% endif %}
 </td>
 
@@ -107,53 +119,55 @@ O&nbsp;
 
 
 {% 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.title_then|e}}</a>  &lt;- {% endfor %})
-</td>
-</tr>
-
-<tr>
-<td>
-&nbsp; +
-{% else %}
+{% if node.todo.has_doneness_in_path %}
+<tr{% if not node.todo.is_done %} class="hidden_undone"{% endif %}>
+<td class="number">{{ '{:4.1f}'.format(node.todo.performed_effort) }}</td>
+<td class="number">{{ '{:4.1f}'.format(node.todo.tree_effort) }}</td>
 <td>
-{% for i in range(indent) %}&nbsp; {% endfor %} +
-{% endif %}
-{% if node.seen %}({% endif %}<a href="todo?id={{node.todo.id_}}">{{node.todo.title_then|e}}</a> {% if node.todo.comment|length > 0 %}[{{node.todo.comment|e}}]{% endif %}{% if node.seen %}){% endif %}
-</td>
+{% for i in range(indent) %}&nbsp; &nbsp; {% endfor %} +
+{% if not node.todo.is_done %}({% endif %}{% if node.seen %}[{% endif %}<a href="todo?id={{node.todo.id_}}">{{node.todo.title_then|e}}</a>{% if node.seen %}]{% endif %}{% if not node.todo.is_done %}){% endif %}{% if node.todo.comment %} · {{node.todo.comment|e}}{% endif %}</td>
 </tr>
-
-{% endif %}
 {% if not node.seen %}
 {% for child in node.children %}
-{{ show_node_done(child, indent+1, path + [node]) }}
+{{ show_node_done(child, indent+1) }}
 {% endfor %}
 {% endif %}
-
+{% endif %}
 {% endmacro %}
 
 
 
 {% block content %}
-<h3>{{day.date}} / {{day.weekday}}</h3>
+<h3>{{day.date}} / {{day.weekday}} ({{day.total_effort|round(1)}})</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="day_comment" value="{{day.comment|e}}" />
-<input type="submit" value="OK" /><br />
-add todo: <input name="new_todo" list="processes" autocomplete="off" />
+
+<p>
+comment:
+<input name="day_comment" type="text" value="{{day.comment|e}}" />
+<input type="submit" value="OK" /></td>
+</p>
 
 <h4>to do</h4>
 
+<p>
+add: <input type="text" name="new_todo" list="processes">
+</p>
+<p>
+make new todos
+<select name="make_type">
+<option value="full">with</option>
+<option value="empty"{% if make_type == "empty" %}selected {% endif %}>without</option>
+</select>
+descendants (i.e. adopt where possible, otherwise create anew)
+</p>
+
 <table>
 
 <tr>
-<th colspan={{ conditions_present|length + 3 + conditions_present|length }}>states</th>
+<th colspan={{ conditions_present|length + 3 + conditions_present|length }}>conditions</th>
 <th>add enabler</th>
 <th>add disabler</th>
 </tr>
@@ -164,34 +178,34 @@ add todo: <input name="new_todo" list="processes" autocomplete="off" />
 
 {% for _ in conditions_present %}
 {% if outer_loop.index > loop.index %}
-<td class="cond_line_{{loop.index0 % 3}}">
+<td class="cond_line cond_{{loop.index0 % 3}} cond_shrink">|
 {% elif outer_loop.index < loop.index %}
-<td class="cond_line_{{outer_loop.index0 % 3}}">
+<td class="cond_line cond_{{outer_loop.index0 % 3}}">
 {% else %}
-<td class="cond_line_{{outer_loop.index0 % 3}} cond_line_corner">X
+<td class="cond_line cond_{{outer_loop.index0 % 3}} cond_shrink">/
 {% endif %}
 </td>
 {% endfor %}
 
-<td class="cond_line_{{loop.index0 % 3}}">[{% if condition.is_active %}X{% else %}&nbsp;{% endif %}]</td>
-<td colspan=2 class="cond_line_{{loop.index0 % 3}}"><a href="condition?id={{condition.id_}}">{{condition.title.at(day.date)|e}}</a></td>
+<td class="cond_line cond_{{loop.index0 % 3}}"><input type="checkbox" disabled{% if condition.is_active %} checked{% endif %}></td>
+<td colspan=2 class="cond_line cond_{{loop.index0 % 3}}"><a href="condition?id={{condition.id_}}">{{condition.title.at(day.date)|e}}</a></td>
 
 {% for _ in conditions_present %}
 {% if outer_loop.index0 + loop.index < conditions_present|length %}
-<td class="cond_line_{{outer_loop.index0 % 3}}">
+<td class="cond_line cond_{{outer_loop.index0 % 3}}">
 {% elif outer_loop.index0 + loop.index > conditions_present|length %}
-<td class="cond_line_{{(conditions_present|length - loop.index) % 3}}">
+<td class="cond_line cond_{{(conditions_present|length - loop.index) % 3}} cond_shrink">&nbsp;|
 {% else %}
-<td class="cond_line_{{outer_loop.index0 % 3}} cond_line_corner">&nbsp;X
+<td class="cond_line cond_{{outer_loop.index0 % 3}} cond_shrink">&nbsp;\
 {% endif %}
 {% endfor %}
 
 {% set list_name = "todos_for_%s"|format(condition.id_) %}
-<td><input name="new_todo" list="{{list_name}}" autocomplete="off" /></td>
+<td><input class="ablers" type="text" 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>
+<td><input class="ablers" type="text" name="new_todo" list="{{list_name}}" autocomplete="off" /></td>
 {{ macros.datalist_of_titles(list_name, disablers_for[condition.id_]) }}
 </td>
 </tr>
@@ -199,11 +213,11 @@ add todo: <input name="new_todo" list="processes" autocomplete="off" />
 
 <tr>
 {% for condition in conditions_present %}
-<td class="cond_line_{{loop.index0 % 3}}"></td>
+<td class="cond_line cond_{{loop.index0 % 3}} cond_shrink">|</td>
 {% endfor %}
-<th class="left_border right_border vertical_borders" colspan=3>doables</th>
+<th colspan=3>doables</th>
 {% for condition in conditions_present %}
-<td class="cond_line_{{(conditions_present|length - loop.index) % 3}}"></td>
+<td class="cond_line cond_{{(conditions_present|length - loop.index) % 3}} cond_shrink">&nbsp;|</td>
 {% endfor %}
 <th colspan=2>comments</th>
 </tr>
@@ -215,7 +229,13 @@ add todo: <input name="new_todo" list="processes" autocomplete="off" />
 
 <h4>done</h4>
 
-<table>
+<table class="alternating">
+<tr>
+<th colspan=2>effort</th><th rowspan=2>action · comment</th>
+</tr>
+<tr>
+<th>self</th><th>tree</th>
+</tr>
 {% for node in top_nodes %}
 {{ show_node_done(node, 0, []) }}
 {% endfor %}