home · contact · privacy
3ffbf79f70ee91a7f7eb94d547c3536b784db099
[misc] / todo_templates / pick_tasks.html
1 {% extends 'base.html' %}
2
3 {% block css %}
4 #pick_upper, #pick_lower { margin-right: 1em; }
5 {% endblock %}
6
7 {% block content %}
8 <h3>pick todos for day</h3>
9
10 <form id="form_to_watch" action="pick_tasks" method="POST">
11 {% include 'tagfilters.html' %}
12 <br />
13 <input name="hide_chosen_tasks" type="checkbox" {% if hide_chosen_tasks %}checked{% endif %} /> hide chosen tasks<br />
14 search: <input name="search" value="{{search|e}}" />
15 <input type="submit" name="filter" value="filter" />
16
17 <p>
18 <a href="pick_tasks?date={{prev_date}}">prev</a> | {{day.date}} | <a href="pick_tasks?date={{next_date}}">next</a> | {{day.comment}}
19 </p>
20
21 <input type="hidden" name="date" value="{{day.date}}" />
22 <input class="update" id="pick_upper" name="update" type="submit" value="pick" />
23 <input type="hidden" name="search" value="{{search|e}}" />
24 <table class="alternating">
25 <tr>
26 <th>do</th>
27 <th {% if sort=='effort' %}class="desc"{% endif %}>
28 <a href="?sort=effort">effort</a>
29 </th>
30 <th {% if sort=='title' %}class="desc"{% endif %}>
31 <a href="?sort=title">what</a>
32 </th>
33 <th>comment</th>
34 </tr>
35
36 {% for todo in chosen_todos %}
37 <tr>
38 <td class="checkbox">
39 <input name="chosen_todo" {% if todo.done or todo.day_effort %}class="protected"{% endif %} type="checkbox" value="{{todo.id_}}" checked>
40 </td>
41 <td class="number">
42 {% if todo.day_effort %}{{todo.day_effort}}&nbsp;{% else %}({{todo.default_effort}}){% endif %}{% if todo.done and not "cancelled" in todo.contemporary_tags%}✓{% else %}&nbsp;{% endif %}
43 </td>
44 <td>
45 <a href="todo?id={{todo.id_}}&return_to=pick_tasks">
46 {% if "cancelled" in todo.tags.now %}<s>{% endif %}
47 {{todo.path|e}}{{todo.title|e}}
48 {%if "cancelled" in todo.tags.now %}</s>{% endif %}
49 </a>
50 </td>
51 <td>
52 {{todo.comment|e}}
53 </td>
54 </tr>
55 {% endfor %}
56
57 <tr>
58 <th colspan=4>earlier todos to continue</th>
59 </tr>
60
61 {% for todo in relevant_todos %}
62 <tr>
63 <td class="checkbox">
64 <input name="choose_todo" type="checkbox" value="{{todo.id_}}">
65 </td>
66 <td class="number">
67 {{todo.all_days_effort}}/{{todo.default_effort}}
68 </td>
69 <td>
70 <a href="todo?id={{todo.id_}}">{{todo.day.date}} {{todo.task.title.then|e}}</a>
71 </td>
72 <td>
73 {{todo.comment|e}}
74 </td>
75 </tr>
76 {% endfor %}
77
78 <tr>
79 <th colspan=4>tasks</th>
80 </tr>
81
82 {% for task in tasks %}
83 <tr>
84 <td class="checkbox">
85 <input name="choose_task" type="checkbox" value="{{task.id_}}">
86 </td>
87 <td class="number">
88 ({{task.default_effort.then}})&nbsp;
89 </td>
90 <td>
91 <a href="task?id={{ task.id_ }}&return_to=pick_tasks" />{{ task.title.then|e }}</a>
92 </td>
93 <td>
94 {{task.comment|e}}
95 </td>
96 </tr>
97 {% endfor %}
98
99 </table>
100 <input class="update" id="pick_lower" name="update" type="submit" value="pick" />
101 </form>
102
103 {% include 'watch_form.html' %}
104 <script>
105 function make_selectables_toggler(neighbor_id, input_name) {
106     var neighbor = document.getElementById(neighbor_id);
107     var button = document.createElement('button');
108     button.textContent = 'toggle selectables';
109     button.onclick = function(event) {
110         event.preventDefault();
111         let checkboxes = document.getElementsByName(input_name);
112         for (let i = 0; i < checkboxes.length; i++) {
113             if (checkboxes[i].classList.contains('protected')) { 
114                 continue;       
115         }
116             checkboxes[i].click();
117             changes_to_comit = true;
118         }
119     }
120     neighbor.insertAdjacentElement('afterend', button);
121 }
122 make_selectables_toggler('pick_upper', 'chosen_todo');
123 make_selectables_toggler('pick_lower', 'choose_task');
124 </script>
125 {% endblock %}