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

Commit 082fdc5

Browse files
author
Steven Morrison
committed
SM: Task completion added.
1 parent 69e8f5d commit 082fdc5

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
## VueJS Task Manager
2-
Version 0.0.1
2+
Version 1.0.0
33

44
Trello inspired task manager written in JavaScript using the VueJS framework.
55

66
![Task Manager](screenshot.png?raw=true "Task Manager")
77

8-
### Work in progress (WIP):
8+
### Possible future Additions:
99
* Task input focus open, and close on unfocus.
10-
* Unfocus on category create.
11-
* Possibly add completion feature.
10+
* Unfocus on category create.

index.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ <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 v-bind:class="{'task-complete': task.complete}">{{ task.text }}</p>
33+
34+
<p v-bind:class="{'task-complete': task.complete}" v-on:click="toggleCompletion(taskIndex, index, task.complete)">
35+
{{ task.text }}
36+
</p>
3437

3538
<div class="clear"></div>
3639
</li>

js/app.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,16 @@ var app = new Vue({
9898
this.categories[data.parentIndex].tasks.splice(data.index, 1);
9999
this.updateAppStorage();
100100
},
101+
toggleCompletion: function(taskIndex, index, complete) {
102+
// Default false
103+
var updatedStatus = 0;
104+
// Switch val if necessary (!= false/updatedStatus)
105+
if(!complete) updatedStatus = 1;
106+
107+
// Update data & update local storage
108+
this.categories[index].tasks[taskIndex].complete = updatedStatus;
109+
this.updateAppStorage();
110+
},
101111
updateAppStorage: function() {
102112
// Check if this.categories isn't empty
103113
if(this.categories.length) {

0 commit comments

Comments
 (0)