Added habit list being fixed at one after page reload
This commit is contained in:
parent
1317161ae9
commit
88fc1ef573
9
app.py
9
app.py
@ -73,6 +73,12 @@ def index():
|
||||
for habit in habit_list.get_habits():
|
||||
habit.load_statistics()
|
||||
|
||||
# Get active_list from query parameter
|
||||
try:
|
||||
active_list = int(request.args.get('list'))
|
||||
except (ValueError, TypeError):
|
||||
active_list = None
|
||||
|
||||
return render_template(
|
||||
'index.html',
|
||||
title=name,
|
||||
@ -80,7 +86,8 @@ def index():
|
||||
heatmap_values=heatmap_values,
|
||||
day=day,
|
||||
color=heatmap_color,
|
||||
errors={}
|
||||
errors={},
|
||||
active_list=active_list
|
||||
)
|
||||
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
{% for habit_list in habit_lists %}
|
||||
|
||||
<li class="nav-item" role="presentation" id="tab-{{ habit_list.id }}">
|
||||
<a class="nav-link {% if habit_list == habit_lists[0] %} active {% endif %}"
|
||||
<a class="nav-link {% if (active_list is not none and active_list == habit_list.id) or (active_list is none and habit_list == habit_lists[0]) %} active {% endif %}"
|
||||
id="simple-tab-{{habit_list.id}}"
|
||||
data-bs-toggle="tab" href="#simple-tabpanel-{{habit_list.id}}" role="tab"
|
||||
aria-controls="simple-tabpanel-{{habit_list.id}}" aria-selected="true">
|
||||
@ -58,7 +58,7 @@
|
||||
|
||||
<div class="tab-content pt-5" id="tab-content">
|
||||
{% for habit_list in habit_lists %}
|
||||
<div class="tab-pane {% if habit_list == habit_lists[0] %} active {% endif %}"
|
||||
<div class="tab-pane {% if (active_list is not none and active_list == habit_list.id) or (active_list is none and habit_list == habit_lists[0]) %} active {% endif %}"
|
||||
id="simple-tabpanel-{{habit_list.id}}" role="tabpanel" aria-labelledby="simple-tab-{{habit_list.id}}">
|
||||
|
||||
<!-- Beschreibung und Löschen von der Liste -->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user