home · contact · privacy
Some Day template layout improvements.
[plomtask] / templates / day.html
index efa1c9bb1e78fc5ea455c5a678b4727fb22efdd3..6d927fdb1c09ab1f2d1fc1e9fa48a0bfef814b20 100644 (file)
-{% extends 'base.html' %}
+{% extends '_base.html' %}
+{% import '_macros.html' as macros %}
 
 
-{% macro show_node(node, indent) %}
-{% if node.is_todo %}
-{% for i in range(indent) %}  {% 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 %}
-{% 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 %}
+
+{% block css %}
+table {
+  border-collapse: collapse;
+}
+th {
+  border: 1px solid black;
+}
+td.cond_line_0, td.cond_line_1, td.cond_line_2 {
+  padding: 0;
+  border-top: 1px solid white;
+}
+td.cond_line_0 {
+  background-color: #bfbfbf;
+}
+td.cond_line_1 {
+  background-color: #dfdfdf;
+}
+td.cond_line_2 {
+  background-color: #fffff;
+}
+td.cond_line_corner {
+  max-width: 0px;
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: clip;
+}
+td.todo_line {
+  border-bottom: 1px solid #bfbfbf;
+  height: 1.7em;
+}
+tr.inactive > td.todo_line {
+  background-color: #bfbfbf;
+}
+tr.hidden_undone > td, tr.hidden_undone a {
+  color: #9f9f9f;
+}
+td.left_border {
+  border-left: 1px solid black;
+}
+td.right_border {
+  border-right: 1px solid black;
+}
+input.ablers {
+  width: 50em;
+}
+{% endblock %}
+
+
+
+{% macro show_node_undone(node, indent) %}
+{% if not node.todo.is_done %}
+<tr {% if node.seen or not node.todo.is_doable %}class="inactive"{% endif %}>
+{% if not node.seen %}
+<input type="hidden" name="todo_id" value="{{node.todo.id_}}" />
 {% endif %}
-{% endmacro %}
 
+{% 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;
+{% elif condition in node.todo.blockers and condition.is_active %}
+!&nbsp;
+{% endif %}
+</td>
+{% endfor %}
 
-{% 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 %} />
+{% if node.seen %}
+<td class="todo_line left_border"></td>
+<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>
 {% endif %}
+<td class="todo_line right_border">
+{% for i in range(indent) %}&nbsp; &nbsp; {% endfor %} +
+{% if node.seen %}({% endif %}<a href="todo?id={{node.todo.id_}}">{{node.todo.title_then|e}}</a>{% if node.seen %}){% endif %}
 </td>
-<td>
-{{ show_node(node, indent) }}
+
+{% for condition in conditions_present|reverse %}
+<td class="cond_line_{{(conditions_present|length - loop.index) % 3}}">{% if condition in node.todo.enables %}&nbsp;+{% elif condition in node.todo.disables %}&nbsp;!{% endif %}</td>
+{% endfor %}
+
+<td colspan=2>
+{% if node.seen %}
+{{node.todo.comment|e}}
+{% else %}
+<input name="comment" type="text" value="{{node.todo.comment|e}}" />
+{% endif %}
 </td>
+
 </tr>
 {% endif %}
+
+{% if not node.seen %}
 {% for child in node.children %}
-{{ undone_with_children(child, indent+1) }}
+{{ show_node_undone(child, indent+1) }}
 {% endfor %}
+{% endif %}
+
 {% endmacro %}
 
 
-{% macro done_with_children(node, indent) %}
-{% if not node.hide %}
-<tr>
+
+{% macro show_node_done(node, indent, path) %}
+{% if node.todo.has_doneness_in_path %}
+<tr{% if not node.todo.is_done %} class="hidden_undone"{% endif %}>
 <td>
-{{ show_node(node, indent) }}
+{% for i in range(indent) %}&nbsp; &nbsp; {% endfor %} +
+{% if not node.todo.is_done %}({% endif %}<a href="todo?id={{node.todo.id_}}">{{node.todo.title_then|e}}</a>{% if not node.todo.is_done %}){% endif %}
 </td>
+<td>{{node.todo.comment|e}}</td>
 </tr>
-{% endif %}
+
+{% if not node.seen %}
 {% for child in node.children %}
-{{ done_with_children(child, indent+1) }}
+{{ show_node_done(child, indent+1) }}
 {% endfor %}
+{% endif %}
+{% 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}}" />
-<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>
+
+<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>
+
+<table>
+
+<tr>
+<th colspan={{ conditions_present|length + 3 + conditions_present|length }}>conditions</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}}">
+{% elif outer_loop.index < loop.index %}
+<td class="cond_line_{{outer_loop.index0 % 3}}">
+{% else %}
+<td class="cond_line_{{outer_loop.index0 % 3}} cond_line_corner">×
+{% endif %}
+</td>
 {% endfor %}
-</datalist>
-<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>
-({% for enabler in node.enablers %}
-&lt; {{enabler.process.title.newest|e}};
+
+<td class="cond_line_{{loop.index0 % 3}}"><input type="checkbox" disabled{% if condition.is_active %} checked{% 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>
+
+{% for _ in conditions_present %}
+{% if outer_loop.index0 + loop.index < conditions_present|length %}
+<td class="cond_line_{{outer_loop.index0 % 3}}">
+{% elif outer_loop.index0 + loop.index > conditions_present|length %}
+<td class="cond_line_{{(conditions_present|length - loop.index) % 3}}">
+{% else %}
+<td class="cond_line_{{outer_loop.index0 % 3}} cond_line_corner">&nbsp;×
+{% endif %}
 {% endfor %}
-{% for disabler in node.disablers %}
-! {{disabler.process.title.newest|e}};
-{% endfor %})
+
+{% set list_name = "todos_for_%s"|format(condition.id_) %}
+<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 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>
 {% endfor %}
-</ul>
-<h4>to do</h4>
-<table>
-{% for node in todo_trees %}
-{{ undone_with_children(node, indent=0) }}
+
+<tr>
+{% for condition in conditions_present %}
+<td class="cond_line_{{loop.index0 % 3}}"></td>
+{% endfor %}
+<th colspan=3>doables</th>
+{% for condition in conditions_present %}
+<td class="cond_line_{{(conditions_present|length - loop.index) % 3}}"></td>
 {% endfor %}
+<td colspan=2></td>
+</tr>
+{% for node in top_nodes %}
+{{ show_node_undone(node, 0) }}
+{% endfor %}
+
 </table>
+
 <h4>done</h4>
+
 <table>
-{% for node in done_trees %}
-{{ done_with_children(node, indent=0) }}
+{% for node in top_nodes %}
+{{ show_node_done(node, 0, []) }}
 {% endfor %}
 </table>
+
 </form>
-{% endblock %}
 
+{{ macros.datalist_of_titles("processes", processes) }}
+{% endblock %}