home · contact · privacy
Improve todo accounting script.
[misc] / todo_templates / do_todos.html
index 7a8ae82158217427993f414e4f9ee13b7aa70b1c..129018f257e77ad2e0b4b38056fefe39bfd468c3 100644 (file)
@@ -1,69 +1,72 @@
 {% extends 'base.html' %}
+
 {% block css %}
-table.alternating tr:nth-child(even) {
-    background-color: #cccccc;
-}
-table.alternating tr:nth-child(odd) {
-    background-color: #ffffff;
-}
-th, td { text-align: left}
-th.desc { background: linear-gradient(to bottom, white, grey); }
-th.center { text-align: center; }
-td.checkbox, td.number { height: 0.1em; padding: 0em; text-align: center; }
-td.checkbox { width: 0.1em; text-align: center; }
-td button { height: 1.5em; padding: 0em; margin: 0em }
-input[type="number"] { text-align: right; }
-th.desc { background: linear-gradient(to bottom, white, grey); }
+td.number, td.checkbox { text-align: center; }
+td { vertical-align: middle; }
+td button { padding: 0em; }
+th.centered { text-align: center; }
 {% endblock %}
+
 {% block content %}
-<form action="do_todos" method="POST">
+<h3>do todos</h3>
+
+<form id="form_to_watch" action="do_todos" method="POST">
 {% include 'tagfilters.html' %}
 <br />
 <input name="hide_done" type="checkbox" {% if hide_done %}checked{% endif %} /> hide done
 <input type="submit" name="filter" value="filter" />
-</form>
-<h3>do day</h3>
-<form id="form_to_watch" action="do_todos" method="POST">
 <p>
 | <a href="do_todos?date={{prev_date}}">prev</a> | {{day.date}} | <a href="do_todos?date={{next_date}}">next</a> | 
 comment: <input name="day_comment" value="{{day.comment|e}}">
-<input type="submit" value="update">
+<input class="update" type="submit" name="update" value="update">
 <input type="hidden" name="date" value="{{day.date}}" />
 </p>
+
 <table class="alternating">
 <tr>
-<th {% if sort=='done' %}class="desc"{% endif %}><a href="?sort=done">done</a></th>
-<th class="center{% if sort=='default_effort' %} desc{% endif %}"><a href="?sort=default_effort">effort</a></th>
-<th {% if sort=='importance' %}class ="desc"{% endif %}><a href="?sort=importance">importance</a></th>
-<th {% if sort=='title' %}class="desc"{% endif %}><a href="?sort=title">todo</a></th>
+<th {% if sort=='done' %}class="desc"{% endif %}>
+<a href="?sort=done">done</a>
+</th>
+<th class="centered{% if sort=='default_effort' %} desc{% endif %}">
+<a href="?sort=default_effort">effort</a>
+</th>
+<th {% if sort=='importance' %}class ="desc"{% endif %}>
+<a href="?sort=importance">importance</a>
+</th>
+<th {% if sort=='title' %}class="desc"{% endif %}>
+<a href="?sort=title">todo</a>
+</th>
 <th>comment</th>
+</tr>
+
 {% for todo in todos %}
 <tr>
 <input name="todo_id" value="{{todo.id_}}" type="hidden" >
 <td class="checkbox">
-{% if todo.children %}
-{% if todo.done %}✓{% else %}&nbsp;&nbsp;{% endif %}
-{% else %}
 <input name="done" type="checkbox" value="{{todo.id_}}" {% if todo.done %}checked{% endif %}>
-{% endif %}
 </td>
 <td class="number">
-{% if todo.children %}
-<input type="hidden" name="effort" value="0" />
-{% else %}
 <input class="effort_input" name="effort" type="number" step=0.1 size=7 value="{% if todo.day_effort is not none %}{{todo.day_effort}}{% endif %}" placeholder={{"%.1f"|format(todo.task.default_effort.then)}} >
-{% endif %}
 </td>
-<td class="number"><input name="importance" type="number" step=0.1 size=7 value={{todo.importance}} } ></td>
-<td><a href="todo?id={{todo.id_}}">{{todo.path}}{{todo.title}}</a></td>
-<td><input name="effort_comment" type="text" size=100 value="{{todo.comment|e}}" /></td>
+<td class="number">
+<input name="importance" type="number" step=0.1 size=7 value={{todo.importance}} } >
+</td>
+<td>
+<a href="todo?id={{todo.id_}}&return_to=do_todos">{{todo.path}}{{todo.title}}</a>
+</td>
+<td>
+<input name="effort_comment" type="text" size=100 value="{{todo.comment|e}}" />
+</td>
 </tr>
 {% endfor %}
+
 </table>
-<input type="submit" value="update">
+<input class="update" type="submit" name="update" value="update">
 </form>
+
 {% include 'watch_form.html' %}
 <script>
+mere_filter_inputs = mere_filter_inputs.concat(['hide_done']);
 var effort_inputs = document.getElementsByClassName("effort_input");
 for (let i = 0; i < effort_inputs.length; i++) {
     let input = effort_inputs[i];
@@ -77,7 +80,7 @@ for (let i = 0; i < effort_inputs.length; i++) {
             input.value = parseFloat(input.placeholder);
         }
         input.value = parseFloat(input.value).toFixed(1);
-        formHasChanged = true; 
+        changes_to_commit = true; 
     };
     input.insertAdjacentElement('afterend', button);
 }