ember-cli-todos icon indicating copy to clipboard operation
ember-cli-todos copied to clipboard

checkbox should abide by actions up / bindings down

Open stefanpenner opened this issue 10 years ago • 5 comments

stefanpenner avatar Mar 25 '15 04:03 stefanpenner

is it something like that ? or i misunderstand the "actions up / bindings down" principle.

app/components/todos-route/template.js

{{input type="checkbox" class='toggle-all' checked=allAreDone 
        action="allAreDoneChange" on="change"}}

app/components/todos-route/component.js

allAreDone: false,

actions: {
  allAreDoneChange: function() {
    var todos = this.get('active'),
        value = this.get('allAreDone');

    todos.setEach('isCompleted', value);
    todos.invoke('save');
  },
  patchTodo: function(todo, propertyName, propertyValue) {
    todo.set(propertyName, propertyValue);
    todo.save();
  },
  removeTodo: function(todo) {
    todo.deleteRecord();
    todo.save();
 }
}

c0urg3tt3 avatar Mar 25 '15 08:03 c0urg3tt3

or i misunderstand the "actions up / bindings down" principle.

nope, you got it!

stefanpenner avatar Mar 25 '15 13:03 stefanpenner

@stefanpenner is it good for a PR ? checkbox-actions-up-bindings-down

c0urg3tt3 avatar Mar 26 '15 20:03 c0urg3tt3

sure, submit the PR i can give feed back easier then :)

stefanpenner avatar Mar 26 '15 20:03 stefanpenner

@stefanpenner is this looks ok to you? #26

tchak avatar Oct 13 '15 10:10 tchak