1
0
mirror of https://github.com/fazo96/homework.git synced 2025-01-25 14:34:20 +01:00
homework/app.coffee

21 lines
563 B
CoffeeScript
Raw Normal View History

2014-05-25 12:01:38 +02:00
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) ->
if e.keyCode is 13
todos.insert { content: template.find('#newNote').value }
2014-05-25 12:05:19 +02:00
template.find('#newNote').value = ""
2014-05-25 12:01:38 +02:00
}