From 43d701d72b5bb2cc07f514df918401adacf698d0 Mon Sep 17 00:00:00 2001 From: Nathan Bonilla Date: Tue, 17 May 2022 11:54:38 -0700 Subject: [PATCH 1/3] submitted lab05 (may need more functionality) --- code/nathan/javascript/lab05/index.html | 24 ++++++++++++++++ code/nathan/javascript/lab05/script.js | 38 +++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 code/nathan/javascript/lab05/index.html create mode 100644 code/nathan/javascript/lab05/script.js diff --git a/code/nathan/javascript/lab05/index.html b/code/nathan/javascript/lab05/index.html new file mode 100644 index 00000000..76cca21f --- /dev/null +++ b/code/nathan/javascript/lab05/index.html @@ -0,0 +1,24 @@ + + + + + + + + Lab 05 + + +
+

{{ works }}

+

Todo List

+ + + + + +
+ + + \ No newline at end of file diff --git a/code/nathan/javascript/lab05/script.js b/code/nathan/javascript/lab05/script.js new file mode 100644 index 00000000..0335404e --- /dev/null +++ b/code/nathan/javascript/lab05/script.js @@ -0,0 +1,38 @@ + +const App = { + data() { + return { + // object + works: 'APP WORKS', + task: '', + completed: false, + todoList: [] + } + }, + + methods: { + addTodo() { + const newTask = this.task + const todoList = this.todoList + + todoList.push(newTask) + }, + + removeTodo(todo) { + const todoList = this.todoList + const todoIndex = todoList.indexOf(todo) + + todoList.splice(todoIndex, 1) + }, + + completeTodo(todo) { + const todoList = this.todoList + const todoIndex = todoList.indexOf(todo) + + + } + } +} + +const app = Vue.createApp(App) +app.mount('#app') \ No newline at end of file From 9cdf96eb29d8f14ab5a776abb958cf01ad900004 Mon Sep 17 00:00:00 2001 From: Nathan Bonilla Date: Tue, 17 May 2022 15:51:59 -0700 Subject: [PATCH 2/3] submitted lab05 complete --- code/nathan/javascript/lab05/index.html | 6 +++++- code/nathan/javascript/lab05/script.js | 7 +++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/code/nathan/javascript/lab05/index.html b/code/nathan/javascript/lab05/index.html index 76cca21f..7725896c 100644 --- a/code/nathan/javascript/lab05/index.html +++ b/code/nathan/javascript/lab05/index.html @@ -16,7 +16,11 @@

Todo List

diff --git a/code/nathan/javascript/lab05/script.js b/code/nathan/javascript/lab05/script.js index 0335404e..2fdbf699 100644 --- a/code/nathan/javascript/lab05/script.js +++ b/code/nathan/javascript/lab05/script.js @@ -25,11 +25,14 @@ const App = { todoList.splice(todoIndex, 1) }, - completeTodo(todo) { + completeTodo(todo, index) { const todoList = this.todoList const todoIndex = todoList.indexOf(todo) + const completeButton = document.getElementById("complete-button" + index) + const todoItem = document.getElementById(todo + index) - + completeButton.style.display = "none" + todoItem.style.textDecoration = "line-through" } } } From 6e8fcf4774af3f394936ca3efcc3c84dad9d8f59 Mon Sep 17 00:00:00 2001 From: Nathan Bonilla Date: Mon, 30 May 2022 20:59:53 -0700 Subject: [PATCH 3/3] corrected lab05 --- code/nathan/javascript/lab05/index.html | 14 +++++++++++--- code/nathan/javascript/lab05/script.js | 19 +++++++++++++------ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/code/nathan/javascript/lab05/index.html b/code/nathan/javascript/lab05/index.html index 7725896c..918ff4b2 100644 --- a/code/nathan/javascript/lab05/index.html +++ b/code/nathan/javascript/lab05/index.html @@ -16,12 +16,20 @@

Todo List

    -
  • +
  • -

    {{ todo }} - +

    {{ todo }} +

+ +

Completed

+
    +
  • + +

    {{ todo }} +

  • +
diff --git a/code/nathan/javascript/lab05/script.js b/code/nathan/javascript/lab05/script.js index 2fdbf699..81388fdd 100644 --- a/code/nathan/javascript/lab05/script.js +++ b/code/nathan/javascript/lab05/script.js @@ -6,7 +6,8 @@ const App = { works: 'APP WORKS', task: '', completed: false, - todoList: [] + todoList: [], + completedList: [] } }, @@ -25,14 +26,20 @@ const App = { todoList.splice(todoIndex, 1) }, - completeTodo(todo, index) { + completeTodo(todo) { const todoList = this.todoList const todoIndex = todoList.indexOf(todo) - const completeButton = document.getElementById("complete-button" + index) - const todoItem = document.getElementById(todo + index) + const completedList = this.completedList - completeButton.style.display = "none" - todoItem.style.textDecoration = "line-through" + completedList.push(todo) + todoList.splice(todoIndex, 1) + }, + + removeCompleted(todo) { + const completedList = this.completedList + const todoIndex = completedList.indexOf(todo) + + completedList.splice(todoIndex, 1) } } }