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

View File

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

View File

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