Skip to content

Commit 0a1fafd

Browse files
committed
Format HTML code
1 parent 643faf6 commit 0a1fafd

File tree

1 file changed

+95
-39
lines changed

1 file changed

+95
-39
lines changed

templates/index.html

Lines changed: 95 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,123 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<title>Endless Task List App using Flask</title>
5-
<link rel="stylesheet" href="{{ url_for('static', filename='css/index.css') }}">
5+
<link
6+
rel="stylesheet"
7+
href="{{ url_for('static', filename='css/index.css') }}"
8+
/>
69
</head>
710
<body>
811
<h1>Endless Task List App using Flask</h1>
912
<ul>
1013
{% with messages = get_flashed_messages() %}<!--get flashed messages to display-->
1114
{% if messages %}
12-
<div class="popup-message"><!--display popup messages-->
13-
{% for message in messages %}
15+
<div class="popup-message">
16+
<!--display popup messages-->
17+
{% for message in messages %}
1418
<p>{{ message }}</p>
15-
{% endfor %}
19+
{% endfor %}
1620
</div>
17-
{% endif %}
18-
{% endwith %}
19-
{{ user.username }}:<br>
20-
Level {{ user.level }}<br>
21-
Total XP: {{ user.total_xp | short_numeric }}<br>
22-
{{ user.xp | short_numeric }} / {{ user.xp_required | short_numeric }} XP<br>
23-
Rating: {{ user.rating | round_number_with_commas }}<br>
24-
<div class="progress-container"><!--get current level progress-->
25-
<progress value="{{ user.xp }}" max="{{ user.xp_required }}"></progress>
26-
<div class="progress-text">{{ (user.xp / user.xp_required * 100) | short_numeric }}%</div>
21+
{% endif %} {% endwith %} {{ user.username }}:<br />
22+
Level {{ user.level }}<br />
23+
Total XP: {{ user.total_xp | short_numeric }}<br />
24+
{{ user.xp | short_numeric }} / {{ user.xp_required | short_numeric
25+
}} XP<br />
26+
Rating: {{ user.rating | round_number_with_commas }}<br />
27+
<div class="progress-container">
28+
<!--get current level progress-->
29+
<progress
30+
value="{{ user.xp }}"
31+
max="{{ user.xp_required }}"
32+
></progress>
33+
<div class="progress-text">
34+
{{ (user.xp / user.xp_required * 100) | short_numeric }}%
35+
</div>
2736
</div>
28-
Add New Task<br>
29-
<form action="{{ url_for('add_task') }}" method="post"><!--form to add task-->
30-
<label for="name">Name: </label><input type="text" id="name" name="name" maxlength="80" required><br>
31-
<label for="due_date">Due date: </label><input type="date" id="due_date" name="due_date" min="{{ today }}" max="9999-12-31" value="{{ today }}" required><br>
32-
<label for="priority">Priority: </label><select id="priority" name="priority">
37+
Add New Task<br />
38+
<form action="{{ url_for('add_task') }}" method="post">
39+
<!--form to add task-->
40+
<label for="name">Name: </label
41+
><input
42+
type="text"
43+
id="name"
44+
name="name"
45+
maxlength="80"
46+
required
47+
/><br />
48+
<label for="due_date">Due date: </label
49+
><input
50+
type="date"
51+
id="due_date"
52+
name="due_date"
53+
min="{{ today }}"
54+
max="9999-12-31"
55+
value="{{ today }}"
56+
required
57+
/><br />
58+
<label for="priority">Priority: </label
59+
><select id="priority" name="priority">
3360
<option value="1" selected>Low</option>
3461
<option value="2">Medium</option>
35-
<option value="3">High</option>
36-
</select><br>
37-
<label for="difficulty">Difficulty: </label><select id="difficulty" name="difficulty">
62+
<option value="3">High</option></select
63+
><br />
64+
<label for="difficulty">Difficulty: </label
65+
><select id="difficulty" name="difficulty">
3866
<option value="1" selected>Easy</option>
3967
<option value="2">Medium</option>
40-
<option value="3">Hard</option>
41-
</select><br>
42-
<label for="repeat_interval">Repeat every: </label><input type="number" id="repeat_interval" name="repeat_interval" min="1" step="1" value="1"><br>
43-
<label for="repeat_often">Repeat interval: </label><select id="repeat_often" name="repeat_often">
68+
<option value="3">Hard</option></select
69+
><br />
70+
<label for="repeat_interval">Repeat every: </label
71+
><input
72+
type="number"
73+
id="repeat_interval"
74+
name="repeat_interval"
75+
min="1"
76+
step="1"
77+
value="1"
78+
/><br />
79+
<label for="repeat_often">Repeat interval: </label
80+
><select id="repeat_often" name="repeat_often">
4481
<option value="1">Daily</option>
4582
<option value="2">Weekly</option>
4683
<option value="3">Monthly</option>
4784
<option value="4">Yearly</option>
48-
<option value="5" selected>Once</option>
49-
</select><br>
50-
<input type="submit" value="Add Task"><!--button to add task-->
85+
<option value="5" selected>Once</option></select
86+
><br />
87+
<input
88+
type="submit"
89+
value="Add Task"
90+
/><!--button to add task-->
5191
</form>
5292
<ul>
5393
{% for task in tasks %}<!--repeat for each task in task list-->
54-
<li>{{ task.name }}<br>
55-
Due: {{ task.due_date }}</li>
56-
Priority: {% if task.priority == 1 %} Low {% elif task.priority == 2 %} Medium {% elif task.priority == 3 %} High {% endif %}<br>
57-
Difficulty: {% if task.difficulty == 1 %} Easy {% elif task.difficulty == 2 %} Medium {% elif task.difficulty == 3 %} Hard {% endif %}<br>
58-
Repeat: {% if task.repeat_often != 5 %} {{ task.repeat_interval }} {% endif %} {% if task.repeat_often == 1 %} Day{% if task.repeat_interval > 1 %}s {% endif %}{% elif task.repeat_often == 2 %} Week{% if task.repeat_interval > 1 %}s {% endif %}{% elif task.repeat_often == 3 %} Month{% if task.repeat_interval > 1 %}s {% endif %}{% elif task.repeat_often == 4 %} Year{% if task.repeat_interval > 1 %}s {% endif %}{% elif task.repeat_often == 5 %} Once {% endif %}<br>
94+
<li>
95+
{{ task.name }}<br />
96+
Due: {{ task.due_date }}
97+
</li>
98+
Priority: {% if task.priority == 1 %} Low {% elif task.priority
99+
== 2 %} Medium {% elif task.priority == 3 %} High {% endif %}<br />
100+
Difficulty: {% if task.difficulty == 1 %} Easy {% elif
101+
task.difficulty == 2 %} Medium {% elif task.difficulty == 3 %}
102+
Hard {% endif %}<br />
103+
Repeat: {% if task.repeat_often != 5 %} {{ task.repeat_interval
104+
}} {% endif %} {% if task.repeat_often == 1 %} Day{% if
105+
task.repeat_interval > 1 %}s {% endif %}{% elif
106+
task.repeat_often == 2 %} Week{% if task.repeat_interval > 1 %}s
107+
{% endif %}{% elif task.repeat_often == 3 %} Month{% if
108+
task.repeat_interval > 1 %}s {% endif %}{% elif
109+
task.repeat_often == 4 %} Year{% if task.repeat_interval > 1 %}s
110+
{% endif %}{% elif task.repeat_often == 5 %} Once {% endif %}<br />
59111
{% if not task.completed %}<!--show complete button if task is not completed-->
60-
<a href="/complete_task/{{ task.id }}">Complete</a>
61-
{% endif %}
62-
<a href="/delete_task/{{ task.id }}" onclick="return {{ 'confirm(\'Are you sure you want to delete this task?\')' if not task.completed else 'true' }}">Delete</a><!--alert to confirm user to delete the task if task is not completed, if task is completed don't alert user to confirm task deletion-->
112+
<a href="/complete_task/{{ task.id }}">Complete</a>
113+
{% endif %}
114+
<a
115+
href="/delete_task/{{ task.id }}"
116+
onclick="return {{ 'confirm(\'Are you sure you want to delete this task?\')' if not task.completed else 'true' }}"
117+
>Delete</a
118+
><!--alert to confirm user to delete the task if task is not completed, if task is completed don't alert user to confirm task deletion-->
63119
{% endfor %}
64120
</ul>
65121
</ul>
66122
</body>
67-
</html>
123+
</html>

0 commit comments

Comments
 (0)