1
0
mirror of https://github.com/fazo96/homework.git synced 2025-01-24 14:24:20 +01:00
homework/app.coffee
2014-05-25 12:01:38 +02:00

21 lines
546 B
CoffeeScript

todos = new Meteor.Collection "todos"
if Meteor.isServer
#todos.insert { content: "Example" } unless todos.find().fetch().length > 0
Meteor.publish "todos", -> todos.find()
if Meteor.isClient
Meteor.subscribe "todos"
Template.notes.notes = ->
todos.find().fetch()
Template.notes.events {
'click .delete': ->
todos.remove @_id
}
Template.adder.events {
'keypress #newNote': (e,template) ->
console.log e.keyCode
if e.keyCode is 13
todos.insert { content: template.find('#newNote').value }
}