home · contact · privacy
Add VersionedAttribute history display pages for Processes.
authorChristian Heller <c.heller@plomlompom.de>
Sat, 18 May 2024 02:47:49 +0000 (04:47 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Sat, 18 May 2024 02:47:49 +0000 (04:47 +0200)
plomtask/http.py
templates/process.html
templates/process_descriptions.html [new file with mode: 0644]
templates/process_efforts.html [new file with mode: 0644]
templates/process_titles.html [new file with mode: 0644]

index 98bb49f2d18c4789521c488195d9471375d77963..2c7e628bdd14fd572a29c5686a5d3a5a37ceb409 100644 (file)
@@ -94,8 +94,9 @@ class TaskHandler(BaseHTTPRequestHandler):
         """Handle any GET request."""
         try:
             self._init_handling()
-            if self.site in {'calendar', 'day', 'process', 'processes', 'todo',
-                             'condition', 'conditions'}:
+            if self.site in {'calendar', 'day', 'process', 'process_titles',
+                             'process_descriptions', 'process_efforts',
+                             'processes', 'todo', 'condition', 'conditions'}:
                 template = f'{self.site}.html'
                 ctx = getattr(self, f'do_GET_{self.site}')()
                 html = self.server.jinja.get_template(template).render(**ctx)
@@ -156,7 +157,7 @@ class TaskHandler(BaseHTTPRequestHandler):
         return {'condition': Condition.by_id(self.conn, id_, create=True)}
 
     def do_GET_process(self) -> dict[str, object]:
-        """Show process of ?id=."""
+        """Show Process of ?id=."""
         id_ = self.params.get_int_or_none('id')
         process = Process.by_id(self.conn, id_, create=True)
         return {'process': process,
@@ -165,6 +166,24 @@ class TaskHandler(BaseHTTPRequestHandler):
                 'step_candidates': Process.all(self.conn),
                 'condition_candidates': Condition.all(self.conn)}
 
+    def do_GET_process_titles(self) -> dict[str, object]:
+        """Show title history of Process of ?id=."""
+        id_ = self.params.get_int_or_none('id')
+        process = Process.by_id(self.conn, id_)
+        return {'process': process}
+
+    def do_GET_process_descriptions(self) -> dict[str, object]:
+        """Show description historys of Process of ?id=."""
+        id_ = self.params.get_int_or_none('id')
+        process = Process.by_id(self.conn, id_)
+        return {'process': process}
+
+    def do_GET_process_efforts(self) -> dict[str, object]:
+        """Show default effort history of Process of ?id=."""
+        id_ = self.params.get_int_or_none('id')
+        process = Process.by_id(self.conn, id_)
+        return {'process': process}
+
     def do_GET_processes(self) -> dict[str, object]:
         """Show all Processes."""
         return {'processes': Process.all(self.conn)}
index 5aebe53aaecf8f49b6e8440da36c5987c0e24d3e..d833c52a838e143c27452aa962936c88eb8a815e 100644 (file)
@@ -42,17 +42,17 @@ add: <input name="new_step_to_{{step_id}}" list="candidates" autocomplete="off"
 
 <tr>
 <th>title</th>
-<td><input name="title" value="{{process.title.newest|e}}" /></td>
+<td><input name="title" value="{{process.title.newest|e}}" />{% if process.id_ %} [<a href="process_titles?id={{process.id_}}">history</a>]{% endif %}</td>
 </tr>
 
 <tr>
 <th>default effort</th>
-<td><input name="effort" type="number" step=0.1 value={{process.effort.newest}} /></td>
+<td><input name="effort" type="number" step=0.1 value={{process.effort.newest}} />{% if process.id_ %} [<a href="process_efforts?id={{process.id_}}">history</a>]{% endif %}</td>
 </tr>
 
 <tr>
 <th>description</th>
-<td><textarea name="description">{{process.description.newest|e}}</textarea></td>
+<td><textarea name="description">{{process.description.newest|e}}</textarea><br />{% if process.id_ %} [<a href="process_descriptions?id={{process.id_}}">history</a>]{% endif %}</td>
 </tr>
 
 <tr>
diff --git a/templates/process_descriptions.html b/templates/process_descriptions.html
new file mode 100644 (file)
index 0000000..f1b93cb
--- /dev/null
@@ -0,0 +1,23 @@
+{% extends '_base.html' %}
+
+
+
+{% block content %}
+<h3>process description history</h3>
+<table>
+
+<tr>
+<th>process</th>
+<td><a href="process?id={{process.id_}}">{{process.title.newest|e}}</a></td>
+</tr>
+
+{% for date in process.description.history.keys() | sort(reverse=True) %}
+<tr>
+<th>{{date | truncate(19, True, '') }}</th>
+<td><pre>{{process.description.history[date]}}</pre></td>
+</tr>
+{% endfor %}
+
+</table>
+{% endblock %}
+
diff --git a/templates/process_efforts.html b/templates/process_efforts.html
new file mode 100644 (file)
index 0000000..31efcc3
--- /dev/null
@@ -0,0 +1,23 @@
+{% extends '_base.html' %}
+
+
+
+{% block content %}
+<h3>process default effort history</h3>
+<table>
+
+<tr>
+<th>process</th>
+<td><a href="process?id={{process.id_}}">{{process.title.newest|e}}</a></td>
+</tr>
+
+{% for date in process.effort.history.keys() | sort(reverse=True) %}
+<tr>
+<th>{{date | truncate(19, True, '') }}</th>
+<td>{{process.effort.history[date]}}</td>
+</tr>
+{% endfor %}
+
+</table>
+{% endblock %}
+
diff --git a/templates/process_titles.html b/templates/process_titles.html
new file mode 100644 (file)
index 0000000..574ef1c
--- /dev/null
@@ -0,0 +1,22 @@
+{% extends '_base.html' %}
+
+
+
+{% block content %}
+<h3>process title history</h3>
+<table>
+
+<tr>
+<th>process</th>
+<td><a href="process?id={{process.id_}}">{{process.title.newest|e}}</a></td>
+</tr>
+
+{% for date in process.title.history.keys() | sort(reverse=True) %}
+<tr>
+<th>{{date | truncate(19, True, '') }}</th>
+<td>{{process.title.history[date]}}</td>
+</tr>
+{% endfor %}
+
+</table>
+{% endblock %}