Explorar el Código

Commit 5.2: Add event handlers for Task buttons.

Frederic G. MARAND hace 8 años
padre
commit
366f5e0537
Se han modificado 1 ficheros con 14 adiciones y 1 borrados
  1. 14 1
      simple-todos.js

+ 14 - 1
simple-todos.js

@@ -26,4 +26,17 @@ if (Meteor.isClient) {
       // Prevent default form submit
       return false;
     }
-  });}
+  });
+
+  Template.task.events({
+    'click .delete': function (e) {
+      Tasks.remove(this._id);
+    },
+
+    'click .toggle-checked' : function (e) {
+      Tasks.update(this._id, {
+        $set: { checked: !this.checked }
+      });
+    }
+  });
+}