[GTK] Test gardening
[WebKit-https.git] / Websites / browserbench.org / Speedometer2.0 / resources / todomvc / architecture-examples / emberjs-debug / source / app / controllers / application.js
1 import Ember from 'ember';
2
3 export default Ember.Controller.extend({
4     repo: Ember.inject.service(),
5     remaining: Ember.computed.filterBy('model', 'completed', false),
6     completed: Ember.computed.filterBy('model', 'completed'),
7     actions: {
8         createTodo(e) {
9             if (e.keyCode === 13 && !Ember.isBlank(e.target.value)) {
10                 this.get('repo').add({ title: e.target.value.trim(), completed: false });
11                 e.target.value = '';
12             }
13         },
14
15         clearCompleted() {
16             this.get('model').removeObjects(this.get('completed'));
17             this.get('repo').persist();
18         }
19     }
20 });