Commit 5a2db4c0 authored by Addy Osmani's avatar Addy Osmani

Merge pull request #618 from snize/gh-pages

Fixing #617
parents e149f24f 13d6a876
...@@ -191,7 +191,40 @@ if (Meteor.is_client) { ...@@ -191,7 +191,40 @@ if (Meteor.is_client) {
// Register click events for clearing completed todos // Register click events for clearing completed todos
Template.footer.events = { Template.footer.events = {
'click button#clear-completed': function() { 'click button#clear-completed': function() {
Todos.remove({completed: true}); Meteor.call('clearCompleted');
} }
}; };
} }
//Publish and subscribe setting
if (Meteor.is_server) {
Meteor.publish('todos', function () {
return Todos.find();
});
}
if (Meteor.is_client) {
Meteor.subscribe('todos');
}
//Allow users to write directly to this collection from client code, subject to limitations you define.
if (Meteor.is_server) {
Todos.allow({
insert: function () {
return true;
},
update: function () {
return true;
},
remove: function () {
return true;
}
});
}
//Defines functions that can be invoked over the network by clients.
Meteor.methods({
clearCompleted: function () {
Todos.remove({completed: true});
}
});
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment