diff --git a/app/app_template/actions.py b/app/app_template/actions.py index 076fd61..76c7379 100644 --- a/app/app_template/actions.py +++ b/app/app_template/actions.py @@ -40,7 +40,7 @@ def send_page(self, page): # Hidrate page match page: case "home": - update_TODO(self) + pass def action_signup(self, data): @@ -88,29 +88,10 @@ def action_logout(self): send_page(self, "login") -def add_lap(self): - """Add lap to Home page""" - # Send current time to client - self.send_html({ - "selector": "#laps", - "html": render_to_string("components/_lap.html", {"time": datetime.now()}), - "append": True, - }) - - def add_task(self, data): - """Add task from TODO section""" - # Add task to list - self.scope["session"]["tasks"].append(data["task"]) - self.scope["session"].save() - # Update task list - update_TODO(self) - - -def update_TODO(self): """Update TODO list""" self.send_html({ - "selector": "#todo", - "html": render_to_string("components/_tasks.html", {"tasks": self.scope["session"]["tasks"]}), - "append": False, + "selector": "#todo-list", + "html": render_to_string("components/_task.html", {"task": data["newTask"]}), + "append": True, }) \ No newline at end of file diff --git a/app/app_template/consumers.py b/app/app_template/consumers.py index 9e7f295..6109153 100644 --- a/app/app_template/consumers.py +++ b/app/app_template/consumers.py @@ -9,11 +9,6 @@ class ExampleConsumer(JsonWebsocketConsumer): """Event when client connects""" # Accept the connection self.accept() - # Make session task list - if "tasks" not in self.scope["session"]: - self.scope["session"]["tasks"] = [] - self.scope["session"].save() - def disconnect(self, close_code): """Event when client disconnects""" @@ -38,8 +33,6 @@ class ExampleConsumer(JsonWebsocketConsumer): actions.action_login(self, data) case "Logout": actions.action_logout(self) - case "Add lap": - actions.add_lap(self) case "Add task": actions.add_task(self, data) diff --git a/app/app_template/templates/base.html b/app/app_template/templates/base.html index c27346a..9581d66 100644 --- a/app/app_template/templates/base.html +++ b/app/app_template/templates/base.html @@ -6,7 +6,7 @@ Example website - +
- +
{% include page %}
diff --git a/app/app_template/templates/components/_nav.html b/app/app_template/templates/components/_nav.html index ae564ae..b4b3b71 100644 --- a/app/app_template/templates/components/_nav.html +++ b/app/app_template/templates/components/_nav.html @@ -1,10 +1,11 @@ -