Skip to content

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
  • Loading branch information
suupic committed Aug 6, 2012
1 parent e4cffda commit ad711da
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 22 deletions.
Empty file modified index.html 100644 → 100755
Empty file.
55 changes: 33 additions & 22 deletions js/app.js 100644 → 100755
@@ -1,33 +1,44 @@
var App = Em.Application.create({ // 模型
name: 'TODO' Todo = Em.Object.extend({
}); text: null,

isDone: false,
TodosView = Em.View.extend({ changeStatus: function(){

if (this.isDone == false){
add: function(event){ this.set('isDone',true)
console.log('clicked'); }
TodosController.add(); else{
}, this.set('isDone',false)
done: function(event){ }
console.log(event); }
},
todoBinding: 'TodosController.content'
}); });


App.todo = Em.Object.create({ var App = Em.Application.create({
text: 'eating', name: 'TODO'
isDone: false
}); });


TodosController = Em.ArrayController.create({ TodosController = Em.ArrayController.create({
content: [], content: [],
init: function(){ init: function(){
var todo = App.todo;
this.pushObject(todo);
}, },
add: function(){ add: function(text){
var todo = App.todo; var todo = Todo.create({
this.pushObject(todo); text: text
})
this.pushObject(todo);
} }
}); });


TodosView = Em.View.extend({
add: function(event){
var myDate = new Date();
text = myDate.getMinutes() +':'+ myDate.getSeconds();
TodosController.add(text);
},
done: function(){
console.log(event.target);
var todo = this.get('context');
console.log(this);
console.log(this.get( 'content' ));
},
todoBinding: 'TodosController.content'
});

0 comments on commit ad711da

Please sign in to comment.