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