From 64ac168d9a80bf44e2473ea68c6dc862d8554761 Mon Sep 17 00:00:00 2001 From: Khwilo Kabaka Date: Mon, 11 Jan 2021 08:26:01 +0300 Subject: [PATCH 1/4] Set task as pinned --- app/components/single-task.hbs | 2 +- app/components/task-list.hbs | 2 +- app/controllers/index.js | 10 +++++++++- app/templates/index.hbs | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/components/single-task.hbs b/app/components/single-task.hbs index d644ec8..2d304b4 100644 --- a/app/components/single-task.hbs +++ b/app/components/single-task.hbs @@ -5,7 +5,7 @@
- Pin + Pin {{#if this.task.isComplete}} Undo {{else}} 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 @@
    {{#each this.tasks as |task|}} - + {{/each}}
\ No newline at end of file diff --git a/app/controllers/index.js b/app/controllers/index.js index 78d8779..42aa8d8 100644 --- a/app/controllers/index.js +++ b/app/controllers/index.js @@ -1,4 +1,12 @@ -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(); + } } diff --git a/app/templates/index.hbs b/app/templates/index.hbs index 13a70b0..07b6c37 100644 --- a/app/templates/index.hbs +++ b/app/templates/index.hbs @@ -25,7 +25,7 @@ No Pinned Tasks {{/if}}

Other Tasks

- +
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/templates/index.hbs b/app/templates/index.hbs index 07b6c37..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}} +