Skip to content

Commit

Permalink
MVC cards final
Browse files Browse the repository at this point in the history
Signed-off-by: fpumir <[email protected]>
  • Loading branch information
fpumir committed Oct 16, 2014
1 parent 0768f9c commit 1d521db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions board/js/UI.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var UI={

render:function(card){
render:function(card,callback){
var div=document.createElement('div');
div.classList.add('card');
var d=new Date(card.date);
Expand All @@ -26,7 +26,7 @@ var UI={
div.appendChild(deleteButton);
var board=document.getElementById('board');
board.appendChild(div);
deleteButton.addEventListener('click',deleteCard,false);
callback.call(this,deleteButton);
},

delete:function(elmt){
Expand Down
4 changes: 3 additions & 1 deletion board/js/cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ function getCard (e) {
card.date=cardDate;
model.add(card,function(){
console.log('item recorded');
UI.render(card);
UI.render(card,function(deleteButton){
deleteButton.addEventListener('click',deleteCard,false);
});
});
}

Expand Down

0 comments on commit 1d521db

Please sign in to comment.