Merge branch 'master' of https://repo.cimeyclust.com/CimeyClust/HabitTracker
This commit is contained in:
commit
ce68bc9786
42
app.py
42
app.py
@ -172,7 +172,7 @@ def index():
|
||||
|
||||
# Sort habits by whether they have been checked today and then by slot
|
||||
for habit_list in habit_lists:
|
||||
habit_list.habits = sorted(habit_list.get_habits(), key=lambda habit: (not habit.checked, habit.slot))
|
||||
habit_list.habits = sorted(habit_list.get_habits(), key=lambda habit: (habit.checked, habit.slot))
|
||||
|
||||
days = {"Monday": "Montag", "Tuesday": "Dienstag", "Wednesday": "Mittwoch", "Thursday": "Donnerstag",
|
||||
"Friday": "Freitag", "Saturday": "Samstag", "Sunday": "Sonntag"}
|
||||
@ -844,6 +844,46 @@ def user_leave():
|
||||
habit_list.remove_user(current_user.id)
|
||||
return redirect(url_for("index"))
|
||||
|
||||
@app.route('/accept-list', methods=['POST'])
|
||||
@login_required
|
||||
def accept_list():
|
||||
list_id = request.form.get('list_id')
|
||||
habit_list = HabitList.get(int(list_id))
|
||||
|
||||
users = habit_list.get_users()
|
||||
# Check if user is part of the list
|
||||
found = False
|
||||
for user in users:
|
||||
if user.id == habit_list.id:
|
||||
found = True
|
||||
break
|
||||
|
||||
if not found:
|
||||
return redirect(url_for("index"))
|
||||
|
||||
current_user.accept_List(list_id)
|
||||
return {}
|
||||
|
||||
@app.route('/deny-list', methods=['POST'])
|
||||
@login_required
|
||||
def deny_list():
|
||||
list_id = request.form.get('list_id')
|
||||
habit_list = HabitList.get(int(list_id))
|
||||
|
||||
users = habit_list.get_users()
|
||||
# Check if user is part of the list
|
||||
found = False
|
||||
for user in users:
|
||||
if user.id == habit_list.id:
|
||||
found = True
|
||||
break
|
||||
|
||||
if not found:
|
||||
return redirect(url_for("index"))
|
||||
|
||||
habit_list.remove_user(current_user.id)
|
||||
return {}
|
||||
|
||||
|
||||
# Run the application
|
||||
if __name__ == '__main__':
|
||||
|
||||
BIN
static/favicon.ico
Normal file
BIN
static/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
@ -115,12 +115,22 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<a class="me-5" href="/users-leave?habit_list={{habit_list.id}}" style="width: 40px; height: 40px; min-height: 3em;"
|
||||
data-toggle="tooltip" data-placement="top" title="Liste verlassen">
|
||||
<i class="bi bi-box-arrow-left" style="font-size: 24px;"></i>
|
||||
</a>
|
||||
<div class="col">
|
||||
<div class="avatar-stack">
|
||||
{% for user in habit_list.get_users() %}
|
||||
{% if current_user.id != user.id %}
|
||||
<img class="avatar" src="/{{user.profile_image}}" data-toggle="tooltip" data-placement="top"
|
||||
title="{{user.name}}"/>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
<div class="col-4"></div>
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" >
|
||||
<title>{{ title }} - HabitTracker</title>
|
||||
<link rel="icon" href="/static/favicon.ico">
|
||||
|
||||
<!-- CSS -->
|
||||
<link rel="stylesheet" type="text/css" href="../../static/css/background.css">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user