Permalink
Browse files

added delete

  • Loading branch information...
1 parent 3d83b35 commit 6ef36edcdc89936959bb4a128bf897061b884a53 @qoobaa committed Aug 15, 2011
Showing with 5 additions and 9 deletions.
  1. +1 −1 index.html
  2. +4 −8 lib/main.js
View
@@ -20,7 +20,7 @@
{{#collection contentBinding="Ficha.cardsController" tagName="ul"}}
{{content.front}} {{content.back}}
- {{#view SC.Button isActiveBinding="content.delete"}}Delete{{/view}}
+ {{#view SC.Button contentBinding="parentView.content" target="Ficha.cardsController" action="deleteCard"}}Delete{{/view}}
{{/collection}}
</script>
</body>
View
@@ -8,18 +8,14 @@ Ficha.Card = SC.Object.extend({
isValid: function () {
return this.get("front") && this.get("back");
- }.property("front", "back"),
-
- delete: function () {
- console.log("delete");
- }
+ }.property("front", "back")
});
Ficha.cardsController = SC.ArrayController.create({
content: [],
- delete: function (a) {
- console.log(a);
+ deleteCard: function (content) {
+ this.removeObject(content.get("content"));
}
});
@@ -45,7 +41,7 @@ Ficha.cardController = SC.Object.create({
});
Ficha.SideView = SC.TextField.extend({
- insertNewline: function (event) {
+ insertNewline: function () {
this.get("parentView").sideViewInsertNewline();
}
});

0 comments on commit 6ef36ed

Please sign in to comment.