From 53b84307929582af2aaeac2247cc57db4a7bedf4 Mon Sep 17 00:00:00 2001
From: Christian Heller
Date: Wed, 20 Dec 2023 02:39:59 +0100
Subject: [PATCH] Improve todo accounting.
---
ledger.py | 42 ++--
todo.py | 401 +++++++++------------------------
todo_templates/base.html | 15 ++
todo_templates/calendar.html | 27 +++
todo_templates/day.html | 80 +++++++
todo_templates/tagfilters.html | 37 +++
todo_templates/task.html | 47 ++++
todo_templates/tasks.html | 27 +++
todo_templates/todo.html | 33 +++
todo_templates/watch_form.html | 19 ++
10 files changed, 415 insertions(+), 313 deletions(-)
create mode 100644 todo_templates/base.html
create mode 100644 todo_templates/calendar.html
create mode 100644 todo_templates/day.html
create mode 100644 todo_templates/tagfilters.html
create mode 100644 todo_templates/task.html
create mode 100644 todo_templates/tasks.html
create mode 100644 todo_templates/todo.html
create mode 100644 todo_templates/watch_form.html
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 @@
+
+
--
2.30.2