-
Pin
+
+
Pin
{{#if this.task.isComplete}}
Undo
{{else}}
diff --git a/app/components/single-task.js b/app/components/single-task.js
index 30b0515..23fa89a 100644
--- a/app/components/single-task.js
+++ b/app/components/single-task.js
@@ -1,7 +1,18 @@
import Component from '@ember/component';
-import { tagName } from '@ember-decorators/component';
+import {
+ action
+} from '@ember/object';
+
+export default
-export default
-@tagName('')
class SingleTaskComponent extends Component {
+ @action
+ pin_task() {
+ this.onSentUp(this.task);
+ }
+
+ @action
+ toggle_task() {
+ this.task.isComplete = !this.task.isComplete;
+ }
}
diff --git a/app/components/task-list.hbs b/app/components/task-list.hbs
index 41b6c7c..963723c 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/components/task-list.js b/app/components/task-list.js
index d02703f..779ed90 100644
--- a/app/components/task-list.js
+++ b/app/components/task-list.js
@@ -1,7 +1,12 @@
import Component from '@ember/component';
-import { tagName } from '@ember-decorators/component';
+import {
+ action
+} from '@ember/object';
export default
-@tagName('')
class TaskListComponent extends Component {
+ @action
+ receivedAction() {
+ this.onSentUp(arguments[0]);
+ }
}
diff --git a/app/components/toggle-complete.hbs b/app/components/toggle-complete.hbs
new file mode 100644
index 0000000..553ff7a
--- /dev/null
+++ b/app/components/toggle-complete.hbs
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/app/components/toggle-complete.js b/app/components/toggle-complete.js
new file mode 100644
index 0000000..aff8fa1
--- /dev/null
+++ b/app/components/toggle-complete.js
@@ -0,0 +1,12 @@
+import Component from '@ember/component';
+import {
+ action
+} from '@ember/object';
+
+export default
+class TaskListComponent extends Component {
+ @action
+ toggled() {
+ this.onToggled();
+ }
+}
diff --git a/app/controllers/index.js b/app/controllers/index.js
index 78d8779..d5d7bbb 100644
--- a/app/controllers/index.js
+++ b/app/controllers/index.js
@@ -1,4 +1,17 @@
import Controller from '@ember/controller';
+import {
+ action
+} from '@ember/object';
+import { computed } from '@ember/object';
export default class IndexController extends Controller {
+ @action
+ pinned() {
+ this.set('pinnedTask', arguments[0]);
+ }
+
+ @computed('model.@each.isComplete')
+ get completedTasks() {
+ return this.model.filterBy('isComplete', true).length;
+ }
}
diff --git a/app/templates/index.hbs b/app/templates/index.hbs
index 13a70b0..9945428 100644
--- a/app/templates/index.hbs
+++ b/app/templates/index.hbs
@@ -8,11 +8,11 @@
- Unpin
+ Unpin
{{#if this.pinnedTask.isComplete}}
- Undo
+ Undo
{{else}}
- Done
+ Done
{{/if}}
@@ -25,7 +25,7 @@
No Pinned Tasks
{{/if}}
Other Tasks
-
+