diff --git a/app/components/single-task.hbs b/app/components/single-task.hbs index d644ec8..a60d490 100644 --- a/app/components/single-task.hbs +++ b/app/components/single-task.hbs @@ -5,12 +5,8 @@
- Pin - {{#if this.task.isComplete}} - Undo - {{else}} - Done - {{/if}} + Pin +
diff --git a/app/components/task-list.hbs b/app/components/task-list.hbs index 41b6c7c..18fc1bd 100644 --- a/app/components/task-list.hbs +++ b/app/components/task-list.hbs @@ -1,7 +1,7 @@
\ No newline at end of file diff --git a/app/components/toggle-complete.hbs b/app/components/toggle-complete.hbs new file mode 100644 index 0000000..7de2bdf --- /dev/null +++ b/app/components/toggle-complete.hbs @@ -0,0 +1,3 @@ + + {{if @task.isComplete "Undo" "Done"}} + \ No newline at end of file diff --git a/app/controllers/index.js b/app/controllers/index.js index 78d8779..4e35203 100644 --- a/app/controllers/index.js +++ b/app/controllers/index.js @@ -1,4 +1,17 @@ -import Controller from '@ember/controller'; +import Controller from "@ember/controller"; +import { tracked } from "@glimmer/tracking"; +import { action } from "@ember/object"; export default class IndexController extends Controller { + @tracked pinnedTask; + + @action + setTaskAsPinned(task) { + this.pinnedTask = task.toJSON(); + } + + get completedTasks() { + const count = this.model.filter((task) => task.isComplete).length; + return count; + } } diff --git a/app/templates/index.hbs b/app/templates/index.hbs index 13a70b0..f5aad2b 100644 --- a/app/templates/index.hbs +++ b/app/templates/index.hbs @@ -9,11 +9,7 @@
Unpin - {{#if this.pinnedTask.isComplete}} - Undo - {{else}} - Done - {{/if}} +
@@ -25,7 +21,7 @@ No Pinned Tasks {{/if}}

Other Tasks

- +