From: Christian Heller
Date: Wed, 20 Dec 2023 01:39:59 +0000 (+0100)
Subject: Improve todo accounting.
X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/do_day?a=commitdiff_plain;h=53b84307929582af2aaeac2247cc57db4a7bedf4;p=misc
Improve todo accounting.
---
diff --git a/ledger.py b/ledger.py
index 22e36a3..36cca98 100755
--- a/ledger.py
+++ b/ledger.py
@@ -46,13 +46,13 @@ booking_html = """
"""
add_form_header = """
"""
add_free_html = """
@@ -62,27 +62,27 @@ add_free_html = """
"""
add_structured_html = """
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
{% for line in booking_lines %}
-
-
-
-
-
-
-
+
+
+
+
+
+
+
{% endfor %}
{% for name, items in datalist_sets.items() %}
diff --git a/todo.py b/todo.py
index 6cade91..46108a8 100644
--- a/todo.py
+++ b/todo.py
@@ -4,198 +4,21 @@ from uuid import uuid4
from datetime import datetime, timedelta
from urllib.parse import parse_qs
from jinja2 import Template
+from jinja2 import Environment as JinjaEnv, FileSystemLoader as JinjaFSLoader
from urllib.parse import urlparse
db_path = '/home/plom/org/todo_new.json'
-# db_path = '/home/plom/public_repos/misc/todo_new.json'
server_port = 8082
DATE_FORMAT = '%Y-%m-%d'
-
-html_head = """
-
-
-tasks: list add | day:
-choose tasks
-do tasks
-| calendar
-| unset cookie
-
-"""
-form_footer = '\n'
-form_header_tmpl = """
-
+{% endblock %}
+
diff --git a/todo_templates/day.html b/todo_templates/day.html
new file mode 100644
index 0000000..5c63670
--- /dev/null
+++ b/todo_templates/day.html
@@ -0,0 +1,80 @@
+{% extends 'base.html' %}
+{% block css %}
+table.alternating tr:nth-child(even) {
+ background-color: #f2f2f2;
+}
+table.alternating tr:nth-child(odd) {
+ background-color: #ffffff;
+}
+td.checkbox, td.number { height: 0.1em; padding: 0em; text-align: center; }
+td.checkbox { width: 0.1em }
+td button { height: 1.5em; padding: 0em; margin: 0em }
+td details { display: inline }
+input[type="number"] { text-align: right; }
+{% endblock %}
+{% block content %}
+
+
+
+
+{% include 'watch_form.html' %}
+{% endblock %}
diff --git a/todo_templates/tagfilters.html b/todo_templates/tagfilters.html
new file mode 100644
index 0000000..3f784ea
--- /dev/null
+++ b/todo_templates/tagfilters.html
@@ -0,0 +1,37 @@
+
+
+
+
+mandatory tags:
+{% for and_filter in db.t_filter_and %}
+
+{% endfor %}
+
+
+forbidden tags:
+{% for not_filter in db.t_filter_not %}
+
+{% endfor %}
+
+
+
diff --git a/todo_templates/task.html b/todo_templates/task.html
new file mode 100644
index 0000000..56d0abe
--- /dev/null
+++ b/todo_templates/task.html
@@ -0,0 +1,47 @@
+{% extends 'base.html' %}
+{% block css %}
+th, td { vertical-align: top; text-align: left}
+td.input { width: 100%; }
+td.checkbox { width: 0.1em; height: 0.1em; padding: 0em; text-align: center; }
+input[type="number"] { text-align: right; }
+input[type="text"] { width: 100% }
+textarea { width: 100% };
+{% endblock %}
+{% block content %}
+
+
+{% include 'watch_form.html' %}
+{% endblock %}
diff --git a/todo_templates/tasks.html b/todo_templates/tasks.html
new file mode 100644
index 0000000..34976eb
--- /dev/null
+++ b/todo_templates/tasks.html
@@ -0,0 +1,27 @@
+{% extends 'base.html' %}
+{% block css %}
+table.alternating tr:nth-child(even) {
+ background-color: #f2f2f2;
+}
+table.alternating tr:nth-child(odd) {
+ background-color: #ffffff;
+}
+td.number { text-align: right; }
+{% endblock %}
+{% block content %}
+
+
+default weight | task | tags |
+{% for uuid, t in db.tasks.items() | sort(attribute='1.title') %}
+{% if t.visible %}
+
+{{ t.default_weight }} |
+{{ t.title|e }} |
+{% for tag in t.tags | sort %}{{ tag }} {% endfor %} |
+{% endif %}
+{% endfor %}
+
+{% endblock %}
+
diff --git a/todo_templates/todo.html b/todo_templates/todo.html
new file mode 100644
index 0000000..b3926da
--- /dev/null
+++ b/todo_templates/todo.html
@@ -0,0 +1,33 @@
+{% extends 'base.html' %}
+{% block css %}
+th, td { vertical-align: top; text-align: left}
+td.input { width: 100%; }
+td.checkbox { width: 0.1em; height: 0.1em; padding: 0em; text-align: center; }
+input[type="number"] { text-align: right; }
+input[type="text"] { width: 100% }
+textarea { width: 100% };
+{% endblock %}
+{% block content %}
+
+{% endblock %}
diff --git a/todo_templates/watch_form.html b/todo_templates/watch_form.html
new file mode 100644
index 0000000..979c1da
--- /dev/null
+++ b/todo_templates/watch_form.html
@@ -0,0 +1,19 @@
+
+