-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
56cb73f
commit 116bfba
Showing
10 changed files
with
89 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,8 @@ | ||
import {createTodo} from "./create.js"; | ||
// import {} from "./project"; | ||
import css from "./style.css"; | ||
import '@fortawesome/fontawesome-free/js/fontawesome' | ||
import '@fortawesome/fontawesome-free/js/solid' | ||
|
||
import {listenForAdd} from "./modules/controller"; | ||
|
||
window.addEventListener("load", () => { | ||
createTodo(); | ||
listenForAdd(); | ||
}); | ||
|
||
|
||
|
||
|
||
// // Set todo status to complete module | ||
// // Get all check icons and add event listeners to them | ||
// let done = document.querySelectorAll(".fa-circle-check"); | ||
// done.forEach((item) => { | ||
// item.addEventListener("click", (event) => { | ||
// completeTask(event); | ||
// }); | ||
// }); | ||
|
||
// // Mark task complete | ||
// const completeTask = (event) => { | ||
// let task = event.target.nextElementSibling; | ||
// let text = task.innerHTML; | ||
// if (text.includes("<del>")) { | ||
// task.parentNode.parentNode.setAttribute("data-complete", "false"); | ||
// text = task.firstElementChild.textContent; | ||
// task.innerHTML = text; | ||
// } else { | ||
// task.innerHTML = `<del>${text}</del>`; | ||
// task.parentNode.parentNode.setAttribute("data-complete", "true"); | ||
// } | ||
// }; | ||
|
||
// Changing todo priority module | ||
|
||
// Dom manipulation module | ||
|
||
// Popup form https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_popup_form |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {addTodo} from "./model.js"; | ||
import {display} from "./view.js"; | ||
|
||
let todoInputField = document.querySelector("#todoInputField"); | ||
const addButton = document.querySelector(".addTodoButton"); | ||
|
||
function listenForAdd() { | ||
console.log(addButton); | ||
addButton.addEventListener("click", () => { | ||
let todoTitle = todoInputField.value; | ||
display(addTodo(todoTitle)); | ||
}); | ||
} | ||
|
||
export {listenForAdd}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import {Todo} from "./entities"; | ||
|
||
const todoList = []; | ||
|
||
function addTodo(title, due, prio){ | ||
let newTodo = new Todo(title, due, prio); | ||
todoList.push(newTodo); | ||
return todoList; | ||
} | ||
|
||
export {addTodo}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const todoTable = document.querySelector("table"); | ||
|
||
function display(currentTodoArray){ | ||
// Wipeout current list | ||
todoTable.innerHTML = ""; | ||
// loop through list | ||
currentTodoArray.forEach((todo)=>{ | ||
// Create and add a new row to the table | ||
todoTable.appendChild(createRow(todo.title)); | ||
}) | ||
} | ||
|
||
function createRow(title) { | ||
console.log(title); | ||
const newRow = document.createElement("tr"); | ||
newRow.innerHTML=`<td>${title}</td>`; | ||
return newRow; | ||
} | ||
|
||
export {display}; |
This file was deleted.
Oops, something went wrong.