|
1 | | -# Todo-list |
| 1 | +# ToDo List App |
2 | 2 |
|
3 | | -## Explanation |
| 3 | +The files in this folder implements a ToDo List App that allows a user to |
| 4 | +- Create a new ToDo task |
| 5 | +- Delete a ToDo task |
| 6 | +- Display all ToDo tasks |
| 7 | +- Changing the "completed" status of a ToDo task |
4 | 8 |
|
5 | | -This is a super handy, super simple to do list. |
6 | | - |
7 | | -You will be given a list of tasks which are "To Do". We call these tasks "ToDos" |
8 | | - |
9 | | -Each item in the list should have 2 buttons: |
10 | | - |
11 | | -- One to click when the ToDo has been completed - it will apply a line-through style to the text of the ToDo. |
12 | | -- A second to delete the ToDo. This could be used to delete completed ToDos from the list, or remove ToDos that we are no longer interested in doing. |
13 | | - |
14 | | -We also want to be able to add ToDos to the list using an input field and a button. When ToDos are created this way they should be added to the list with the 2 above buttons. |
15 | | - |
16 | | -More details for the implementation of this challenge can be found in `script.js` |
| 9 | +Each ToDo task has two properties: |
| 10 | + - `task`: A string describing the task |
| 11 | + - `completed`: a Boolean value that indicates whether the task is completed or not |
17 | 12 |
|
18 | 13 | ## Installation |
19 | 14 |
|
20 | | -To view the website, open index.html in a browser. |
21 | | - |
22 | | -## Example Solution |
| 15 | +To view the website, open `index.html` with Live Server in VS Code. |
23 | 16 |
|
24 | | -A basic example of this can website can be found here |
| 17 | +**Note**: The app is loaded **as ES modules** in the HTML file, and as such, the HTML file must be accessed via the HTTP or HTTPS protocol. |
25 | 18 |
|
26 | | -https://chrisowen101.github.io/ToDoListSolution/ |
| 19 | +## Understanding how the code is organized as ES modules |
27 | 20 |
|
28 | | -This covers only the basic tasks, not the advanced tasks. |
| 21 | +- [What is ES Modules?](00-what_is_ES_modules.md) |
| 22 | +- [How to use ES modules with Node.js and Jest?](01-using_esm_with_nodejs_and_jest.md) |
| 23 | +- [A guide to modularize a web app](02-guide_to_modularize_code.md) |
29 | 24 |
|
30 | 25 | ## Instructions |
31 | 26 |
|
32 | | -The `populateTodoList()` function should iterate over the list of todos that we are given at the start, it should create a `<li>` for the todo along with some other stuff that you can find in index.html and below. |
33 | | - |
34 | | -The items in the todo list are currently hard-coded into the HTML, refactor the code so that this function creates them and adds the following functionality to them: |
| 27 | +In this exercise, your objective is to implement additional features. |
35 | 28 |
|
36 | | -Each todo should have this HTML inside it: |
| 29 | +#### Feature 1: Mass delete of completed ToDos |
37 | 30 |
|
38 | | -```html |
39 | | -<span class="badge bg-primary rounded-pill"> |
40 | | - <i class="fa fa-check" aria-hidden="true"></i> |
41 | | - <i class="fa fa-trash" aria-hidden="true"></i> |
42 | | -</span> |
43 | | -``` |
| 31 | +Add a "Delete completed tasks" button that, when clicked, will delete all the completed ToDos. You should |
| 32 | +- In `todos.mjs`, implement a function to delete all completed tasks in the given ToDo List |
| 33 | +- In `todos.test.mjs`, implement a test to check your function. |
| 34 | +- In `script.js`, call the function to delete all completed tasks whenever the user clicks a "Delete All" button. |
44 | 35 |
|
45 | | -The first `<i>` tag needs an event listener that applies a line-through text-decoration styling to the text of the todo. It should remove the styling if it is clicked again. |
| 36 | +#### Stretch 1: Set deadlines for ToDos |
46 | 37 |
|
47 | | -The second `<i>` tag needs an event listener that deletes the parent `<li>` element from the `<ul>`. |
48 | | - |
49 | | -## Advanced Challenge |
50 | | - |
51 | | -### Mass delete of completed ToDos |
52 | | - |
53 | | -Develop the ToDo list further and allow users to delete all completed ToDos. |
54 | | - |
55 | | -Add a button that users can click that will iterate through the list of ToDos and then delete them only if they have been completed. |
56 | | - |
57 | | -## Extra Advanced Challenge |
| 38 | +We want users to be able to set, and see, deadlines for their ToDos. |
58 | 39 |
|
59 | | -### Set deadlines for ToDos |
| 40 | +When creating a ToDo we want the user to be able to use a datepicker input to specify a deadline for the Todo. |
| 41 | +If no date is selected, the ToDo is considered having no deadline. |
60 | 42 |
|
61 | | -We want users to be able to set, and see, deadlines for their ToDos. |
| 43 | +When displaying a ToDo in the list, display the deadline only if the ToDo has one. |
62 | 44 |
|
63 | | -When creating ToDos we want the user to be able to use a datepicker input so they can see when they need to complete the ToDo. The date can be added to the ToDo in the list. If there is no date set when the ToDo is created then this can be skipped. |
| 45 | +#### Stretch 2: EXTRA CHALLENGE |
64 | 46 |
|
65 | | -EXTRA CHALLENGE: instead of displaying the date on the ToDo, implement a countdown of days left until the deadline. You can use the Javascript Date reference to accomplish this: |
| 47 | +Instead of displaying the date on the ToDo, implement a countdown of days left until the deadline. You can use the Javascript Date reference to accomplish this: |
66 | 48 | https://www.w3schools.com/jsref/jsref_obj_date.asp |
0 commit comments