Skip to content
This repository was archived by the owner on Jan 22, 2024. It is now read-only.

Commit 69e8f5d

Browse files
author
Steven Morrison
committed
SM: task complete property & logic added.
1 parent 83d9ff8 commit 69e8f5d

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

css/style.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ html {
123123
display: none;
124124
}
125125

126+
.task-complete {
127+
color: #aaa;
128+
text-decoration: line-through;
129+
}
130+
126131
.clear {
127132
clear: both;
128133
}

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ <h3 class="category-name">{{ cat.name }}</h3>
3030
</li>
3131
<li v-for="(task, taskIndex) in cat.tasks" class="task-list-item">
3232
<div class="delete-icon task-delete-icon" v-on:click="showModal(taskIndex, 'task-delete', index)">X</div>
33-
<p>{{ task }}</p>
33+
<p v-bind:class="{'task-complete': task.complete}">{{ task.text }}</p>
3434

3535
<div class="clear"></div>
3636
</li>

js/app.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,15 @@ var app = new Vue({
7878
input.value = "";
7979
},
8080
createTask: function(category) {
81-
var task = document.getElementById(category + '-task-input').value.trim();
82-
// add task to category.tasks array & hide input
83-
if(task.length) {
81+
var taskInput = document.getElementById(category + '-task-input').value.trim();
82+
83+
if(taskInput.length) {
84+
// add task to category.tasks array & hide input
85+
var task = {
86+
'text': taskInput,
87+
'complete' : 0
88+
};
89+
8490
this.categories[category].tasks.push(task);
8591
this.hideTaskInput(this.lastNewTaskCategory);
8692
}

0 commit comments

Comments
 (0)