home · contact · privacy
Imporove todo accounting.
[misc] / todo_templates / day.html
index a6ad249f55baedbebfd50241b1528db1deb553ed..7dd8f66fa99c28e55f8a892cc1a05543e8e02305 100644 (file)
@@ -31,40 +31,41 @@ comment: <input name="day_comment" value="{{ db.selected_day.comment|e }}">
 <input type="hidden" name="selected_date" value="{{ db.selected_date }}" />
 </p>
 <table class="alternating">
-<tr><th>task</th><th class="checkbox">choose?</th><th class="checkbox">done?</th><th>weight</th><th>edit?</th><th>day tags</th><th>comment</th></tr>
-{% for uuid, t in db.tasks.items() | sort(attribute='1.title') %}
-{% if t.visible and (uuid not in db.selected_day.todos.keys() or db.selected_day.todos[uuid].visible) %}
+<tr><th><a href="?sort=title">task</a></th><th><a href="?sort=chosen">choose?</a></th><th><a href="?sort=done">done?</a></th><th><a href="?sort=default_effort">effort</a></th><th><a href="?sort=importance">importance</a></th><th>edit?</th><th>day tags</th><th><a href="?sort=comment">comment</a></th></tr>
+{% for row in task_rows %}
 <tr>
-<input name="t_uuid" value="{{ uuid }}" type="hidden" >
-<td><details><summary>] <a href="{{db.prefix}}/task?id={{ uuid }}" />{{ t.current_title|e }}</a></summary>tags: {% for tag in t.tags | sort %}<a href="{{db.prefix}}/day?t_and={{tag|e}}">{{ tag }}</a> {% endfor %}</details></td>
-{% if uuid in db.selected_day.todos.keys() %}
-<td class="checkbox"><input name="choose" type="checkbox" value="{{ uuid }}" checked></td>
-<td class="checkbox"><input name="done" type="checkbox" value="{{ uuid }}" {% if db.selected_day.todos[uuid].done %}checked{% endif %}></td>
-<td class="number"><input class="day_weight_input" name="day_weight" type="number" step=0.1 size=8 value="{% if db.selected_day.todos[uuid].day_weight is not none %}{{ db.selected_day.todos[uuid].day_weight }}{% endif %}" placeholder={{ t.current_default_weight }} ></td>
-<td><a href="{{db.prefix}}/todo?task={{uuid}}&date={{ db.selected_date }}">edit</a></td>
-<td>{% for tag in db.selected_day.todos[uuid].day_tags | sort %}<a href="{{db.prefix}}/tags?t_and={{tag|e}}">{{ tag }}</a> {% endfor %}</td>
-<td>{{ db.selected_day.todos[uuid].comment|e }}</td>
+<input name="t_uuid" value="{{ row.uuid }}" type="hidden" >
+<td><details><summary>] <a href="{{db.prefix}}/task?id={{ row.uuid }}" />{{ row.task.current_title|e }}</a></summary>tags: {% for tag in row.task.tags | sort %}<a href="{{db.prefix}}/day?t_and={{tag|e}}">{{ tag }}</a> {% endfor %}</details></td>
+{% if row.todo %}
+<td class="checkbox"><input name="choose" type="checkbox" value="{{ row.uuid }}" checked></td>
+<td class="checkbox"><input name="done" type="checkbox" value="{{ row.uuid }}" {% if row.todo.done %}checked{% endif %}></td>
+<td class="number"><input class="day_effort_input" name="day_effort" type="number" step=0.1 size=8 value="{% if row.todo.day_effort is not none %}{{ row.todo.day_effort }}{% endif %}" placeholder={{ row.task.current_default_effort }} ></td>
+<td class="number"><input name="importance" type="number" step=0.1 size=8 value="{{row.todo.importance}}" ></td>
+<td><a href="{{db.prefix}}/todo?task={{row.uuid}}&date={{db.selected_date}}">edit</a></td>
+<td>{% for tag in row.todo.day_tags | sort %}<a href="{{db.prefix}}/tags?t_and={{tag|e}}">{{ tag }}</a> {% endfor %}</td>
+<td>{{ row.todo.comment|e }}</td>
 {% else %}
-<td class="checkbox"><input name="choose" type="checkbox" value="{{ uuid }}"</td>
-<td class="checkbox"><input name="done" type="checkbox" value="{{ uuid }}"></td>
-<td class="number"><input class="day_weight_input" name="day_weight" type="number" step=0.1 size=8 placeholder={{ t.current_default_weight }} ></td>
+<td class="checkbox"><input name="choose" type="checkbox" value="{{ row.uuid }}"</td>
+<td class="checkbox"><input name="done" type="checkbox" value="{{ row.uuid }}"></td>
+<td class="number"><input class="day_effort_input" name="day_effort" type="number" step=0.1 size=8 placeholder={{ row.task.current_default_effort }} ></td>
+<td class="number"><input name="importance" type="number" step=0.1 size=8 value="1.0" ></td>
+<td><a href="{{db.prefix}}/todo?task={{row.uuid}}&date={{db.selected_date}}">edit</a></td>
 <td></td>
 <td></td>
 <td></td>
 {% endif %}
 </tr>
-{% endif %}
 {% endfor %}
 </table>
 <input type="submit" value="update">
 </form>
 {% include 'watch_form.html' %}
 <script>
-var day_weight_inputs = document.getElementsByClassName("day_weight_input");
-for (let i = 0; i < day_weight_inputs.length; i++) {
-    let input = day_weight_inputs[i];
+var day_effort_inputs = document.getElementsByClassName("day_effort_input");
+for (let i = 0; i < day_effort_inputs.length; i++) {
+    let input = day_effort_inputs[i];
     let button = document.createElement('button');
-    button.innerHTML = '+1×';
+    button.innerHTML = '+' + input.placeholder;
     button.onclick = function(event) {
         event.preventDefault();
         if (input.value) {