liste verbessert

This commit is contained in:
janphilippweinsheimer 2024-01-19 10:27:08 +01:00
parent 0d80cdcf9b
commit 2e1a2bc399
3 changed files with 30 additions and 28 deletions

13
app.py
View File

@ -5,7 +5,6 @@ from flask import Flask, render_template, redirect, url_for, request
from flask_login import login_required, LoginManager, login_user, logout_user, current_user from flask_login import login_required, LoginManager, login_user, logout_user, current_user
from models.User import User from models.User import User
from models.Habit import Habit
from utils import anonymous_required from utils import anonymous_required
# Create a new Flask instance # Create a new Flask instance
@ -32,18 +31,18 @@ def inject_user():
@app.route('/') @app.route('/')
def index(): def index():
# return 'Hello World' # return 'Hello World'
"""
if current_user.is_authenticated: if current_user.is_authenticated:
habits = Habit.get_all(current_user.id) habits = current_user.get_habits()
else: else:
habits = [] habits = []
"""
# habits = [("lesen", "eine Seite vor dem schlafen gehen"), ("sport", "3x Gym")] # habits = [("lesen", "eine Seite vor dem schlafen gehen"), ("sport", "3x Gym")]
return render_template( return render_template(
'index.html', 'index.html',
title='Home', title='Hallo ' + current_user.name,
utc_dt=datetime.datetime.now().strftime("%d.%m.%Y %H:%M:%S"), utc_dt=datetime.datetime.now().strftime("%d.%m.%Y %H:%M %A"),
#habits=habits habits=habits
) )

View File

@ -35,4 +35,4 @@ class User(UserMixin):
for habit in raw_habits: for habit in raw_habits:
habit = Habit(habit[0], habit[1], habit[2], habit[3], habit[4], habit[5], habit[6]) habit = Habit(habit[0], habit[1], habit[2], habit[3], habit[4], habit[5], habit[6])
habits.append(habit) habits.append(habit)
return habits if habits else None return habits

View File

@ -26,29 +26,32 @@
// Erstelle die Heatmap mit den simulierten Daten // Erstelle die Heatmap mit den simulierten Daten
createHeatmap(activityData); createHeatmap(activityData);
</script> </script>
<div class="row"> <h2>Task List</h2>
<div class="col-md-5">eins</div> <ul class="task-list row">
<div class="col-md-4">zwei {% for habit in habits %}
<h2>Task List</h2> <li class="row col-md-4">
<ul class="task-list"> <div class="col-auto">
<li class="task-item"> <input type="checkbox" class="task-checkbox">
<input type="checkbox" class="task-checkbox"> </div>
<span class="task-text">Task 1</span>
</li> <div class="col" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis">
<li class="task-item"> {{ habit.name }} hhhbhghbhjndjksbeujsdkfheuwaihgkjfgfjnsidkgjnkdghujds
<input type="checkbox" class="task-checkbox"> </div>
<span class="task-text">Task 2</span>
</li> </li>
<li class="task-item">
<input type="checkbox" class="task-checkbox"> <div class="col-md-8" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis">
<span class="task-text">Task 3</span> {{ habit.note }}
</li>
<!-- Add more tasks as needed -->
</ul>
</div> </div>
</div>
{% endfor %}
</ul>
{% endblock %} {% endblock %}