-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ejs
More file actions
34 lines (34 loc) · 906 Bytes
/
index.ejs
File metadata and controls
34 lines (34 loc) · 906 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!--
This file is the view template for displaying the habits.
-->
<!DOCTYPE html>
<html>
<head>
<title>Habit Tracker</title>
<link rel="stylesheet" type="text/css" href="/styles.css">
</head>
<body>
<h1>Habit Tracker</h1>
<form action="/habits" method="POST">
<input type="text" name="habitName" placeholder="Enter habit name" required>
<button type="submit">Add Habit</button>
</form>
<table>
<tr>
<th>Habit</th>
<% for (let date of dates) { %>
<th><%= date %></th>
<% } %>
</tr>
<% for (let habit of habits) { %>
<tr>
<td><%= habit.name %></td>
<% for (let date of dates) { %>
<td style="background-color: <%= habit.getGreenShade(date, 7) %>" onclick="updateHabitDate('<%= habit.id %>', '<%= date %>')"></td>
<% } %>
</tr>
<% } %>
</table>
<script src="/script.js"></script>
</body>
</html>